From 5c0098e2f0ed7c90ab121482cc8f402884f05551 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 11:53:47 +0100 Subject: [PATCH 001/182] * add async interface support for eNB agent and create a lib --- cmake_targets/CMakeLists.txt | 15 +- openair2/UTIL/ASYNC_IF/link_manager.c | 247 +++++++++++++++++ openair2/UTIL/ASYNC_IF/link_manager.h | 69 +++++ openair2/UTIL/ASYNC_IF/message_queue.c | 211 +++++++++++++++ openair2/UTIL/ASYNC_IF/message_queue.h | 71 +++++ openair2/UTIL/ASYNC_IF/socket_link.c | 349 +++++++++++++++++++++++++ openair2/UTIL/ASYNC_IF/socket_link.h | 65 +++++ 7 files changed, 1026 insertions(+), 1 deletion(-) 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/socket_link.c create mode 100644 openair2/UTIL/ASYNC_IF/socket_link.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d7a656e61c..122d41baa2 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -473,6 +473,9 @@ add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name") add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") + +add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller") + ######################## # Include order ########################## @@ -687,6 +690,16 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ +if (ENB_AGENT) + 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 + ) + set(ASYNC_IF_LIB ASYNC_IF) +endif() +include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c ${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c @@ -1591,7 +1604,7 @@ 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} ${ASYNC_IF_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c new file mode 100644 index 0000000000..9b31fc043b --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -0,0 +1,247 @@ +/******************************************************************************* + 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 . + + 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 +#include +#include + +/* 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) { + 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; + + 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 + +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 +#include + +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..3e24b8679a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -0,0 +1,69 @@ +/******************************************************************************* + 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 . + + 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 "socket_link.h" + +#include + +#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 . + + 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 +#include +#include +#include + +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 . + + 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 + +#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/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c new file mode 100644 index 0000000000..95a92ae3ee --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -0,0 +1,349 @@ +/******************************************************************************* + 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 . + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; + + 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; + } + + 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; + + 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; + } + + 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 + +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 + +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 . + + 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 + +#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 */ From 7ccf7a917f2928858e3cc8ac86dea88e43a3be82 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 19:44:12 +0100 Subject: [PATCH 002/182] * add protobuf messages and compliation directives --- openair2/ENB_APP/MESSAGES/V2/header.proto | 19 ++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 69 +++++++ .../ENB_APP/MESSAGES/V2/stats_common.proto | 176 ++++++++++++++++++ .../ENB_APP/MESSAGES/V2/stats_messages.proto | 86 +++++++++ 4 files changed, 350 insertions(+) create mode 100644 openair2/ENB_APP/MESSAGES/V2/header.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/progran.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/stats_common.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/stats_messages.proto diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto new file mode 100644 index 0000000000..9193696491 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -0,0 +1,19 @@ +package protocol; + +message prp_header { + optional uint32 version = 1; + optional uint32 type = 2; + optional uint32 length = 3; + optional uint32 xid = 4; +} + +enum prp_type { + // Discovery and maintenance messages + PRPT_HELLO = 0; + PRPT_ECHO_REQUEST = 1; + PRPT_ECHO_REPLY = 2; + + // Statistics and measurement messages + PRPT_STATS_REQUEST = 3; + PRPT_STATS_REPLY = 4; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto new file mode 100644 index 0000000000..9e29f99532 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -0,0 +1,69 @@ +package protocol; + +import "stats_messages.proto"; + +// +// Maintenance and discovery messages +// + +// Empty message. Does not really have to be used. +// Could use only the header with the type set to PRPT_HELLO +message prp_hello { +} + +message prp_echo_request { + extensions 100 to 199; +} + + +message prp_echo_reply { + extensions 100 to 199; +} + + + +// +// Statistics request and reply message +// + +message prp_stats_request { + optional prp_stats_type type = 1; + oneof body { + prp_complete_stats_request complete_stats_request = 2; + prp_cell_stats_request cell_stats_request = 3; + prp_ue_stats_request ue_stats_request = 4; + } +} + +message prp_stats_reply { + optional prp_ue_stats_report ue_report = 1; + optional prp_cell_stats_report cell_report = 2; +} + + +// Extensions of the echo request and reply +// messages for carrying a latency value in ms +message prp_echo_request_latency { + extend prp_echo_request { + optional uint32 latency = 100; + } +} + +message prp_echo_reply_latency { + extend prp_echo_reply { + optional uint32 latency = 100; + } +} + + +//message progran_body { +// oneof msg { +// prp_hello hello_msg = 1; +// prp_echo_request echo_request_msg = 2; +// prp_echo_reply echo_reply_msg = 3; +// prp_stats_request stats_request_msg = 4; +// prp_stats_reply stats_reply_msg = 5; +// } +//} + + diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto new file mode 100644 index 0000000000..77df92a68b --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -0,0 +1,176 @@ +package protocol; + +// +// UE related statistics +// + +// RLC buffer status for a specific logical channel of a UE +message prp_rlc_bsr { + optional uint32 lc_id = 1; + optional uint32 tx_queue_size = 2; + optional uint32 tx_queue_hol_delay = 3; + optional uint32 retransmission_queue_size = 4; + optional uint32 retransmission_queue_hol_delay = 5; + optional uint32 status_pdu_size = 6; +} + +// Flags for MAC Control Elements +enum prp_ce_type { + PRPCET_TA = 1; + PRPCET_DRX = 2; + PRPCET_CR = 4; + PRPCET_CA = 8; +} + +// Types of DL CSI reports +enum prp_csi_type { + PRCSIT_P10 = 0; + PRCSIT_P11 = 1; + PRCSIT_P20 = 2; + PRCSIT_P21 = 3; + PRCSIT_A12 = 4; + PRCSIT_A22 = 5; + PRCSIT_A20 = 6; + PRCSIT_A30 = 7; + PRCSIT_A31 = 8; +} + +// CSI type P10 +message prp_csi_p10 { + optional uint32 wb_cqi = 1; +} + +// CSI type P11 +message prp_csi_p11 { + repeated uint32 wb_cqi = 1; + optional uint32 wb_pmi = 2; +} + +// CSI type P20 +message prp_csi_p20 { + optional uint32 wb_cqi = 1; + optional uint32 sb_cqi = 2; + optional uint32 bandwidth_part_index = 3; + optional uint32 sb_index = 4; +} + +// CSI type P21 +message prp_csi_p21 { + repeated uint32 wb_cqi = 1; + optional uint32 wb_pmi = 2; + repeated uint32 sb_cqi = 3; + optional uint32 badwidth_part_index = 4; + optional uint32 sb_index = 5; +} + +// CSI type A12 +message prp_csi_a12 { + repeated uint32 wb_cqi = 1; + repeated uint32 sb_pmi = 2; +} + +// CSI type A22 +message prp_csi_a22 { + repeated uint32 wb_cqi = 1; + repeated uint32 sb_cqi = 2; + optional uint32 wb_pmi = 3; + optional uint32 sb_pmi = 4; + repeated uint32 sb_list = 5; +} + +// CSI type A20 +message prp_csi_a20 { + optional uint32 wb_cqi = 1; + optional uint32 sb_cqi = 2; + repeated uint32 sb_list = 3; +} + +// CSI type A30 +message prp_csi_a30 { + optional uint32 wb_cqi = 1; + repeated uint32 sb_cqi = 2; +} + +// CSI type A31 +message prp_csi_a31 { + repeated uint32 wb_cqi = 1; + repeated prp_msb_cqi sb_cqi = 2; + optional uint32 wb_pmi = 3; +} + +// The CQI for the M-preffered subband +message prp_msb_cqi { + repeated uint32 sb_cqi = 1; +} + +// The CSI report of the UE for a specific servCellIndex +message prp_dl_csi { + optional uint32 serv_cell_index = 1; + optional uint32 ri = 2; + optional prp_csi_type type = 3; + oneof report { + prp_csi_p10 p10csi = 4; + prp_csi_p11 p11csi = 5; + prp_csi_p20 p20csi = 6; + prp_csi_p21 p21csi = 7; + prp_csi_a12 a12csi = 8; + prp_csi_a22 a22csi = 9; + prp_csi_a20 a20csi = 10; + prp_csi_a30 a30csi = 11; + prp_csi_a31 a31csi = 12; + } +} + +// The full DL CQI report for all CC of a UE +message prp_dl_cqi_report { + optional uint32 sfn_sn = 1; + repeated prp_dl_csi csi_report = 2; +} + +// Paging message info +message prp_paging_info { + optional uint32 paging_index = 1; + optional uint32 paging_message_size = 2; + optional uint32 paging_subframe = 3; + optional uint32 carrier_index = 4; +} + +// Report for the paging buffer status +message prp_paging_buffer_report { + repeated prp_paging_info paging_info = 1; +} + +// The type of UL CQI +enum prp_ul_cqi_type { + PRUCT_SRS = 0; + PRUCT_PUSCH = 1; + PRUCT_PUCCH_1 = 2; + PRUCT_PUCCH_2 = 3; + PRUCT_PRACH = 4; +} + +// UL CQI report for a specific UE for a given report type +message prp_ul_cqi { + optional prp_ul_cqi_type type = 1; + repeated uint32 sinr = 2; + optional uint32 serv_cell_index = 3; +} + +// Full UL CQI report for a specific UE +message prp_ul_cqi_report { + optional uint32 sfn_sn = 1; + repeated prp_ul_cqi cqi_meas = 2; +} + + +// +// Cell related statistics +// + +// The UL noise and interference report for a UE +message prp_noise_interference_report { + optional uint32 sfn_sf = 1; + optional uint32 rip = 2; + optional uint32 tnp = 3; +} + diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto new file mode 100644 index 0000000000..5ec7ae690c --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto @@ -0,0 +1,86 @@ +package protocol; + +//import "header.proto"; +import "stats_common.proto"; + +// +// Bodies of statistics report requests +// + +message prp_complete_stats_request { + optional prp_stats_report_freq report_frequency = 1; + optional uint32 sf = 2; + optional uint32 cell_report_flags = 3; + optional uint32 ue_report_flags = 4; +} + +message prp_cell_stats_request { + repeated uint32 cell = 1; + optional uint32 flags = 2; +} + +message prp_ue_stats_request { + repeated uint32 rnti = 1; + optional uint32 flags = 2; +} + +// +// Bodies of statistics reports +// + +// The full statistics report for a specific cell +message prp_cell_stats_report { + optional uint32 carrier_index = 1; + optional uint32 flags = 2; + optional prp_noise_interference_report noise_inter_report = 3; +} + +// Statistics report for a specific UE +message prp_ue_stats_report { + optional uint32 rnti = 1; + optional uint32 flags = 2; + repeated uint32 bsr = 3; + optional uint32 phr = 4; + repeated prp_rlc_bsr rlc_report = 5; + optional uint32 pending_mac_ces = 6; + optional prp_dl_cqi_report dl_cqi_report = 7; + optional prp_paging_buffer_report pbr = 8; + optional prp_ul_cqi_report ul_cqi_report = 9; +} + +// +// Types of statistics related enums +// + + +//Types of statistics requested by the controller +enum prp_stats_type { + PRST_COMPLETE_STATS = 0; + PRST_CELL_STATS = 1; + PRST_UE_STATS = 2; +} + +// Report frequency for the requested statistics +enum prp_stats_report_freq { + PRSRF_ONCE = 0; + PRSRF_PERIODICAL = 1; + PRSRF_CONTINUOUS = 2; + PRSRF_OFF = 3; +} + +// Flags for cell statistics +enum prp_cell_stats_type { + PRCST_NOISE_INTERFERENCE = 1; +} + +// Flags for UE-related statistics +enum prp_ue_stats_type { + PRUST_BSR = 1; + PRUST_PRH = 2; + PRUST_RLC_BS = 4; + PRUST_MAC_CE_BS = 8; + PRUST_DL_CQI = 16; + PRUST_PBS = 32; + PRUST_UL_CQI = 64; + // To be extended with more types of stats +} \ No newline at end of file From 694718963a9b6bbf3de73ea7fff3844b4e23e2c3 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 19:46:52 +0100 Subject: [PATCH 003/182] * script for automatic generation of protobug messages --- cmake_targets/tools/generate_protobuf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 cmake_targets/tools/generate_protobuf diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf new file mode 100755 index 0000000000..203fd1b0de --- /dev/null +++ b/cmake_targets/tools/generate_protobuf @@ -0,0 +1,15 @@ +#!/bin/bash + +function main() +{ +mkdir -p $1 +cd $1 + +echo generate protobuf messages inside $1 $2 + +protoc-c --c_out=$1 $2 +protoc --cpp_out=$1 $2 + +} + +main "$@" From 5f1f1abe3f5d7c4e52d4294d7876782fd2cc799b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 15 Dec 2015 22:47:08 +0200 Subject: [PATCH 004/182] Added header in messages and removed length field --- openair2/ENB_APP/MESSAGES/V2/header.proto | 5 ++- openair2/ENB_APP/MESSAGES/V2/progran.proto | 42 ++++++++++++---------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 9193696491..f25613d86d 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -3,8 +3,7 @@ package protocol; message prp_header { optional uint32 version = 1; optional uint32 type = 2; - optional uint32 length = 3; - optional uint32 xid = 4; + optional uint32 xid = 3; } enum prp_type { @@ -16,4 +15,4 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; -} \ No newline at end of file +} diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 9e29f99532..731bb2c4f5 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,22 +1,35 @@ package protocol; import "stats_messages.proto"; +import "header.proto" + +message progran_message { + oneof msg { + prp_hello hello_msg = 1; + prp_echo_request echo_request_msg = 2; + prp_echo_reply echo_reply_msg = 3; + prp_stats_request stats_request_msg = 4; + prp_stats_reply stats_reply_msg = 5; + } +} + // // Maintenance and discovery messages // -// Empty message. Does not really have to be used. -// Could use only the header with the type set to PRPT_HELLO message prp_hello { + optional prp_header header = 1; } message prp_echo_request { + optional prp_header header = 1; extensions 100 to 199; } message prp_echo_reply { + optional prp_header header = 1; extensions 100 to 199; } @@ -27,17 +40,19 @@ message prp_echo_reply { // message prp_stats_request { - optional prp_stats_type type = 1; + optional prp_header header = 1; + optional prp_stats_type type = 2; oneof body { - prp_complete_stats_request complete_stats_request = 2; - prp_cell_stats_request cell_stats_request = 3; - prp_ue_stats_request ue_stats_request = 4; + prp_complete_stats_request complete_stats_request = 3; + prp_cell_stats_request cell_stats_request = 4; + prp_ue_stats_request ue_stats_request = 5; } } message prp_stats_reply { - optional prp_ue_stats_report ue_report = 1; - optional prp_cell_stats_report cell_report = 2; + optional prp_header header = 1; + optional prp_ue_stats_report ue_report = 2; + optional prp_cell_stats_report cell_report = 3; } @@ -56,14 +71,3 @@ message prp_echo_reply_latency { } -//message progran_body { -// oneof msg { -// prp_hello hello_msg = 1; -// prp_echo_request echo_request_msg = 2; -// prp_echo_reply echo_reply_msg = 3; -// prp_stats_request stats_request_msg = 4; -// prp_stats_reply stats_reply_msg = 5; -// } -//} - - From 183e105f871d959609f9d541bb9fad63d38bd529 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 16 Dec 2015 11:58:48 +0100 Subject: [PATCH 005/182] update CMakeLists--generate .c files for protobufs --- cmake_targets/CMakeLists.txt | 45 +++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 122d41baa2..f8b1a343a5 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -244,6 +244,9 @@ endif (${RTAI}) set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") set(asn1_generated_dir ${OPENAIR_BIN_DIR}) +set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") +set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) + # RRC ###### add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA") @@ -691,14 +694,54 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ if (ENB_AGENT) + # set the version of protobuf messages, V3 not supported yet + add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + + if (${PRPT_VERSION} STREQUAL "V2") + set (PRPTDIR V2) + elseif (${PRPT_VERSION} STREQUAL "V3") + set (PRPTDIR V3) + endif(${PRPT_VERSION} STREQUAL "V2") + + set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} ) + set(PRPT_MSG_FILES + ${PRPT_MSG_DIR}/header.proto + ${PRPT_MSG_DIR}/progran.proto + ${PRPT_MSG_DIR}/stats_common.proto + ${PRPT_MSG_DIR}/stats_messages.proto + ) + + set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) + message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}) + file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) + set(PRPT_OAI_generated + ${PRPT_C_DIR}/header.pb-c.c + ${PRPT_C_DIR}/progran.pb-c.c + ${PRPT_C_DIR}/stats_common.pb-c.c + ${PRPT_C_DIR}/stats_messages.pb-c.c + ) + + file(GLOB prpt_h ${PRPT_C_DIR}/*.h) + set(prpt_h ${prpt_h} ) + + add_library(PRPT_MSG + ${PRPT_OAI_generated} + ${PRPT_source} + ) + + include_directories ("${PRPT_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 ) set(ASYNC_IF_LIB ASYNC_IF) + include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + endif() -include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c From 988b483ab0c069f6b452c9beb392badc1ba330ce Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 16 Dec 2015 16:53:37 +0100 Subject: [PATCH 006/182] * automatic generation of protobuf messages in CMakeList.txt --- cmake_targets/CMakeLists.txt | 8 ++++---- cmake_targets/tools/generate_protobuf | 12 ++++++++---- openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f8b1a343a5..197b94699c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -712,8 +712,8 @@ if (ENB_AGENT) ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) - message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}") - execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}) + #message("calling protoc_call=${protoc_call} PRPT_C_DIR=${PRPT_C_DIR} PRPT_MSG_FILES=${PRPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_DIR} ${PRPT_MSG_FILES}) file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) set(PRPT_OAI_generated ${PRPT_C_DIR}/header.pb-c.c @@ -729,7 +729,7 @@ if (ENB_AGENT) ${PRPT_OAI_generated} ${PRPT_source} ) - + set(PRPT_MSG_LIB PRPT_MSG) include_directories ("${PRPT_C_DIR}") add_library(ASYNC_IF @@ -1647,7 +1647,7 @@ 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} ${ASYNC_IF_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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf index 203fd1b0de..5c1b523f8c 100755 --- a/cmake_targets/tools/generate_protobuf +++ b/cmake_targets/tools/generate_protobuf @@ -3,12 +3,16 @@ function main() { mkdir -p $1 -cd $1 -echo generate protobuf messages inside $1 $2 +#echo generate protobuf messages inside $1 $2 -protoc-c --c_out=$1 $2 -protoc --cpp_out=$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 $* } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 731bb2c4f5..41bbeaaf81 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,7 +1,7 @@ package protocol; import "stats_messages.proto"; -import "header.proto" +import "header.proto"; message progran_message { oneof msg { From 0dee574c578091efe8fc02c62b203cb910497eea Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 17 Dec 2015 11:37:18 +0200 Subject: [PATCH 007/182] Changed prp_stats_reply message to support multiple UE and cell reports --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 41bbeaaf81..e631762946 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -51,8 +51,8 @@ message prp_stats_request { message prp_stats_reply { optional prp_header header = 1; - optional prp_ue_stats_report ue_report = 2; - optional prp_cell_stats_report cell_report = 3; + repeated prp_ue_stats_report ue_report = 2; + repeated prp_cell_stats_report cell_report = 3; } From 17251ddaacb491793c3b1b2bbf42fb741a0f0e22 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Mon, 21 Dec 2015 03:36:37 +0100 Subject: [PATCH 008/182] Very basic version of the enb agent --- cmake_targets/CMakeLists.txt | 24 +- .../oaisim_noS1_build_oai/CMakeLists.template | 2 +- openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 31 +- openair2/ENB_APP/enb_agent.c | 202 +++++++ openair2/ENB_APP/enb_agent.h | 47 ++ openair2/ENB_APP/enb_agent_common.c | 246 ++++++++ openair2/ENB_APP/enb_agent_common.h | 88 +++ openair2/ENB_APP/enb_agent_handler.c | 133 +++++ openair2/ENB_APP/enb_agent_mac.c | 552 ++++++++++++++++++ openair2/ENB_APP/enb_agent_mac.h | 77 +++ openair2/ENB_APP/enb_app.c | 9 + targets/SIMU/USER/oaisim.c | 9 + 13 files changed, 1414 insertions(+), 9 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent.c create mode 100644 openair2/ENB_APP/enb_agent.h create mode 100644 openair2/ENB_APP/enb_agent_common.c create mode 100644 openair2/ENB_APP/enb_agent_common.h create mode 100644 openair2/ENB_APP/enb_agent_handler.c create mode 100644 openair2/ENB_APP/enb_agent_mac.c create mode 100644 openair2/ENB_APP/enb_agent_mac.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 197b94699c..6fa30b2b35 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -477,7 +477,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller") +add_boolean_option(ENB_AGENT_SB_IF True "enable eNB agent to inteface with a SDN contrller") ######################## # Include order @@ -693,7 +693,7 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ -if (ENB_AGENT) +if (ENB_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) @@ -730,7 +730,8 @@ if (ENB_AGENT) ${PRPT_source} ) set(PRPT_MSG_LIB PRPT_MSG) - include_directories ("${PRPT_C_DIR}") + #message("prpt c dir is : ${PRPT_C_DIR}") + include_directories (${PRPT_C_DIR}) add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c @@ -740,6 +741,18 @@ if (ENB_AGENT) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(ENB_AGENT + ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent.c + ) + set(ENB_AGENT_LIB ENB_AGENT) + #include_directories(${OPENAIR2_DIR}/ENB_APP) + + set(PROTOBUF_LIB "protobuf-c") + + #set(PROTOBUF_LIB "protobuf") #for Cpp endif() @@ -1647,15 +1660,16 @@ 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} ${PRPT_MSG_LIB} ${ASYNC_IF_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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -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} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) +#message("protobuflib is ${PROTOBUF_LIB}") # Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator ##################################### diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index a905510150..7bdf252352 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -48,7 +48,7 @@ set ( NEW_FFT True ) set ( NO_RRM True ) set ( OAI_EMU True ) set ( OAISIM True ) -set ( OAI_NW_DRIVER_TYPE_ETHERNET True ) +set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) set ( OAI_NW_DRIVER_USE_NETLINK True ) set ( OPENAIR1 True ) set ( OPENAIR2 True ) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index f25613d86d..b2319c8220 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -3,7 +3,7 @@ package protocol; message prp_header { optional uint32 version = 1; optional uint32 type = 2; - optional uint32 xid = 3; + optional uint32 xid = 4; } enum prp_type { @@ -16,3 +16,4 @@ enum prp_type { PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; } + diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index e631762946..363592d6e3 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,10 +1,12 @@ +//'syntax = "proto2";' package protocol; import "stats_messages.proto"; import "header.proto"; message progran_message { - oneof msg { + required progran_direction msg_dir = 100; + oneof msg { prp_hello hello_msg = 1; prp_echo_request echo_request_msg = 2; prp_echo_reply echo_reply_msg = 3; @@ -13,6 +15,32 @@ message progran_message { } } +enum progran_direction { + //option allow_alias = true; + NOT_SET = 0; + INITIATING_MESSAGE = 1; + SUCCESSFUL_OUTCOME=2; + UNSUCCESSFUL_OUTCOME=3; +} + +enum progran_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 @@ -34,7 +62,6 @@ message prp_echo_reply { } - // // Statistics request and reply message // diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c new file mode 100644 index 0000000000..c9a00ae9ce --- /dev/null +++ b/openair2/ENB_APP/enb_agent.c @@ -0,0 +1,202 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include +#include +#include +#include +#include + +#include "enb_agent_common.h" +#include "link_manager.h" +#include "log.h" +#include "enb_agent.h" + +typedef uint8_t xid_t; + +// tx and rx shared context +typedef struct { + message_queue_t *tx_mq; + message_queue_t *rx_mq; + xid_t tx_xid; + xid_t rx_xid; +} msg_context_t; +msg_context_t shared_ctxt; + +void *send_thread(void *arg); +void *receive_thread(void *arg); +pthread_t new_thread(void *(*f)(void *), void *b); + +void *send_thread(void *arg) { + + msg_context_t *d = arg; + void *data; + int size; + int priority; + + + while (1) { + // need logic for the timer, and + usleep(10); + if (message_put(d->tx_mq, data, size, priority)) goto error; + } + + return NULL; + +error: + printf("receive_thread: there was an error\n"); + return NULL; +} + +void *receive_thread(void *arg) { + + msg_context_t *d = arg; + void *data; + int size; + int priority; + err_code_t err_code; + + Protocol__ProgranMessage *msg; + + while (1) { + if (message_get(d->rx_mq, &data, &size, &priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + goto error; + } + LOG_D(ENB_APP,"received message with size %d\n", size); + + + msg=enb_agent_handle_message(d->rx_xid, data, size); + + free(data); + + d->rx_xid = ((d->rx_xid)+1)%4; + d->tx_xid = d->rx_xid; + + // check if there is something to send back to the controller + if (msg != NULL){ + data=enb_agent_send_message(d->tx_xid,msg,&size); + + if (message_put(d->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_APP,"sent message with size %d\n", size); + } + + } + + return NULL; + +error: + printf("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; +} + +int enb_agent_start(){ + + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + + LOG_I(ENB_APP,"starting enb agent 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; + + + memset(&shared_ctxt, 0, sizeof(msg_context_t)); + + shared_ctxt.tx_mq = send_queue; + shared_ctxt.rx_mq = receive_queue; + + new_thread(receive_thread, &shared_ctxt); + + // new_thread(send_thread, &shared_ctxt); + + // while (1) pause(); + + printf("client ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; + +} + + + +int enb_agent_stop(){ + + +} diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h new file mode 100644 index 0000000000..89d1d9e0c2 --- /dev/null +++ b/openair2/ENB_APP/enb_agent.h @@ -0,0 +1,47 @@ + +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_H_ +#define ENB_AGENT_H_ + + +int enb_agent_start(); + +int enb_agent_stop(); + + +#endif diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c new file mode 100644 index 0000000000..d71a5a6acc --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common.c @@ -0,0 +1,246 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include "enb_agent_common.h" +#include "log.h" + + +int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { + + *size = protocol__progran_message__get_packed_size(msg); + + *buf = malloc(*size); + if (buf == NULL) + goto error; + + protocol__progran_message__pack(msg, *buf); + + return 0; + + error: + LOG_E(ENB_APP, "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 enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg) { + *msg = protocol__progran_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 prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { + + *header = malloc(sizeof(Protocol__PrpHeader)); + if(*header == NULL) + goto error; + + protocol__prp_header__init(*header); + (*header)->version = PROGRAN_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 enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { + + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) + goto error; + + Protocol__PrpHello *hello_msg; + hello_msg = malloc(sizeof(Protocol__PrpHello)); + if(hello_msg == NULL) + goto error; + protocol__prp_hello__init(hello_msg); + hello_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*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 enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { + + if(msg->msg_case != PROTOCOL__PROGRAN_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; +} + + +int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) + goto error; + + Protocol__PrpEchoRequest *echo_request_msg; + echo_request_msg = malloc(sizeof(Protocol__PrpEchoRequest)); + if(echo_request_msg == NULL) + goto error; + protocol__prp_echo_request__init(echo_request_msg); + echo_request_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->echo_request_msg = echo_request_msg; + return 0; + + error: + if(header != NULL) + free(header); + if(echo_request_msg != NULL) + free(echo_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_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 enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) + goto error; + + Protocol__PrpEchoReply *echo_reply_msg; + echo_reply_msg = malloc(sizeof(Protocol__PrpEchoReply)); + if(echo_reply_msg == NULL) + goto error; + protocol__prp_echo_reply__init(echo_reply_msg); + echo_reply_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->echo_reply_msg = echo_reply_msg; + return 0; + + error: + 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; +} + + +int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_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/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h new file mode 100644 index 0000000000..3fb0d366ac --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common.h @@ -0,0 +1,88 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + + +#ifndef ENB_AGENT_COMMON_H_ +#define ENB_AGENT_COMMON_H_ + + +#include "header.pb-c.h" +#include "progran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + +#define PROGRAN_VERSION 0 + +typedef int (*enb_agent_message_decoded_callback)( + uint32_t xid, + Protocol__ProgranMessage **msg +); + +typedef int32_t err_code_t; + +int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); +int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); + +int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); + +int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); + +int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); + +int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); + + +Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, + uint8_t *data, + uint32_t size); + +void * enb_agent_send_message(uint32_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size); + + +#endif + + + + + + + diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c new file mode 100644 index 0000000000..2b9509f48e --- /dev/null +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -0,0 +1,133 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include "enb_agent_common.h" +#include "enb_agent_mac.h" +#include "log.h" + +#include "assertions.h" + +enb_agent_message_decoded_callback messages_callback[][3] = { + {enb_agent_hello, enb_agent_hello,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_request, enb_agent_echo_reply,0}, /**/ + {0, enb_agent_mac_reply,0}, /*stats*/ + {0,0,0}, + +}; + +static const char *enb_agent_direction2String[] = { + "", /* not_set */ + "originating message", /* originating message */ + "successfull outcome", /* successfull outcome */ + "unsuccessfull outcome", /* unsuccessfull outcome */ +}; + + +Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, + uint8_t *data, + uint32_t size){ + + Protocol__ProgranMessage *message; + err_code_t err_code; + DevAssert(data != NULL); + + if (enb_agent_deserialize_message(data, size, &message) < 0) { + err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; + goto error; + } + + if ((message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + (message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; + goto error; + } + + if (messages_callback[message->msg_case][message->msg_dir] == NULL) { + err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; + goto error; + + } + + err_code= ((*messages_callback[message->msg_case-1][message->msg_dir-1])(xid, &message)); + if ( err_code < 0 ){ + goto error; + } + + return message; + +error: + LOG_E(ENB_APP,"errno %d occured\n",err_code); + return err_code; + +} + + + +void * enb_agent_send_message(uint32_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size){ + + void * buffer; + err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; + + if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENCODING; + goto error; + } + + // free the msg --> later keep this in the data struct and just update the values + enb_agent_mac_destroy_stats_reply(msg); + + DevAssert(buffer !=NULL); + + LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", size); + + return buffer; + +error : +LOG_E(ENB_APP,"errno %d occured\n",err_code); +return NULL; + +} + + + + + + + + diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c new file mode 100644 index 0000000000..0399d53d18 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -0,0 +1,552 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_mac.h" +#include "enb_agent_common.h" +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" +#include "log.h" + +int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg){ + + void *buffer; + int size; + err_code_t err_code; + // test code + + + // Create and serialize a stats reply message. This would be done by one of the agents + // Let's assume that we want the power headroom, the pending CEs for UEs 1 & 2 and their + // DL CQI reports as well as the noise and interference for cell 1 + report_config_t report_config; + + // We set the flags indicating what kind of stats we need for each UE. Both UEs will have + // the same flags in this example + uint32_t ue_flags = 0; + // Set the power headroom flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH; + // Set the pending CEs flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS; + // Set the DL CQI report flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + + // We do the same with the Cell flags + uint32_t c_flags = 0; + // Set the noise and interference flag + c_flags |= PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + + // We create the appropriate configurations + ue_report_type_t ue_configs[2]; + cc_report_type_t cell_configs[1]; + + // Create the config for UE with RNTI 1 + ue_report_type_t ue1_config; + ue1_config.ue_rnti = 1; + ue1_config.ue_report_flags = ue_flags; + + // Do the same for UE with RNTI 2 + ue_report_type_t ue2_config; + ue2_config.ue_rnti = 2; + ue2_config.ue_report_flags = ue_flags; + + // Add them to the UE list + ue_configs[0] = ue1_config; + ue_configs[1] = ue2_config; + + // Do the same for cell with id 1 + cc_report_type_t c1_config; + c1_config.cc_id = 1; + c1_config.cc_report_flags = c_flags; + + // Add them to the cell list + cell_configs[0] = c1_config; + + //Create the full report configuration + report_config.nr_ue = 2; + report_config.nr_cc = 1; + report_config.ue_report_type = ue_configs; + report_config.cc_report_type = cell_configs; + + if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; + goto error; + } + + return 0; + + error : + LOG_E(ENB_APP, "errno %d occured\n", err_code); + return err_code; +} + +int enb_agent_mac_stats_reply(uint32_t xid, + const report_config_t *report_config, + Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i, j, k; + int cc_id = 0; + int enb_id = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + UE_list_t *eNB_UE_list= &eNB->UE_list; + + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) + goto error; + + Protocol__PrpStatsReply *stats_reply_msg; + stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + if (stats_reply_msg == NULL) + goto error; + protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg->header = header; + + stats_reply_msg->n_ue_report = report_config->nr_ue; + stats_reply_msg->n_cell_report = report_config->nr_cc; + + Protocol__PrpUeStatsReport **ue_report; + Protocol__PrpCellStatsReport **cell_report; + + + /* Allocate memory for list of UE reports */ + if (report_config->nr_ue > 0) { + ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); + if (ue_report == NULL) + goto error; + for (i = 0; i < report_config->nr_ue; i++) { + ue_report[i] = malloc(sizeof(Protocol__PrpUeStatsReport)); + protocol__prp_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; + /* Check the types of reports that need to be constructed based on flag values */ + + /* Check flag for creation of buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + //TODO: Create a report for each LCG (4 elements). See prp_ue_stats_report of + // progRAN specifications for more details + ue_report[i]->n_bsr = 4; + uint32_t *elem; + elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); + if (elem == NULL) + goto error; + for (j = 0; j++; j < ue_report[i]->n_bsr) { + // Set the actual BSR for LCG j of the current UE + // NN: we need to know the cc_id here, consider the first one + elem[j] = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + } + ue_report[i]->bsr = elem; + } + + /* Check flag for creation of PRH report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + // TODO: Fill in the actual power headroom value for the RNTI + ue_report[i]->phr = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + ue_report[i]->has_phr = 1; + } + + /* Check flag for creation of RLC buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + // TODO: Fill in the actual RLC buffer status reports + ue_report[i]->n_rlc_report = 1; // Set this to the number of LCs for this UE + Protocol__PrpRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * ue_report[i]->n_rlc_report); + if (rlc_reports == NULL) + goto error; + + // Fill the buffer status report for each logical channel of the UE + // NN: see LAYER2/openair2_proc.c for rlc status + for (j = 0; j < ue_report[i]->n_rlc_report; j++) { + rlc_reports[j] = malloc(sizeof(Protocol__PrpRlcBsr)); + if (rlc_reports[j] == NULL) + goto error; + protocol__prp_rlc_bsr__init(rlc_reports[j]); + //TODO:Set logical channel id + rlc_reports[j]->lc_id = 1; + rlc_reports[j]->has_lc_id = 1; + //TODO:Set tx queue size in bytes + rlc_reports[j]->tx_queue_size = 10; + rlc_reports[j]->has_tx_queue_size = 1; + //TODO:Set tx queue head of line delay in ms + rlc_reports[j]->tx_queue_hol_delay = 100; + rlc_reports[j]->has_tx_queue_hol_delay = 1; + //TODO:Set retransmission queue size in bytes + rlc_reports[j]->retransmission_queue_size = 10; + rlc_reports[j]->has_retransmission_queue_size = 1; + //TODO:Set retransmission queue head of line delay in ms + rlc_reports[j]->retransmission_queue_hol_delay = 100; + rlc_reports[j]->has_retransmission_queue_hol_delay = 1; + //TODO:Set current size of the pending message in bytes + rlc_reports[j]->status_pdu_size = 100; + rlc_reports[j]->has_status_pdu_size = 1; + } + // Add RLC buffer status reports to the full report + if (ue_report[i]->n_rlc_report > 0) + ue_report[i]->rlc_report = rlc_reports; + } + + /* Check flag for creation of MAC CE buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + // TODO: Fill in the actual MAC CE buffer status report + ue_report[i]->pending_mac_ces = -1; /* Use as bitmap. Set one or more of the + PROTOCOL__PRP_CE_TYPE__PRPCET_ values + found in stats_common.pb-c.h. See + prp_ce_type in progRAN specification */ + ue_report[i]->has_pending_mac_ces = 1; + } + + /* Check flag for creation of DL CQI report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + // TODO: Fill in the actual DL CQI report for the UE based on its configuration + Protocol__PrpDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + if (dl_report == NULL) + goto error; + protocol__prp_dl_cqi_report__init(dl_report); + //TODO:Set the SFN and SF of the last report held in the agent. + dl_report->sfn_sn = eNB->frame*10 + eNB->subframe; + dl_report->has_sfn_sn = 1; + //TODO:Set the number of DL CQI reports for this UE. One for each CC + dl_report->n_csi_report = 1; + //TODO:Create the actual CSI reports. + Protocol__PrpDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + if (csi_reports == NULL) + goto error; + for (j = 0; j < dl_report->n_csi_report; j++) { + csi_reports[j] = malloc(sizeof(Protocol__PrpDlCsi)); + if (csi_reports[j] == NULL) + goto error; + protocol__prp_dl_csi__init(csi_reports[j]); + //TODO: the servCellIndex for this report + csi_reports[j]->serv_cell_index = 0; + csi_reports[j]->has_serv_cell_index = 1; + //TODO: the rank indicator value for this cc + csi_reports[j]->ri = 1; + csi_reports[j]->has_ri = 1; + //TODO: the type of CSI report based on the configuration of the UE + //For this example we use type P10, which only needs a wideband value + //The full set of types can be found in stats_common.pb-c.h and + //in the progRAN specifications + csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + csi_reports[j]->has_type = 1; + csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; + Protocol__PrpCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + if (csi10 == NULL) + goto error; + protocol__prp_csi_p10__init(csi10); + //TODO: set the wideband value + // NN: this is also depends on cc_id + csi10->wb_cqi = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->has_wb_cqi = 1; + //Add the type of measurements to the csi report in the proper union type + csi_reports[j]->p10csi = csi10; + } + //Add the csi reports to the full DL CQI report + dl_report->csi_report = csi_reports; + //Add the DL CQI report to the stats report + ue_report[i]->dl_cqi_report = dl_report; + } + + /* Check flag for creation of paging buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI + //set in the report must be a P-RNTI + Protocol__PrpPagingBufferReport *paging_report; + paging_report = malloc(sizeof(Protocol__PrpPagingBufferReport)); + if (paging_report == NULL) + goto error; + protocol__prp_paging_buffer_report__init(paging_report); + //Set the number of pending paging messages + paging_report->n_paging_info = 1; + //Provide a report for each pending paging message + Protocol__PrpPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + if (p_info == NULL) + goto error; + for (j = 0; j < paging_report->n_paging_info; j++) { + p_info[j] = malloc(sizeof(Protocol__PrpPagingInfo)); + if(p_info[j] == NULL) + goto error; + protocol__prp_paging_info__init(p_info[j]); + //TODO: Set paging index. This index is the same that will be used for the scheduling of the + //paging message by the controller + p_info[j]->paging_index = 10; + p_info[j]->has_paging_index = 1; + //TODO:Set the paging message size + p_info[j]->paging_message_size = 100; + p_info[j]->has_paging_message_size = 1; + //TODO: Set the paging subframe + p_info[j]->paging_subframe = 10; + p_info[j]->has_paging_subframe = 1; + //TODO: Set the carrier index for the pending paging message + p_info[j]->carrier_index = 0; + p_info[j]->has_carrier_index = 1; + } + //Add all paging info to the paging buffer rerport + paging_report->paging_info = p_info; + //Add the paging report to the UE report + ue_report[i]->pbr = paging_report; + } + + /* Check flag for creation of UL CQI report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + //Fill in the full UL CQI report of the UE + Protocol__PrpUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + if(full_ul_report == NULL) + goto error; + protocol__prp_ul_cqi_report__init(full_ul_report); + //TODO:Set the SFN and SF of the generated report + full_ul_report->sfn_sn = 100; + full_ul_report->has_sfn_sn = 1; + //TODO:Set the number of UL measurement reports based on the types of measurements + //configured for this UE and on the servCellIndex + full_ul_report->n_cqi_meas = 1; + Protocol__PrpUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + if(ul_report == NULL) + goto error; + //Fill each UL report of the UE for each of the configured report types + for(j = 0; j++; j < full_ul_report->n_cqi_meas) { + ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); + if(ul_report[j] == NULL) + goto error; + protocol__prp_ul_cqi__init(ul_report[j]); + //TODO: Set the type of the UL report. As an example set it to SRS UL report + // See enum prp_ul_cqi_type in progRAN specification for more details + ul_report[j]->type = PROTOCOL__PRP_UL_CQI_TYPE__PRUCT_SRS; + ul_report[j]->has_type = 1; + //TODO:Set the number of SINR measurements based on the report type + //See struct prp_ul_cqi in progRAN specification for more details + ul_report[j]->n_sinr = 100; + uint32_t *sinr_meas; + sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); + if (sinr_meas == NULL) + goto error; + //TODO:Set the SINR measurements for the specified type + for (k = 0; k < ul_report[j]->n_sinr; k++) { + sinr_meas[k] = 10; + } + ul_report[j]->sinr = sinr_meas; + //TODO: Set the servCellIndex for this report + ul_report[j]->serv_cell_index = 0; + ul_report[j]->has_serv_cell_index = 1; + //Set the list of UL reports of this UE to the full UL report + full_ul_report->cqi_meas = ul_report; + //Add full UL CQI report to the UE report + ue_report[i]->ul_cqi_report = full_ul_report; + } + } + } + /* Add list of all UE reports to the message */ + stats_reply_msg->ue_report = ue_report; + } + + /* Allocate memory for list of cell reports */ + if (report_config->nr_cc > 0) { + cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *) * report_config->nr_cc); + if (cell_report == NULL) + goto error; + // Fill in the Cell reports + for (i = 0; i < report_config->nr_cc; i++) { + cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); + if(ue_report[i] == NULL) + goto error; + protocol__prp_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; + + /* Check flag for creation of noise and interference report */ + if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + // TODO: Fill in the actual noise and interference report for this cell + Protocol__PrpNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + if(ni_report == NULL) + goto error; + protocol__prp_noise_interference_report__init(ni_report); + // Current frame and subframe number + ni_report->sfn_sf = 0; + ni_report->has_sfn_sf = 1; + // Received interference power in dbm + ni_report->rip = 0; + ni_report->has_rip = 1; + // Thermal noise power in dbm + ni_report->tnp = 0; + ni_report->has_tnp = 1; + cell_report[i]->noise_inter_report = ni_report; + } + } + /* Add list of all cell reports to the message */ + stats_reply_msg->cell_report = cell_report; + } + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->stats_reply_msg = stats_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (stats_reply_msg != NULL) + free(stats_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { + //TODO: Need to deallocate memory for the stats reply message + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG) + goto error; + free(msg->stats_reply_msg->header); + int i, j, k; + + Protocol__PrpStatsReply *reply = msg->stats_reply_msg; + Protocol__PrpDlCqiReport *dl_report; + Protocol__PrpUlCqiReport *ul_report; + Protocol__PrpPagingBufferReport *paging_report; + + // Free the memory for the UE reports + for (i = 0; i < reply->n_ue_report; i++) { + free(reply->ue_report[i]->bsr); + for (j = 0; j < reply->ue_report[i]->n_rlc_report; j++) { + free(reply->ue_report[i]->rlc_report[j]); + } + free(reply->ue_report[i]->rlc_report); + // If DL CQI report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + dl_report = reply->ue_report[i]->dl_cqi_report; + // Delete all CSI reports + for (j = 0; j < dl_report->n_csi_report; j++) { + //Must free memory based on the type of report + switch(dl_report->csi_report[j]->report_case) { + case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + free(dl_report->csi_report[j]->p10csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + free(dl_report->csi_report[j]->p11csi->wb_cqi); + free(dl_report->csi_report[j]->p11csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + free(dl_report->csi_report[j]->p20csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + free(dl_report->csi_report[j]->p21csi->wb_cqi); + free(dl_report->csi_report[j]->p21csi->sb_cqi); + free(dl_report->csi_report[j]->p21csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + free(dl_report->csi_report[j]->a12csi->wb_cqi); + free(dl_report->csi_report[j]->a12csi->sb_pmi); + free(dl_report->csi_report[j]->a12csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + free(dl_report->csi_report[j]->a22csi->wb_cqi); + free(dl_report->csi_report[j]->a22csi->sb_cqi); + free(dl_report->csi_report[j]->a22csi->sb_list); + free(dl_report->csi_report[j]->a22csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + free(dl_report->csi_report[j]->a20csi->sb_list); + free(dl_report->csi_report[j]->a20csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + free(dl_report->csi_report[j]->a30csi->sb_cqi); + free(dl_report->csi_report[j]->a30csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + free(dl_report->csi_report[j]->a31csi->wb_cqi); + for (k = 0; k < dl_report->csi_report[j]->a31csi->n_sb_cqi; k++) { + free(dl_report->csi_report[j]->a31csi->sb_cqi[k]); + } + free(dl_report->csi_report[j]->a31csi->sb_cqi); + break; + } + + free(dl_report->csi_report[j]); + } + free(dl_report->csi_report); + free(dl_report); + } + // If Paging buffer report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + paging_report = reply->ue_report[i]->pbr; + // Delete all paging buffer reports + for (j = 0; j < paging_report->n_paging_info; j++) { + free(paging_report->paging_info[j]); + } + free(paging_report->paging_info); + free(paging_report); + } + // If UL CQI report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + ul_report = reply->ue_report[i]->ul_cqi_report; + for (j = 0; j < ul_report->n_cqi_meas; j++) { + free(ul_report->cqi_meas[j]->sinr); + free(ul_report->cqi_meas[j]); + } + free(ul_report->cqi_meas); + } + 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]); + } + free(reply->cell_report); + + free(reply); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h new file mode 100644 index 0000000000..6d36bbb6a1 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -0,0 +1,77 @@ +/******************************************************************************* + 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 . + + 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 + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_MAC_H_ +#define ENB_AGENT_MAC_H_ + +#include "header.pb-c.h" +#include "progran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + + +/* These types will be used to give + instructions for the type of stats reports + we need to create */ +typedef struct { + uint16_t ue_rnti; + uint32_t ue_report_flags; /* Indicates the report elements + required for this UE id. See + ProgRAN specification 1.2.4.2 */ +} ue_report_type_t; + +typedef struct { + uint16_t cc_id; + uint32_t cc_report_flags; /* Indicates the report elements + required for this CC index. See + ProgRAN specification 1.2.4.3 */ +} cc_report_type_t; + +typedef struct { + int nr_ue; + ue_report_type_t *ue_report_type; + int nr_cc; + cc_report_type_t *cc_report_type; +} report_config_t; + + +int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg); + +int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); + +#endif diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 70fb5ad61f..d63d895711 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -57,6 +57,10 @@ # include "gtpv1u_eNB_task.h" # endif +#if defined(ENB_AGENT_SB_IF) +# include "enb_agent.h" +#endif + extern unsigned char NB_eNB_INST; #endif @@ -310,6 +314,11 @@ void *eNB_app_task(void *args_p) configure_rrc(enb_id, enb_properties_p); } +#if defined (ENB_AGENT_SB_IF) + printf("\n start enb agent\n"); + enb_agent_start(); +#endif + # if defined(ENABLE_USE_MME) /* Try to register each eNB */ registered_enb = 0; diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index c1d4d64ef6..7d31f476ef 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -90,6 +90,11 @@ uint8_t config_smbv = 0; char smbv_ip[16]; #endif +#if defined(ENB_AGENT_SB_IF) +# include "enb_agent.h" +#endif + + #include "oaisim_functions.h" #include "oaisim.h" @@ -1332,6 +1337,10 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms); #endif +#if defined (ENB_AGENT_SB_IF) + enb_agent_start(); +#endif + // add events to future event list: Currently not used //oai_emulation.info.oeh_enabled = 1; if (oai_emulation.info.oeh_enabled == 1) From 915af964f42bf38f9ad0b189148bffcc932ee363 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:04:18 +0200 Subject: [PATCH 009/182] Fixed top-level message field msg_dir to be optional --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 363592d6e3..4f989361a9 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -5,7 +5,7 @@ import "stats_messages.proto"; import "header.proto"; message progran_message { - required progran_direction msg_dir = 100; + optional progran_direction msg_dir = 100; oneof msg { prp_hello hello_msg = 1; prp_echo_request echo_request_msg = 2; From d5830ced240aa9599f7278e53f034af22cb566e5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:06:37 +0200 Subject: [PATCH 010/182] Allow only a single instance of the eNB agent --- targets/SIMU/USER/oaisim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 7d31f476ef..f54742fb8d 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -1337,9 +1337,9 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms); #endif -#if defined (ENB_AGENT_SB_IF) + /* #if defined (ENB_AGENT_SB_IF) enb_agent_start(); -#endif + #endif */ // add events to future event list: Currently not used //oai_emulation.info.oeh_enabled = 1; From 4f618d617077cb5acc651193676f583bd0d4e063 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:08:16 +0200 Subject: [PATCH 011/182] Fixed some bugs that would lead to segfaults and modified to support changes in protocol --- openair2/ENB_APP/enb_agent_common.c | 4 +++- openair2/ENB_APP/enb_agent_handler.c | 30 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index d71a5a6acc..132044cf1f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -64,7 +64,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage *msg = protocol__progran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; - + return 0; error: @@ -118,6 +118,7 @@ int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; @@ -216,6 +217,7 @@ int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; (*msg)->echo_reply_msg = echo_reply_msg; return 0; diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2b9509f48e..2457ddbfdc 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -42,10 +42,11 @@ #include "assertions.h" enb_agent_message_decoded_callback messages_callback[][3] = { - {enb_agent_hello, enb_agent_hello,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_request, enb_agent_echo_reply,0}, /**/ - {0, enb_agent_mac_reply,0}, /*stats*/ - {0,0,0}, + {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply + {enb_agent_mac_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ }; @@ -61,33 +62,35 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, uint8_t *data, uint32_t size){ - Protocol__ProgranMessage *message; + Protocol__ProgranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); - if (enb_agent_deserialize_message(data, size, &message) < 0) { + if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; goto error; } - if ((message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || - (message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + if ((decoded_message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; goto error; } - if (messages_callback[message->msg_case][message->msg_dir] == NULL) { + if (messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; goto error; } - err_code= ((*messages_callback[message->msg_case-1][message->msg_dir-1])(xid, &message)); + err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, &reply_message)); if ( err_code < 0 ){ goto error; } - return message; + protocol__progran_message__free_unpacked(decoded_message, NULL); + + return reply_message; error: LOG_E(ENB_APP,"errno %d occured\n",err_code); @@ -110,11 +113,12 @@ void * enb_agent_send_message(uint32_t xid, } // free the msg --> later keep this in the data struct and just update the values - enb_agent_mac_destroy_stats_reply(msg); + //TODO call proper destroy function + // enb_agent_mac_destroy_stats_reply(msg); DevAssert(buffer !=NULL); - LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", size); + LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", *size); return buffer; From 7241aa6a385d8cae566bbdde99cdd5da1e2c18b1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 23 Dec 2015 12:17:52 +0200 Subject: [PATCH 012/182] Added support for parameters in handlers --- openair2/ENB_APP/enb_agent_common.c | 6 +++--- openair2/ENB_APP/enb_agent_common.h | 7 ++++--- openair2/ENB_APP/enb_agent_handler.c | 2 +- openair2/ENB_APP/enb_agent_mac.c | 2 +- openair2/ENB_APP/enb_agent_mac.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 132044cf1f..a8ac24144b 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -98,7 +98,7 @@ int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader } -int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) @@ -150,7 +150,7 @@ int enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(uint32_t xid, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -199,7 +199,7 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 3fb0d366ac..5aac604c1e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -49,6 +49,7 @@ typedef int (*enb_agent_message_decoded_callback)( uint32_t xid, + const void *params, Protocol__ProgranMessage **msg ); @@ -59,13 +60,13 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2457ddbfdc..dd39a7315a 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -83,7 +83,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, } - err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, &reply_message)); + err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0399d53d18..4b299ca919 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,7 +40,7 @@ #include "LAYER2/RLC/rlc.h" #include "log.h" -int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg){ +int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ void *buffer; int size; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 6d36bbb6a1..590570630e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -68,7 +68,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From 0bea0aafc44c5fdb413229e4625906d8e00afcdb Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 23 Dec 2015 15:29:28 +0200 Subject: [PATCH 013/182] Restructured statistics handler to consider the request message parameters --- openair2/ENB_APP/enb_agent_handler.c | 2 +- openair2/ENB_APP/enb_agent_mac.c | 148 ++++++++++++++++++--------- openair2/ENB_APP/enb_agent_mac.h | 2 +- 3 files changed, 104 insertions(+), 48 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index dd39a7315a..9a37d01fc1 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -45,7 +45,7 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4b299ca919..e1c465105a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,71 +40,127 @@ #include "LAYER2/RLC/rlc.h" #include "log.h" -int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ + // TODO: Must deal with sanitization of input + // TODO: Must check if RNTIs and cell ids of the request actually exist + + int i; void *buffer; int size; err_code_t err_code; - // test code + + //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 + int cc_id = 0; + int enb_id = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + UE_list_t *eNB_UE_list= &eNB->UE_list; - // Create and serialize a stats reply message. This would be done by one of the agents - // Let's assume that we want the power headroom, the pending CEs for UEs 1 & 2 and their - // DL CQI reports as well as the noise and interference for cell 1 report_config_t report_config; - // We set the flags indicating what kind of stats we need for each UE. Both UEs will have - // the same flags in this example uint32_t ue_flags = 0; - // Set the power headroom flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH; - // Set the pending CEs flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS; - // Set the DL CQI report flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; - - // We do the same with the Cell flags uint32_t c_flags = 0; - // Set the noise and interference flag - c_flags |= PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - // We create the appropriate configurations - ue_report_type_t ue_configs[2]; - cc_report_type_t cell_configs[1]; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - // Create the config for UE with RNTI 1 - ue_report_type_t ue1_config; - ue1_config.ue_rnti = 1; - ue1_config.ue_report_flags = ue_flags; + Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; - // Do the same for UE with RNTI 2 - ue_report_type_t ue2_config; - ue2_config.ue_rnti = 2; - ue2_config.ue_report_flags = ue_flags; - - // Add them to the UE list - ue_configs[0] = ue1_config; - ue_configs[1] = ue2_config; - - // Do the same for cell with id 1 - cc_report_type_t c1_config; - c1_config.cc_id = 1; - c1_config.cc_report_flags = c_flags; - - // Add them to the cell list - cell_configs[0] = c1_config; - - //Create the full report configuration - report_config.nr_ue = 2; - report_config.nr_cc = 1; - report_config.ue_report_type = ue_configs; - report_config.cc_report_type = cell_configs; + // Check the type of request that is made + switch(stats_req->body_case) { + case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; + Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { + //TODO: Must create a periodic report. Implement once the + // timer functionality is supported + return -1; + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + //TODO: Must create an event based report mechanism + return -1; + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + //TODO: Must implement to deactivate the event based reporting + } else { //One-off reporting + //Set the proper flags + ue_flags = comp_req->ue_report_flags; + c_flags = comp_req->cell_report_flags; + //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 = eNB_UE_list->num_UEs; + 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 + err_code = -100; + goto error; + } + for (i = 0; i < report_config.nr_ue; i++) { + report_config.ue_report_type[i].ue_rnti = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + 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); + 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 + report_config.cc_report_type[i].cc_id = i; + report_config.cc_report_type[i].cc_report_flags = c_flags; + } + } + break; + case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; + Protocol__PrpCellStatsRequest *cell_req = stats_req->cell_stats_request; + // UE report config will be blank + 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); + 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 + report_config.cc_report_type[i].cc_id = cell_req->cell[i]; + report_config.cc_report_type[i].cc_report_flags = cell_req->flags; + } + break; + case PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST:; + Protocol__PrpUeStatsRequest *ue_req = stats_req->ue_stats_request; + // Cell report config will be blank + 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); + 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 = ue_req->rnti[i]; + report_config.ue_report_type[i].ue_report_flags = ue_req->flags; + } + break; + default: + //TODO: Add appropriate error code + err_code = -100; + goto error; + } if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; goto error; } + free(report_config.ue_report_type); + free(report_config.cc_report_type); + return 0; error : diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 590570630e..e22253cf27 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -68,7 +68,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From b9cf840a10c6212cd75d0a422a4f1094258ac700 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 28 Dec 2015 15:25:27 +0200 Subject: [PATCH 014/182] Created callback mechanism for destruction of protocol messages sent by the agent --- openair2/ENB_APP/enb_agent_common.c | 2 +- openair2/ENB_APP/enb_agent_common.h | 4 ++++ openair2/ENB_APP/enb_agent_handler.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a8ac24144b..848c10b6fa 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -134,7 +134,7 @@ int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage * } -int enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 5aac604c1e..3bb6596f2e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -53,6 +53,10 @@ typedef int (*enb_agent_message_decoded_callback)( Protocol__ProgranMessage **msg ); +typedef int (*enb_agent_message_destruction_callback)( + Protocol__ProgranMessage *msg +); + typedef int32_t err_code_t; int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 9a37d01fc1..5049e669e9 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -50,6 +50,15 @@ enb_agent_message_decoded_callback messages_callback[][3] = { }; +enb_agent_message_destruction_callback message_destruction_callback[] = { + enb_agent_destroy_hello, + enb_agent_destroy_echo_request, + enb_agent_destroy_echo_reply, + 0, /*No stats request message is created in the agent. No need for a callback*/ + enb_agent_mac_destroy_stats_reply, + +}; + static const char *enb_agent_direction2String[] = { "", /* not_set */ "originating message", /* originating message */ @@ -114,7 +123,7 @@ void * enb_agent_send_message(uint32_t xid, // free the msg --> later keep this in the data struct and just update the values //TODO call proper destroy function - // enb_agent_mac_destroy_stats_reply(msg); + err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); DevAssert(buffer !=NULL); From e5e58ec2f47a4b0e429e39e5042aadc2cdae785e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 29 Dec 2015 15:43:42 +0200 Subject: [PATCH 015/182] Fixed mac stats handler for periodic and continuous stats updates --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index e1c465105a..3c188881fb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -73,12 +73,16 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { //TODO: Must create a periodic report. Implement once the // timer functionality is supported - return -1; + *msg = NULL; + return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism - return -1; + *msg = NULL; + return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { //TODO: Must implement to deactivate the event based reporting + *msg = NULL; + return 0; } else { //One-off reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; From e42dd369679f05bc39f66ffd61c020eb8d52de06 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Fri, 1 Jan 2016 20:05:15 +0100 Subject: [PATCH 016/182] update the itti timer --- common/utils/itti/timer.c | 6 +++++- maketags | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 40e8791022..864ab16746 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -96,6 +96,8 @@ int timer_handle_signal(siginfo_t *info) // LG: To many traces for msc timer: // TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); +#if defined(ENABLE_ITTI) + task_id = timer_p->task_id; instance = timer_p->instance; message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED); @@ -104,6 +106,7 @@ int timer_handle_signal(siginfo_t *info) timer_expired_p->timer_id = (long)timer_p->timer; timer_expired_p->arg = timer_p->timer_arg; +#endif /* Timer is a one shot timer, remove it */ if (timer_p->type == TIMER_ONE_SHOT) { @@ -120,13 +123,14 @@ int timer_handle_signal(siginfo_t *info) TMR_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); } } - +#ifdefined ENABLE_ITTI /* Notify task of timer expiry */ if (itti_send_msg_to_task(task_id, instance, message_p) < 0) { TMR_DEBUG("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); free(message_p); return -1; } +#endif return 0; } diff --git a/maketags b/maketags index ec283c8bec..53bc1c12d0 100755 --- a/maketags +++ b/maketags @@ -1,3 +1,3 @@ #!/bin/sh echo "building ctags for openair1 and openair2 ..." -ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 targets +ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets common From 1f213b0b8e24bcc7498534b965b952173a5e8e3e Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 5 Jan 2016 11:33:40 +0100 Subject: [PATCH 017/182] * add options to enb configuration file for the enb agent * add timer api for the periodic and oneshot operations * create enb agent task --- common/utils/itti/timer.c | 16 +- openair2/COMMON/tasks_def.h | 2 + openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- openair2/ENB_APP/enb_agent.c | 247 +++++++++++---- openair2/ENB_APP/enb_agent.h | 13 +- openair2/ENB_APP/enb_agent_common.c | 284 +++++++++++++++++- openair2/ENB_APP/enb_agent_common.h | 165 +++++++++- openair2/ENB_APP/enb_agent_defs.h | 142 +++++++++ openair2/ENB_APP/enb_agent_handler.c | 58 ++-- openair2/ENB_APP/enb_agent_mac.c | 45 ++- openair2/ENB_APP/enb_agent_mac.h | 12 +- openair2/ENB_APP/enb_app.c | 7 +- openair2/ENB_APP/enb_config.c | 43 +++ openair2/ENB_APP/enb_config.h | 3 + openair2/UTIL/LOG/log.c | 8 + openair2/UTIL/LOG/log.h | 1 + .../enb.band7.agent.oaisim.local_no_mme.conf | 153 ++++++++++ 17 files changed, 1059 insertions(+), 142 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_defs.h create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 864ab16746..683efd1279 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -94,9 +94,8 @@ int timer_handle_signal(siginfo_t *info) timer_p = (struct timer_elm_s *)info->si_ptr; // LG: To many traces for msc timer: - // TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - -#if defined(ENABLE_ITTI) + TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); + printf("Timer with id 0x%lx has expired\n", (long)timer_p->timer); task_id = timer_p->task_id; instance = timer_p->instance; @@ -106,7 +105,6 @@ int timer_handle_signal(siginfo_t *info) timer_expired_p->timer_id = (long)timer_p->timer; timer_expired_p->arg = timer_p->timer_arg; -#endif /* Timer is a one shot timer, remove it */ if (timer_p->type == TIMER_ONE_SHOT) { @@ -123,13 +121,16 @@ int timer_handle_signal(siginfo_t *info) TMR_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); } } -#ifdefined ENABLE_ITTI + /* Notify task of timer expiry */ if (itti_send_msg_to_task(task_id, instance, message_p) < 0) { TMR_DEBUG("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); free(message_p); return -1; } + +#if defined(ENB_AGENT_SB_IF) + #endif return 0; @@ -209,6 +210,11 @@ int timer_setup( type == TIMER_PERIODIC ? "periodic" : "single shot", *timer_id, interval_sec, interval_us); + printf("Requesting new %s timer with id 0x%lx that expires within " + "%d sec and %d usec\n", + type == TIMER_PERIODIC ? "periodic" : "single shot", + *timer_id, interval_sec, interval_us); + timer_p->timer = timer; /* Lock the queue and insert the timer at the tail */ diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 5e0f8bd211..6cd74c3aed 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -63,6 +63,8 @@ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) /// eNB APP task TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200) +/// eNB Agent task +TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200) // UE tasks and sub-tasks: //// Layer 2 and Layer 1 sub-tasks diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 4f989361a9..995cd6861b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -37,7 +37,7 @@ enum progran_err { MSG_NOT_VALIDATED = -8; MSG_OUT_DATED = -9; - + // other erros UNEXPECTED = -100; } diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c9a00ae9ce..7003a2c638 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -27,43 +27,82 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \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 -#include -#include -#include -#include - #include "enb_agent_common.h" -#include "link_manager.h" #include "log.h" #include "enb_agent.h" -typedef uint8_t xid_t; +#include "assertions.h" -// tx and rx shared context -typedef struct { - message_queue_t *tx_mq; - message_queue_t *rx_mq; - xid_t tx_xid; - xid_t rx_xid; -} msg_context_t; -msg_context_t shared_ctxt; -void *send_thread(void *arg); -void *receive_thread(void *arg); +enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; +msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; +/* this could also go into enb_agent struct*/ +enb_agent_info_t enb_agent_info; + +char in_ip[40]; +static uint16_t in_port; + +//void *send_thread(void *args); +void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); +err_code_t enb_agent_timeout(void* args); -void *send_thread(void *arg) { +/* + * 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 *enb_agent_task(void *args){ - msg_context_t *d = arg; + MessageDef *msg_p = NULL; + const char *msg_name = NULL; + instance_t instance; + int result; + + + itti_mark_task_ready(TASK_ENB_AGENT); + + do { + // Wait for a message + itti_receive_msg (TASK_ENB_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(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); + break; + + case TIMER_HAS_EXPIRED: + enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, &msg_p->ittiMsg.timer_has_expired.arg); + break; + + default: + LOG_E(ENB_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); + } while (1); + + return NULL; +} +/* +void *send_thread(void *args) { + + msg_context_t *d = args; void *data; int size; int priority; @@ -81,10 +120,10 @@ error: printf("receive_thread: there was an error\n"); return NULL; } +*/ +void *receive_thread(void *args) { -void *receive_thread(void *arg) { - - msg_context_t *d = arg; + msg_context_t *d = args; void *data; int size; int priority; @@ -97,10 +136,10 @@ void *receive_thread(void *arg) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } - LOG_D(ENB_APP,"received message with size %d\n", size); + LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->rx_xid, data, size); + msg=enb_agent_handle_message(d->mod_id, d->rx_xid, data, size); free(data); @@ -115,7 +154,7 @@ void *receive_thread(void *arg) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_APP,"sent message with size %d\n", size); + LOG_D(ENB_AGENT,"sent message with size %d\n", size); } } @@ -123,7 +162,7 @@ void *receive_thread(void *arg) { return NULL; error: - printf("receive_thread: error %d occured\n",err_code); + LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code); return NULL; } @@ -153,50 +192,146 @@ pthread_t new_thread(void *(*f)(void *), void *b) { return t; } -int enb_agent_start(){ +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; + // + set_enb_vars(mod_id, RAN_LTE_OAI); + enb_agent[mod_id].mod_id = mod_id; + enb_agent_info.nb_modules+=1; + + /* + * check the configuration + */ + if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); + in_ip[sizeof(in_ip) - 1] = 0; // terminate string + } else { + strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS ); + } + + if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->enb_agent_port; + } else { + in_port = DEFAULT_ENB_AGENT_PORT ; + } + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + enb_agent[mod_id].mod_id, + in_ip, + in_port); - LOG_I(ENB_APP,"starting enb agent 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; + //#define TEST_TIMER 0 +#if !defined TEST_TIMER + /* + * create a socket + */ + enb_agent[mod_id].link = new_link_client(in_ip, in_port); + if (enb_agent[mod_id].link == NULL) goto error; + + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + enb_agent[mod_id].mod_id, + in_ip, + in_port); + /* + * create a message queue + */ + + enb_agent[mod_id].send_queue = new_message_queue(); + if (enb_agent[mod_id].send_queue == NULL) goto error; + enb_agent[mod_id].receive_queue = new_message_queue(); + if (enb_agent[mod_id].receive_queue == NULL) goto error; + + /* + * create a link manager + */ + + enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); + if (enb_agent[mod_id].manager == NULL) goto error; memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt.tx_mq = send_queue; - shared_ctxt.rx_mq = receive_queue; + shared_ctxt[mod_id].mod_id = mod_id; + shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; + shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; - new_thread(receive_thread, &shared_ctxt); + /* + * start the enb agent rx thread + */ + new_thread(receive_thread, &shared_ctxt[mod_id]); + +#endif + + /* + * initilize a timer + */ + + enb_agent_init_timer(); + + + + /* + * start the enb agent task for tx and interaction with the underlying network function + */ + + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, NULL) < 0) { + LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + + +#ifdef TEST_TIMER + long timer_id=0; + enb_agent_timer_args_t timer_args; + memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); + timer_args.mod_id = mod_id; + timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; + timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + timer_args.ue_actions = ENB_AGENT_ACTION_SEND; + timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); +#endif + // new_thread(send_thread, &shared_ctxt); - // while (1) pause(); + //while (1) pause(); - printf("client ends\n"); + LOG_I(ENB_AGENT,"client ends\n"); return 0; error: - printf("there was an error\n"); + LOG_I(ENB_AGENT,"there was an error\n"); return 1; } -int enb_agent_stop(){ - +int enb_agent_stop(mid_t mod_id){ + + int i=0; + enb_agent_destroy_timers(); + for ( i =0; i < enb_agent_info.nb_modules; i++) { + + destroy_link_manager(enb_agent[i].manager); + + destroy_message_queue(enb_agent[i].send_queue); + destroy_message_queue(enb_agent[i].receive_queue); + + close_link(enb_agent[i].link); + } +} + + + +err_code_t enb_agent_timeout(void* args){ + + enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + + LOG_I(ENB_AGENT, "enb_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 0; } diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h index 89d1d9e0c2..1a53841d45 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/enb_agent.h @@ -28,9 +28,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent.h + * \brief top level enb agent + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -38,10 +38,13 @@ #ifndef ENB_AGENT_H_ #define ENB_AGENT_H_ +#include "enb_config.h" // for enb properties +#include "enb_agent_common.h" -int enb_agent_start(); +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); -int enb_agent_stop(); +int enb_agent_stop(mid_t mod_id); +void *enb_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 848c10b6fa..c2653f4c85 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_common.c + * \brief common primitives for all agents + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -39,6 +39,12 @@ #include "log.h" +void * enb[NUM_MAX_ENB_AGENT]; +void * enb_ue[NUM_MAX_ENB_AGENT]; +/* + * message primitives + */ + int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { *size = protocol__progran_message__get_packed_size(msg); @@ -52,7 +58,7 @@ int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int * return 0; error: - LOG_E(ENB_APP, "an error occured\n"); // change the com + LOG_E(ENB_AGENT, "an error occured\n"); // change the com return -1; } @@ -74,9 +80,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage - - -int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { +int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { *header = malloc(sizeof(Protocol__PrpHeader)); if(*header == NULL) @@ -98,7 +102,7 @@ int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader } -int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) @@ -150,7 +154,7 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(uint32_t xid, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -199,7 +203,7 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; @@ -246,3 +250,263 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } + +/* + * 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; + break; + default : + goto error; + } + + return; + + error: + LOG_E(ENB_AGENT, "unknown RAN name %d\n", ran); +} + +int get_current_time_ms (mid_t mod_id, int subframe_flag){ + + if (subframe_flag == 1){ + return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe; + }else { + return ((eNB_MAC_INST *)enb[mod_id])->frame*10; + } + +} + +int get_num_ues (mid_t mod_id){ + + return ((UE_list_t *)enb_ue[mod_id])->num_UEs; +} + +int get_ue_crnti (mid_t mod_id, mid_t ue_id){ + + return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].crnti; +} + +int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { + + return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid]; +} + +int get_ue_phr (mid_t mod_id, mid_t ue_id) { + + return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info; +} + +int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { + + return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; +} +/* + * timer primitives + */ + + +//struct enb_agent_map agent_map; + +/* The timer_id might not be the best choice for the comparison */ +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ + + //if (a->timer_id) return 0; + //if (b->timer_id) return 0; + + if (a->timer_id < b->timer_id) return -1; + if (a->timer_id > b->timer_id) return 1; + + // equal timers + return 0; +} + +RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); + +err_code_t enb_agent_init_timer(void){ + + RB_INIT(&enb_agent_head); + + /* + struct enb_agent_timer_element_s e; + memset(&e, 0, sizeof(enb_agent_timer_element_t)); + RB_INSERT(enb_agent_map, &agent_map, &e); + */ + return PROTOCOL__PROGRAN_ERR__NO_ERR; +} + +err_code_t enb_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + enb_agent_timer_callback_t cb, + void* timer_args, + long *timer_id){ + + struct enb_agent_timer_element_s e; +//uint32_t timer_id; + int ret=-1; + + if ((interval_sec == 0) && (interval_usec == 0 )) + return TIMER_NULL; + + if (timer_type >= ENB_AGENT_TIMER_TYPE_MAX) + return TIMER_TYPE_INVALIDE; + + if (timer_type == ENB_AGENT_TIMER_TYPE_ONESHOT){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_ENB_AGENT, + instance, + TIMER_ONE_SHOT, + timer_args, + timer_id); + + e.type = TIMER_ONE_SHOT; + } + else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_ENB_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 = ENB_AGENT_TIMER_STATE_ACTIVE; + e.timer_id = *timer_id; + e.timer_args = timer_args; + e.cb = cb; + + LOG_I(ENB_AGENT,"created a timer with id 0x%lx for agent %d, instance %d \n", + e.timer_id, e.agent_id, e.instance); + + RB_INSERT(enb_agent_map, &enb_agent_head, &e); + + + /* + struct enb_agent_timer_element_s search; + search.timer_id = *timer_id; + printf("search 1: %p (expected %p)\n", RB_FIND(enb_agent_map, &enb_agent_head, &search), &e); + printf("search 1: %p (expected %p)\n", get_timer_entry(e.timer_id), &e); + */ + return 0; +} + +err_code_t enb_agent_destroy_timer(long timer_id){ + + struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + + if (e != NULL ) { + RB_REMOVE(enb_agent_map, &enb_agent_head, &e); + free(e); + } + + if (timer_remove(timer_id) < 0 ) + goto error; + + return 0; + + error: + LOG_E(ENB_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + +err_code_t enb_agent_destroy_timers(void){ + + struct enb_agent_timer_element_s *e = NULL; + + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + RB_REMOVE(enb_agent_map, &enb_agent_head, e); + timer_remove(e->timer_id); + free(e); + } + + return 0; + +} + +struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { + + struct enb_agent_timer_element_s search, *e; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + return RB_FIND(enb_agent_map, &enb_agent_head, &search); +} + +/* + int i =0; + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + printf("%d: %p\n", i, e); i++; + } +*/ + +/* +err_code_t enb_agent_stop_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_STOPPED; + } + + timer_remove(timer_id); + + return 0; + +} + +// 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/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 3bb6596f2e..eb3de96145 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_common.h + * \brief common message primitves and utilities + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -45,10 +45,20 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" +# include "enb_agent_defs.h" + +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" + +# include "tree.h" +# include "intertask_interface.h" +# include "timer.h" + #define PROGRAN_VERSION 0 typedef int (*enb_agent_message_decoded_callback)( - uint32_t xid, + mid_t mod_id, + xid_t xid, const void *params, Protocol__ProgranMessage **msg ); @@ -57,32 +67,163 @@ typedef int (*enb_agent_message_destruction_callback)( Protocol__ProgranMessage *msg ); -typedef int32_t err_code_t; - int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); -int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); +int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); -Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, +Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, + xid_t xid, uint8_t *data, uint32_t size); -void * enb_agent_send_message(uint32_t xid, +void * enb_agent_send_message(xid_t xid, Protocol__ProgranMessage *msg, uint32_t * size); + + + + +/**************************** + * 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); + +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); + + + + + + +/******************* + * 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 err_code_t (*enb_agent_timer_callback_t)(void*); + +typedef enum { + /* oneshot timer: */ + ENB_AGENT_TIMER_TYPE_ONESHOT = 0x0, + + /* periodic timer */ + ENB_AGENT_TIMER_TYPE_PERIODIC = 0x1, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, + + /* Max number of states available */ + ENB_AGENT_TIMER_TYPE_MAX, +} eNB_agent_timer_type_t; + +typedef enum { + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_INACTIVE = 0x0, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_ACTIVE = 0x1, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_STOPPED = 0x2, + + /* Max number of states available */ + ENB_AGENT_TIMER_STATE_MAX, +} eNB_agent_timer_state_t; + +typedef struct enb_agent_timer_args_s{ + mid_t mod_id; + + agent_action_t cc_actions; + uint32_t cc_report_flags; + + agent_action_t ue_actions; + uint32_t ue_report_flags; + +} enb_agent_timer_args_t; + + + +typedef struct enb_agent_timer_element_s{ + RB_ENTRY(enb_agent_timer_element_s) entry; + + agent_id_t agent_id; + instance_t instance; + + eNB_agent_timer_type_t type; + eNB_agent_timer_state_t state; + + uint32_t interval_sec; + uint32_t interval_usec; + + long timer_id; /* Timer id returned by the timer API*/ + + enb_agent_timer_callback_t cb; + void* timer_args; + +} enb_agent_timer_element_t; + + +err_code_t enb_agent_init_timer(void); + +err_code_t enb_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + enb_agent_timer_callback_t cb, + void* timer_args, + long *timer_id); + +err_code_t enb_agent_destroy_timers(void); +err_code_t enb_agent_destroy_timer(long timer_id); + +err_code_t enb_agent_stop_timer(long timer_id); + +err_code_t enb_agent_restart_timer(long *timer_id); + +struct enb_agent_timer_element_s * get_timer_entry(long timer_id); + +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); + +err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); + +RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); + + #endif diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h new file mode 100644 index 0000000000..416e61a431 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -0,0 +1,142 @@ +/******************************************************************************* + 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 . + + 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 ENB_AGENT_DEFS_H_ +#define ENB_AGENT_DEFS_H_ + +#include +#include +#include +#include + +#include "link_manager.h" + +#define NUM_MAX_ENB_AGENT 2 +#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" +#define DEFAULT_ENB_AGENT_PORT 2210 + +typedef enum { + + ENB_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; + +// tx and rx shared context +typedef struct { + mid_t mod_id; + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; +}enb_agent_instance_t; + +typedef struct { + /* general info */ + uint32_t nb_modules; + + + /* stats */ + + uint32_t total_rx_msg; + uint32_t total_tx_msg; + + uint32_t rx_msg[NUM_MAX_ENB_AGENT]; + uint32_t tx_msg[NUM_MAX_ENB_AGENT]; + +}enb_agent_info_t; + +typedef struct { + mid_t mod_id; + message_queue_t *tx_mq; + message_queue_t *rx_mq; + xid_t tx_xid; + xid_t rx_xid; +} msg_context_t; + +#endif diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 5049e669e9..27536c8b7f 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_handler.c + * \brief enb agent tx and rx message handler + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -67,7 +67,8 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, +Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, + xid_t xid, uint8_t *data, uint32_t size){ @@ -92,7 +93,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, } - err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, (void *) decoded_message, &reply_message)); + err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, xid, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -102,16 +103,16 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, return reply_message; error: - LOG_E(ENB_APP,"errno %d occured\n",err_code); - return err_code; + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + return NULL; } -void * enb_agent_send_message(uint32_t xid, - Protocol__ProgranMessage *msg, - uint32_t * size){ +void * enb_agent_send_message(xid_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size){ void * buffer; err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; @@ -126,21 +127,32 @@ void * enb_agent_send_message(uint32_t xid, err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); DevAssert(buffer !=NULL); - - LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", *size); - + + LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); + return buffer; - -error : -LOG_E(ENB_APP,"errno %d occured\n",err_code); -return NULL; + + error : + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + + return NULL; } +err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ + + struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + + LOG_I(ENB_AGENT, "element %p: timer_id is 0x%lx 0x%lx\n", e, timer_id, e->timer_id); + + if (e == NULL ) goto error; + if (timer_args == NULL) + LOG_W(ENB_AGENT,"null timer args\n"); + + return e->cb(timer_args); + - - - - - - + error: + LOG_E(ENB_AGENT, "can't get the timer element\n"); + return TIMER_ELEMENT_NOT_FOUND; +} diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 3c188881fb..edf1406296 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -27,20 +27,18 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_mac.c + * \brief enb agent message handler for MAC layer + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ #include "enb_agent_mac.h" -#include "enb_agent_common.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/RLC/rlc.h" + #include "log.h" -int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -52,11 +50,11 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; - int enb_id = 0; - - eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; - UE_list_t *eNB_UE_list= &eNB->UE_list; + int enb_id = mod_id; + //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + //UE_list_t *eNB_UE_list= &eNB->UE_list; + report_config_t report_config; uint32_t ue_flags = 0; @@ -90,7 +88,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr //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 = eNB_UE_list->num_UEs; + report_config.nr_ue = get_num_ues(mod_id); //eNB_UE_list->num_UEs 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 @@ -98,7 +96,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr goto error; } for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + report_config.ue_report_type[i].ue_rnti = 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_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs @@ -157,7 +155,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr goto error; } - if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ + if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; goto error; } @@ -168,19 +166,20 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr return 0; error : - LOG_E(ENB_APP, "errno %d occured\n", err_code); + LOG_E(ENB_AGENT, "errno %d occured\n", err_code); return err_code; } -int enb_agent_mac_stats_reply(uint32_t xid, +int enb_agent_mac_stats_reply(mid_t mod_id, + xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i, j, k; int cc_id = 0; - int enb_id = 0; - eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; - UE_list_t *eNB_UE_list= &eNB->UE_list; + int enb_id = mod_id; + //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + //UE_list_t *eNB_UE_list= &eNB->UE_list; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) @@ -226,7 +225,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, for (j = 0; j++; j < ue_report[i]->n_bsr) { // Set the actual BSR for LCG j of the current UE // NN: we need to know the cc_id here, consider the first one - elem[j] = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + elem[j] = get_ue_bsr (enb_id, i, j); //eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; } ue_report[i]->bsr = elem; } @@ -234,7 +233,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI - ue_report[i]->phr = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + ue_report[i]->phr = 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; } @@ -297,7 +296,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, goto error; protocol__prp_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. - dl_report->sfn_sn = eNB->frame*10 + eNB->subframe; + dl_report->sfn_sn = get_current_time_ms(enb_id, 1); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = 1; @@ -331,7 +330,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, protocol__prp_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id - csi10->wb_cqi = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; csi10->has_wb_cqi = 1; //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index e22253cf27..6584111825 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_mac.h + * \brief enb agent message handler APIs for MAC layer + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -42,6 +42,8 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" +#include "enb_agent_common.h" + /* These types will be used to give instructions for the type of stats reports @@ -68,9 +70,9 @@ typedef struct { } report_config_t; -int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index d63d895711..b20d0912d8 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -315,8 +315,11 @@ void *eNB_app_task(void *args_p) } #if defined (ENB_AGENT_SB_IF) - printf("\n start enb agent\n"); - enb_agent_start(); + + for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + printf("\n start enb agent %d\n", enb_id); + enb_agent_start(enb_id, enb_properties_p); + } #endif # if defined(ENABLE_USE_MME) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 07e0ffa640..39bd5028d8 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -170,6 +170,11 @@ #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_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" +#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" +#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" +#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" + #define ENB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity" #define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none" @@ -275,6 +280,14 @@ static void enb_config_display(void) printf( "\tMNC: \t%02"PRIu16":\n",enb_properties.properties[i]->mnc); } +#if defined(ENB_AGENT_SB_IF) + printf( "\nENB AGENT CONFIG : \n\n"); + printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); + printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); + printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); + +#endif + 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]); @@ -571,6 +584,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *address = NULL; char *cidr = NULL; char *astring = NULL; + char* enb_agent_interface_name = NULL; + char* enb_agent_ipv4_address = NULL; + libconfig_int enb_agent_port = 0; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2190,6 +2206,33 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) } } } + + // 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_ENB_AGENT_INTERFACE_NAME, + (const char **)&enb_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS, + (const char **)&enb_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, + &enb_agent_port) + ) + ) { + enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); + cidr = enb_agent_ipv4_address; + address = strtok(cidr, "/"); + enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address = strdup(address); + /* if (address) { + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); + }*/ + + enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; + + } + } + // 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 113681dafe..7182628de0 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -203,6 +203,9 @@ typedef struct Enb_properties_s { char *enb_interface_name_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME; + char *enb_agent_interface_name; + in_addr_t enb_agent_ipv4_address; + tcp_udp_port_t enb_agent_port; // otg config /* Nb of OTG elements */ uint8_t num_otg_elements; diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index abbdbc01ab..f8326be820 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -333,6 +333,14 @@ int logInit (void) g_log->log_component[ENB_APP].filelog = 0; g_log->log_component[ENB_APP].filelog_name = ""; + g_log->log_component[ENB_AGENT].name = "ENB_AGENT"; + g_log->log_component[ENB_AGENT].level = LOG_DEBUG; + g_log->log_component[ENB_AGENT].flag = LOG_MED; + g_log->log_component[ENB_AGENT].interval = 1; + g_log->log_component[ENB_AGENT].fd = 0; + g_log->log_component[ENB_AGENT].filelog = 0; + g_log->log_component[ENB_AGENT].filelog_name = ""; + g_log->log_component[TMR].name = "TMR"; g_log->log_component[TMR].level = LOG_EMERG; g_log->log_component[TMR].flag = LOG_MED; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index c6abbfa001..1eb68f6e44 100755 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -264,6 +264,7 @@ typedef enum { RAL_ENB, RAL_UE, ENB_APP, + ENB_AGENT, TMR, USIM, LOCALIZE, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf new file mode 100644 index 0000000000..045a2855a0 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -0,0 +1,153 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + 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 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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 = 2; + rach_preambleInitialReceivedTargetPower = -100; + 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; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "0.0.0.0"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "none"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "none"; + ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; + ENB_AGENT_PORT = 2210; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From f7d591f150841ad30d9e4de3a5d68b1f43060fcc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 13:57:52 +0200 Subject: [PATCH 018/182] Created task manager support for agent messages in the for of a priority queue --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_task_manager.c | 303 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_task_manager.h | 158 +++++++++++ 3 files changed, 462 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_task_manager.c create mode 100644 openair2/ENB_APP/enb_agent_task_manager.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 6fa30b2b35..0777e1f3a0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -746,6 +746,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c new file mode 100644 index 0000000000..0b987f1c22 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -0,0 +1,303 @@ +/******************************************************************************* + 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 . + + 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 enb_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the enb agent + * \author Xenofon Foukas + * \date January 2016 + * \version 0.1 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#include +#include +#include + +#include "enb_agent_task_manager.h" + + +/* Util macros */ +#define LEFT(x) (2 * (x) + 1) +#define RIGHT(x) (2 * (x) + 2) +#define PARENT(x) ((x - 1) / 2) + +enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, + uint16_t frame_num, uint8_t subframe_num) { + enb_agent_task_t *task = NULL; + task = malloc(sizeof(enb_agent_task_t)); + + if (task == NULL) + goto error; + + task->frame_num = frame_num; + task->subframe_num = subframe_num; + task->task = msg; + + return task; + + error: + return NULL; +} + +void enb_agent_task_destroy(enb_agent_task_t *task) { + if (task == NULL) + return; + + /* TODO: must free the task properly */ + free(task->task); + free(task); +} + +enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { + enb_agent_task_queue_t *queue = NULL; + + queue = malloc(sizeof(enb_agent_task_queue_t)); + if (queue == NULL) + goto error; + + /* If no comparator was given, use the default one */ + if (cmp == NULL) + queue->cmp = _enb_agent_task_queue_cmp; + else + queue->cmp = cmp; + + queue->first_frame = 0; + queue->first_subframe = 0; + + queue->task = malloc(capacity * sizeof(enb_agent_task_t *)); + if (queue->task == NULL) + goto error; + + queue->count = 0; + queue->capacity = capacity; + + queue->mutex = malloc(sizeof(pthread_mutex_t)); + if (queue->mutex == NULL) + goto error; + if (pthread_mutex_init(queue->mutex, NULL)) + goto error; + + return queue; + + error: + if (queue != NULL) { + free(queue->mutex); + free(queue->task); + free(queue); + } + return NULL; +} + +enb_agent_task_queue_t *enb_agent_task_queue_default_init() { + return enb_agent_task_queue_init(DEFAULT_CAPACITY, NULL); +} + +void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { + int i; + + if (queue == NULL) + return; + + for (i = 0; i < queue->count; i++) { + enb_agent_task_destroy(queue->task[i]); + } + free(queue->task); + free(queue->mutex); + free(queue); +} + +int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task) { + size_t i; + enb_agent_task_t *tmp = NULL; + int realloc_status, err_code; + + if (pthread_mutex_lock(queue->mutex)) { + /*TODO*/ + err_code = -1; + goto error; + } + + if (queue->count >= queue->capacity) { + /*TODO: need to call realloc heap*/ + realloc_status = _enb_agent_task_queue_realloc_heap(queue); + if (realloc_status != HEAP_OK) { + err_code = realloc_status; + goto error; + } + } + + queue->task[queue->count] = task; + i = queue->count; + queue->count++; + /*Swap elements to maintain heap properties*/ + while(i > 0 && queue->cmp(queue->task[i], queue->task[PARENT(i)]) > 0) { + tmp = queue->task[i]; + queue->task[i] = queue->task[PARENT(i)]; + queue->task[PARENT(i)] = tmp; + i = PARENT(i); + } + + if (pthread_mutex_unlock(queue->mutex)) { + // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + return 0; + + error: + /*TODO*/ + return err_code; +} + + +int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { + int err_code; + + /*TODO*/ + /* Find current frame and subframe number */ + uint16_t curr_frame=1; + uint8_t curr_subframe=1; + + if (pthread_mutex_lock(queue->mutex)) { + /*TODO*/ + err_code = -1; + goto error; + } + + if (queue->count < 1) { + /* Priority Queue is empty */ + err_code = HEAP_EMPTY; + goto error; + } + /* If no task is scheduled for the current subframe, return without any task */ + if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { + *task = NULL; + return 0; + } + /* Otherwise, the first task should be returned */ + *task = queue->task[0]; + queue->task[0] = queue->task[queue->count-1]; + queue->count--; + /* Restore heap property */ + _enb_agent_task_queue_heapify(queue, 0); + + if (pthread_mutex_unlock(queue->mutex)) { + // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + return HEAP_OK; + + error: + /*TODO*/ + return err_code; +} + +/*Warning: Internal function. Should not be called as API function. Not thread safe*/ +void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { + /* left index, right index, largest */ + enb_agent_task_t *tmp = NULL; + size_t l_idx, r_idx, lrg_idx; + + l_idx = LEFT(idx); + r_idx = RIGHT(idx); + + /* Left child exists, compare left child with its parent */ + if (l_idx < queue->count && queue->cmp(queue->task[l_idx], queue->task[idx]) > 0) { + lrg_idx = l_idx; + } else { + lrg_idx = idx; + } + + /* Right child exists, compare right child with the largest element */ + if (r_idx < queue->count && queue->cmp(queue->task[r_idx], queue->task[lrg_idx]) > 0) { + lrg_idx = r_idx; + } + + /* At this point largest element was determined */ + if (lrg_idx != idx) { + /* Swap between the index at the largest element */ + tmp = queue->task[lrg_idx]; + queue->task[lrg_idx] = queue->task[idx]; + queue->task[idx] = tmp; + /* Heapify again */ + _enb_agent_task_queue_heapify(queue, lrg_idx); + } +} + +/*Warning: Internal function. Should not be called as API function. Not thread safe*/ +int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { + enb_agent_task_t **resized_task_heap; + if (queue->count >= queue->capacity) { + size_t task_size = sizeof(enb_agent_task_t); + + resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size); + if (resized_task_heap != NULL) { + queue->capacity *= 2; + queue->task = (enb_agent_task_t **) resized_task_heap; + return HEAP_OK; + } else return HEAP_REALLOCERROR; + } + return HEAP_NOREALLOC; +} + +int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2) { + if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) + return 0; + /* TODO: need to get current frame and subframe number */ + uint16_t curr_frame = 0; + uint8_t curr_subframe = 7; + + int f_offset, sf_offset, tmp1, tmp2; + + /*Check if the offsets have the same sign and compare the tasks position frame-wise*/ + tmp1 = t1->frame_num - curr_frame; + tmp2 = t2->frame_num - curr_frame; + if ((tmp1 >= 0) ^ (tmp2 < 0)) { + f_offset = tmp2 - tmp1; + } + else { + f_offset = tmp1 - tmp2; + } + /*Do the same for the subframe*/ + tmp1 = t1->subframe_num - curr_subframe; + tmp2 = t2->subframe_num - curr_subframe; + if ((tmp1 >= 0) ^ (tmp2 < 0)) + sf_offset = tmp2 - tmp1; + else + sf_offset = tmp1 - tmp2; + + /*Subframe position matters only if f_offset is 0. Multiply f_offset by 100 + to be the only comparisson parameter in all other cases */ + return f_offset*100 + sf_offset; +} + + +int main(int argc, char **argv) { + return 0; +} diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h new file mode 100644 index 0000000000..5a3b5eb327 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -0,0 +1,158 @@ +/******************************************************************************* + 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 . + + 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 enb_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the enb agent + * \author Xenofon Foukas + * \date January 2016 + * \version 0.1 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#ifndef ENB_AGENT_TASK_MANAGER_ +#define ENB_AGENT_TASK_MANAGER_ + +#include +#include + +#include "progran.pb-c.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFAULT_CAPACITY 512 + +/** + * The structure containing the enb agent task to be executed + */ +typedef struct enb_agent_task_s { + /* The frame in which the task needs to be executed */ + uint16_t frame_num; + /* The subframe in which the task needs to be executed */ + uint8_t subframe_num; + /* The task to be executed in the form of a Protocol__ProgranMessage */ + Protocol__ProgranMessage *task; +} enb_agent_task_t; + +/** + * Priority Queue Structure for tasks + */ +typedef struct enb_agent_task_queue_s { + /* The amount of allocated memory for agent tasks in the heap*/ + volatile size_t capacity; + /* The actual size of the tasks heap at a certain time */ + volatile size_t count; + /* The earliest frame that has a pending task */ + volatile uint16_t first_frame; + /* The earliest subframe within the frame that has a pending task */ + volatile uint8_t first_subframe; + /* An array of prioritized tasks stored in a heap */ + enb_agent_task_t **task; + /* A pointer to a comparator function, used to prioritize elements */ + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + pthread_mutex_t *mutex; +} enb_agent_task_queue_t; + +typedef enum { + HEAP_OK = 0, + HEAP_EMPTY, + HEAP_FAILED, + HEAP_REALLOCERROR, + HEAP_NOREALLOC, + HEAP_FATAL, +} heapstatus_e; + +/** + * Allocate memory for a task in the queue + */ +enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, + uint16_t frame_num, uint8_t subframe_num); + +/** + * Free memory for a task of the queue + */ +void enb_agent_task_destroy(enb_agent_task_t *task); + +/** + * Allocate initial memory for storing the tasks + */ +enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + +/** + * Allocate initial memory for storing the tasks using default parameters + */ +enb_agent_task_queue_t *enb_agent_task_queue_default_init(); + +/** + * De-allocate memory for the tasks queue + */ +void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue); + +/** + * Insert task into the queue + */ +int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task); + +/** + * Remove the task with the highest priority from the queue + * task becomes NULL if there is no task for the current frame and subframe + */ +int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task); + +/** + * Check if the top priority task is for a specific frame and subframe + */ +int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue, + const uint16_t frame, const uint8_t subframe); + +/** + * Restructure heap after modifications + */ +void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx); + +/** + * Reallocate memory once the heap reaches max size + */ +int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); + +/** + * Compare two agent tasks based on frame and subframe + * returns 0 if tasks t1, t2 have the same priority + * return negative value if t1 needs to be executed after t2 + * return positive value if t1 preceeds t2 + */ +int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + +#ifdef __cplusplus +} +#endif + +#endif /*ENB_AGENT_TASK_MANAGER_*/ From f2f0e68f9db76695d0c91dc109d0f59cfba56c1d Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 5 Jan 2016 19:26:45 +0100 Subject: [PATCH 019/182] Fix the bug in the RB tree, and sanity test for the timer API --- common/utils/collection/tree.h | 231 ++++++++++++++++++++------- common/utils/itti/timer.c | 8 +- openair2/ENB_APP/enb_agent.c | 5 +- openair2/ENB_APP/enb_agent_common.c | 85 +++++----- openair2/ENB_APP/enb_agent_common.h | 9 +- openair2/ENB_APP/enb_agent_handler.c | 10 +- 6 files changed, 232 insertions(+), 116 deletions(-) diff --git a/common/utils/collection/tree.h b/common/utils/collection/tree.h index 8e4e35c408..c9df686fbb 100755 --- a/common/utils/collection/tree.h +++ b/common/utils/collection/tree.h @@ -1,4 +1,8 @@ -/* +/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */ +/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ +/* $FreeBSD$ */ + +/*- * Copyright 2002 Niels Provos * All rights reserved. * @@ -26,6 +30,8 @@ #ifndef _SYS_TREE_H_ #define _SYS_TREE_H_ +#include + /* * This file defines data structures for different types of trees: * splay trees and red-black trees. @@ -63,7 +69,7 @@ struct name { \ #define SPLAY_INIT(root) do { \ (root)->sph_root = NULL; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ENTRY(type) \ struct { \ @@ -81,32 +87,32 @@ struct { \ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ SPLAY_LEFT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_LINKLEFT(head, tmp, field) do { \ SPLAY_LEFT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_LINKRIGHT(head, tmp, field) do { \ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ @@ -207,7 +213,7 @@ name##_SPLAY(struct name *head, struct type *elm) \ SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ __left = __right = &__node; \ \ - while ((__comp = (cmp)(elm, (head)->sph_root))) { \ + while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ if (__comp < 0) { \ __tmp = SPLAY_LEFT((head)->sph_root, field); \ if (__tmp == NULL) \ @@ -286,7 +292,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \ (x) != NULL; \ (x) = SPLAY_NEXT(name, head, x)) -/* Macros that define a red-back tree */ +/* Macros that define a red-black tree */ #define RB_HEAD(name, type) \ struct name { \ struct type *rbh_root; /* root of the tree */ \ @@ -297,7 +303,7 @@ struct name { \ #define RB_INIT(root) do { \ (root)->rbh_root = NULL; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_BLACK 0 #define RB_RED 1 @@ -320,24 +326,24 @@ struct { \ RB_PARENT(elm, field) = parent; \ RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ RB_COLOR(elm, field) = RB_RED; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_SET_BLACKRED(black, red, field) do { \ RB_COLOR(black, field) = RB_BLACK; \ RB_COLOR(red, field) = RB_RED; \ -} while (0) +} while (/*CONSTCOND*/ 0) #ifndef RB_AUGMENT -#define RB_AUGMENT(x) +#define RB_AUGMENT(x) do {} while (0) #endif #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))) { \ + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ } \ RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ @@ -349,15 +355,15 @@ struct { \ RB_AUGMENT(tmp); \ if ((RB_PARENT(tmp, field))) \ RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))) { \ + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ } \ RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ @@ -369,28 +375,66 @@ struct { \ RB_AUGMENT(tmp); \ if ((RB_PARENT(tmp, field))) \ RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) +} while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ -void name##_RB_INSERT_COLOR(struct name *, struct type *); \ -void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ -struct type *name##_RB_REMOVE(struct name *, struct type *); \ -struct type *name##_RB_INSERT(struct name *, struct type *); \ -struct type *name##_RB_FIND(struct name *, struct type *); \ -struct type *name##_RB_NEXT(struct type *); \ -struct type *name##_RB_MINMAX(struct name *, int); \ - \ +#define RB_PROTOTYPE(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) +#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) +#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ + RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \ + RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \ + RB_PROTOTYPE_INSERT(name, type, attr); \ + RB_PROTOTYPE_REMOVE(name, type, attr); \ + RB_PROTOTYPE_FIND(name, type, attr); \ + RB_PROTOTYPE_NFIND(name, type, attr); \ + RB_PROTOTYPE_NEXT(name, type, attr); \ + RB_PROTOTYPE_PREV(name, type, attr); \ + RB_PROTOTYPE_MINMAX(name, type, attr); +#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \ + attr void name##_RB_INSERT_COLOR(struct name *, struct type *) +#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \ + attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *) +#define RB_PROTOTYPE_REMOVE(name, type, attr) \ + attr struct type *name##_RB_REMOVE(struct name *, struct type *) +#define RB_PROTOTYPE_INSERT(name, type, attr) \ + attr struct type *name##_RB_INSERT(struct name *, struct type *) +#define RB_PROTOTYPE_FIND(name, type, attr) \ + attr struct type *name##_RB_FIND(struct name *, struct type *) +#define RB_PROTOTYPE_NFIND(name, type, attr) \ + attr struct type *name##_RB_NFIND(struct name *, struct type *) +#define RB_PROTOTYPE_NEXT(name, type, attr) \ + attr struct type *name##_RB_NEXT(struct type *) +#define RB_PROTOTYPE_PREV(name, type, attr) \ + attr struct type *name##_RB_PREV(struct type *) +#define RB_PROTOTYPE_MINMAX(name, type, attr) \ + attr struct type *name##_RB_MINMAX(struct name *, int) /* Main rb operation. * Moves node close to the key of elm to top */ -#define RB_GENERATE(name, type, field, cmp) \ -void \ +#define RB_GENERATE(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp,) +#define RB_GENERATE_STATIC(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static) +#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ + RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ + RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ + RB_GENERATE_INSERT(name, type, field, cmp, attr) \ + RB_GENERATE_REMOVE(name, type, field, attr) \ + RB_GENERATE_FIND(name, type, field, cmp, attr) \ + RB_GENERATE_NFIND(name, type, field, cmp, attr) \ + RB_GENERATE_NEXT(name, type, field, attr) \ + RB_GENERATE_PREV(name, type, field, attr) \ + RB_GENERATE_MINMAX(name, type, field, attr) + +#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ +attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ struct type *parent, *gparent, *tmp; \ - while ((parent = RB_PARENT(elm, field)) && \ + while ((parent = RB_PARENT(elm, field)) != NULL && \ RB_COLOR(parent, field) == RB_RED) { \ gparent = RB_PARENT(parent, field); \ if (parent == RB_LEFT(gparent, field)) { \ @@ -428,9 +472,10 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ } \ } \ RB_COLOR(head->rbh_root, field) = RB_BLACK; \ -} \ - \ -void \ +} + +#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ +attr void \ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ { \ struct type *tmp; \ @@ -454,7 +499,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) if (RB_RIGHT(tmp, field) == NULL || \ RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\ struct type *oleft; \ - if ((oleft = RB_LEFT(tmp, field)))\ + if ((oleft = RB_LEFT(tmp, field)) \ + != NULL) \ RB_COLOR(oleft, field) = RB_BLACK;\ RB_COLOR(tmp, field) = RB_RED; \ RB_ROTATE_RIGHT(head, tmp, oleft, field);\ @@ -486,7 +532,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) if (RB_LEFT(tmp, field) == NULL || \ RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\ struct type *oright; \ - if ((oright = RB_RIGHT(tmp, field)))\ + if ((oright = RB_RIGHT(tmp, field)) \ + != NULL) \ RB_COLOR(oright, field) = RB_BLACK;\ RB_COLOR(tmp, field) = RB_RED; \ RB_ROTATE_LEFT(head, tmp, oright, field);\ @@ -504,9 +551,10 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) } \ if (elm) \ RB_COLOR(elm, field) = RB_BLACK; \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_REMOVE(name, type, field, attr) \ +attr struct type * \ name##_RB_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *parent, *old = elm; \ @@ -518,7 +566,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \ else { \ struct type *left; \ elm = RB_RIGHT(elm, field); \ - while ((left = RB_LEFT(elm, field))) \ + while ((left = RB_LEFT(elm, field)) != NULL) \ elm = left; \ child = RB_RIGHT(elm, field); \ parent = RB_PARENT(elm, field); \ @@ -551,7 +599,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \ left = parent; \ do { \ RB_AUGMENT(left); \ - } while ((left = RB_PARENT(left, field))); \ + } while ((left = RB_PARENT(left, field)) != NULL); \ } \ goto color; \ } \ @@ -572,9 +620,10 @@ color: \ name##_RB_REMOVE_COLOR(head, parent, child); \ return (old); \ } \ - \ + +#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \ /* Inserts a node into the RB tree */ \ -struct type * \ +attr struct type * \ name##_RB_INSERT(struct name *head, struct type *elm) \ { \ struct type *tmp; \ @@ -599,15 +648,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) \ RB_RIGHT(parent, field) = elm; \ RB_AUGMENT(parent); \ } else \ - { \ RB_ROOT(head) = elm; \ - } \ name##_RB_INSERT_COLOR(head, elm); \ return (NULL); \ -} \ - \ +} + +#define RB_GENERATE_FIND(name, type, field, cmp, attr) \ /* Finds the node with the same key as elm */ \ -struct type * \ +attr struct type * \ name##_RB_FIND(struct name *head, struct type *elm) \ { \ struct type *tmp = RB_ROOT(head); \ @@ -622,9 +670,33 @@ name##_RB_FIND(struct name *head, struct type *elm) \ return (tmp); \ } \ return (NULL); \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \ +/* Finds the first node greater than or equal to the search key */ \ +attr struct type * \ +name##_RB_NFIND(struct name *head, struct type *elm) \ +{ \ + struct type *tmp = RB_ROOT(head); \ + struct type *res = NULL; \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) { \ + res = tmp; \ + tmp = RB_LEFT(tmp, field); \ + } \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (res); \ +} + +#define RB_GENERATE_NEXT(name, type, field, attr) \ +/* ARGSUSED */ \ +attr struct type * \ name##_RB_NEXT(struct type *elm) \ { \ if (RB_RIGHT(elm, field)) { \ @@ -643,9 +715,33 @@ name##_RB_NEXT(struct type *elm) \ } \ } \ return (elm); \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_PREV(name, type, field, attr) \ +/* ARGSUSED */ \ +attr struct type * \ +name##_RB_PREV(struct type *elm) \ +{ \ + if (RB_LEFT(elm, field)) { \ + elm = RB_LEFT(elm, field); \ + while (RB_RIGHT(elm, field)) \ + elm = RB_RIGHT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && \ + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && \ + (elm == RB_LEFT(RB_PARENT(elm, field), field)))\ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ +} + +#define RB_GENERATE_MINMAX(name, type, field, attr) \ +attr struct type * \ name##_RB_MINMAX(struct name *head, int val) \ { \ struct type *tmp = RB_ROOT(head); \ @@ -666,7 +762,9 @@ name##_RB_MINMAX(struct name *head, int val) \ #define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) #define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) #define RB_FIND(name, x, y) name##_RB_FIND(x, y) +#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) #define RB_NEXT(name, x, y) name##_RB_NEXT(y) +#define RB_PREV(name, x, y) name##_RB_PREV(y) #define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) #define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) @@ -675,4 +773,29 @@ name##_RB_MINMAX(struct name *head, int val) \ (x) != NULL; \ (x) = name##_RB_NEXT(x)) +#define RB_FOREACH_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_SAFE(x, name, head, y) \ + for ((x) = RB_MIN(name, head); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE(x, name, head) \ + for ((x) = RB_MAX(name, head); \ + (x) != NULL; \ + (x) = name##_RB_PREV(x)) + +#define RB_FOREACH_REVERSE_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + #endif /* _SYS_TREE_H_ */ diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 683efd1279..9c742c19cc 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -95,8 +95,7 @@ int timer_handle_signal(siginfo_t *info) // LG: To many traces for msc timer: TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - printf("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - + task_id = timer_p->task_id; instance = timer_p->instance; message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED); @@ -210,11 +209,6 @@ int timer_setup( type == TIMER_PERIODIC ? "periodic" : "single shot", *timer_id, interval_sec, interval_us); - printf("Requesting new %s timer with id 0x%lx that expires within " - "%d sec and %d usec\n", - type == TIMER_PERIODIC ? "periodic" : "single shot", - *timer_id, interval_sec, interval_us); - timer_p->timer = timer; /* Lock the queue and insert the timer at the tail */ diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 7003a2c638..01eb61fc0b 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -40,6 +40,7 @@ #include "assertions.h" +//#define TEST_TIMER enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; @@ -327,8 +328,10 @@ int enb_agent_stop(mid_t mod_id){ err_code_t enb_agent_timeout(void* args){ + // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); + //memcpy (timer_args, args, sizeof(*timer_args)); enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; - + LOG_I(ENB_AGENT, "enb_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); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c2653f4c85..70f1092bdd 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -312,25 +312,12 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { //struct enb_agent_map agent_map; - -/* The timer_id might not be the best choice for the comparison */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ - - //if (a->timer_id) return 0; - //if (b->timer_id) return 0; - - if (a->timer_id < b->timer_id) return -1; - if (a->timer_id > b->timer_id) return 1; - - // equal timers - return 0; -} - -RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); - +enb_agent_timer_instance_t timer_instance; err_code_t enb_agent_init_timer(void){ + + LOG_I(ENB_AGENT, "init RB tree\n"); - RB_INIT(&enb_agent_head); + RB_INIT(&timer_instance.enb_agent_head); /* struct enb_agent_timer_element_s e; @@ -340,6 +327,18 @@ err_code_t enb_agent_init_timer(void){ return PROTOCOL__PROGRAN_ERR__NO_ERR; } +RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); + +/* The timer_id might not be the best choice for the comparison */ +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_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 enb_agent_create_timer(uint32_t interval_sec, uint32_t interval_usec, agent_id_t agent_id, @@ -349,7 +348,9 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, void* timer_args, long *timer_id){ - struct enb_agent_timer_element_s e; + struct enb_agent_timer_element_s *e = calloc(1, sizeof(*e)); + DevAssert(e != NULL); + //uint32_t timer_id; int ret=-1; @@ -368,7 +369,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, timer_args, timer_id); - e.type = TIMER_ONE_SHOT; + e->type = TIMER_ONE_SHOT; } else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ ret = timer_setup(interval_sec, @@ -379,32 +380,25 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, timer_args, timer_id); - e.type = TIMER_PERIODIC; + e->type = TIMER_PERIODIC; } if (ret < 0 ) { return TIMER_SETUP_FAILED; } - e.agent_id = agent_id; - e.instance = instance; - e.state = ENB_AGENT_TIMER_STATE_ACTIVE; - e.timer_id = *timer_id; - e.timer_args = timer_args; - e.cb = cb; - - LOG_I(ENB_AGENT,"created a timer with id 0x%lx for agent %d, instance %d \n", - e.timer_id, e.agent_id, e.instance); - - RB_INSERT(enb_agent_map, &enb_agent_head, &e); + e->agent_id = agent_id; + e->instance = instance; + e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + e->timer_id = *timer_id; + // e->timer_args = timer_args; + e->cb = cb; + /*element should be a real pointer*/ + RB_INSERT(enb_agent_map, &timer_instance.enb_agent_head, e); - - /* - struct enb_agent_timer_element_s search; - search.timer_id = *timer_id; - printf("search 1: %p (expected %p)\n", RB_FIND(enb_agent_map, &enb_agent_head, &search), &e); - printf("search 1: %p (expected %p)\n", get_timer_entry(e.timer_id), &e); - */ + LOG_I(ENB_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; } @@ -413,7 +407,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){ struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &enb_agent_head, &e); + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, &e); free(e); } @@ -431,8 +425,8 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s *e = NULL; - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - RB_REMOVE(enb_agent_map, &enb_agent_head, e); + RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); timer_remove(e->timer_id); free(e); } @@ -443,11 +437,10 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s search, *e; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); - search.timer_id = timer_id; - - return RB_FIND(enb_agent_map, &enb_agent_head, &search); + struct enb_agent_timer_element_s *search= calloc(1,sizeof(*search)); + search->timer_id = timer_id; + + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); } /* diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index eb3de96145..662ea73ed7 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -189,10 +189,13 @@ typedef struct enb_agent_timer_element_s{ long timer_id; /* Timer id returned by the timer API*/ enb_agent_timer_callback_t cb; - void* timer_args; + // void* timer_args; } enb_agent_timer_element_t; +typedef struct enb_agent_timer_instance_s{ + RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; +}enb_agent_timer_instance_t; err_code_t enb_agent_init_timer(void); @@ -214,11 +217,11 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); + err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); -RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); /* RB_PROTOTYPE is for .h files */ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 27536c8b7f..1b8457d474 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -141,15 +141,15 @@ void * enb_agent_send_message(xid_t xid, err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ - struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); + + if (found == NULL ) goto error; + LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); - LOG_I(ENB_AGENT, "element %p: timer_id is 0x%lx 0x%lx\n", e, timer_id, e->timer_id); - - if (e == NULL ) goto error; if (timer_args == NULL) LOG_W(ENB_AGENT,"null timer args\n"); - return e->cb(timer_args); + return found->cb(timer_args); error: From 99cf3b654ab8b4a42fac031bdac116f98b8247cc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 21:30:55 +0200 Subject: [PATCH 020/182] Added functions to get the current frame and subframe --- openair2/ENB_APP/enb_agent_common.c | 12 ++++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 70f1092bdd..c1d65f95cc 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -282,6 +282,18 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } +int get_current_frame (mid_t mod_id) { + + return ((eNB_MAC_INST *)enb[mod_id])->frame; + +} + +int get_current_subframe (mid_t mod_id) { + + return ((eNB_MAC_INST *)enb[mod_id])->subframe; + +} + int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 662ea73ed7..ca5aafbfdd 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -104,6 +104,10 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran); int get_current_time_ms (mid_t mod_id, int subframe_flag); +int get_current_frame(mid_t mod_id); + +int get_current_subframe(mid_t mod_id); + int get_num_ues(mid_t mod_id); int get_ue_crnti (mid_t mod_id, mid_t ue_id); From 3bc88cfd11b581bcd1ab1615b377cf8734b91fc9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 21:52:05 +0200 Subject: [PATCH 021/182] Fixed agent to support proper frame and subframe reporting in progRAN messages --- openair2/ENB_APP/enb_agent_common.c | 11 +++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ openair2/ENB_APP/enb_agent_mac.c | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c1d65f95cc..c719777aaf 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -294,6 +294,17 @@ int get_current_subframe (mid_t mod_id) { } +uint16_t get_sfn_sf (mid_t mod_id) { + + uint16_t frame, subframe; + uint16_t sfn_sf; + + frame = (uint16_t) get_current_frame(mod_id); + subframe = (uint16_t) get_current_subframe(mod_id); + sfn_sf = (frame << 12) | subframe; + return sfn_sf; +} + int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index ca5aafbfdd..9c5f4044fa 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -108,6 +108,10 @@ int get_current_frame(mid_t mod_id); int get_current_subframe(mid_t mod_id); +/*Return the frame and subframe number in compact 16-bit format. + Bits 0-3 frame, rest for subframe. 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); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index edf1406296..4801d21686 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -296,7 +296,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. - dl_report->sfn_sn = get_current_time_ms(enb_id, 1); + dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = 1; @@ -391,7 +391,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = 100; + full_ul_report->sfn_sn = get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex @@ -461,7 +461,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_noise_interference_report__init(ni_report); // Current frame and subframe number - ni_report->sfn_sf = 0; + ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; // Received interference power in dbm ni_report->rip = 0; From e0c459be755f002e81bbefb0a8a78ee38d3b87ba Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 11:57:03 +0200 Subject: [PATCH 022/182] Changed handlers not to require the xid in their signature. Containted in the received message, or generated in them --- openair2/ENB_APP/enb_agent.c | 4 ++-- openair2/ENB_APP/enb_agent_common.c | 16 +++++++++++++--- openair2/ENB_APP/enb_agent_common.h | 13 +++++-------- openair2/ENB_APP/enb_agent_handler.c | 6 ++---- openair2/ENB_APP/enb_agent_mac.c | 4 +++- openair2/ENB_APP/enb_agent_mac.h | 2 +- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 01eb61fc0b..3c9ad7d24d 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -140,7 +140,7 @@ void *receive_thread(void *args) { LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->mod_id, d->rx_xid, data, size); + msg=enb_agent_handle_message(d->mod_id, data, size); free(data); @@ -149,7 +149,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ - data=enb_agent_send_message(d->tx_xid,msg,&size); + data=enb_agent_send_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c719777aaf..0fe2c8e1ac 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -102,9 +102,11 @@ int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader ** } -int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; + /*TODO: Need to set random xid or xid from received hello message*/ + xid_t xid = 1; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) goto error; @@ -154,8 +156,10 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; + /*TODO: Need to set a random xid*/ + xid_t xid = 1; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -203,7 +207,13 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEchoRequest *echo_req = input->echo_request_msg; + xid = (echo_req->header)->xid; + Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 9c5f4044fa..f918914f92 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -58,8 +58,7 @@ typedef int (*enb_agent_message_decoded_callback)( mid_t mod_id, - xid_t xid, - const void *params, + const void *params, Protocol__ProgranMessage **msg ); @@ -72,23 +71,21 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, - xid_t xid, uint8_t *data, uint32_t size); -void * enb_agent_send_message(xid_t xid, - Protocol__ProgranMessage *msg, +void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 1b8457d474..8c2b9e010a 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -68,7 +68,6 @@ static const char *enb_agent_direction2String[] = { Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, - xid_t xid, uint8_t *data, uint32_t size){ @@ -93,7 +92,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, } - err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, xid, (void *) decoded_message, &reply_message)); + err_code = ((*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; } @@ -110,8 +109,7 @@ error: -void * enb_agent_send_message(xid_t xid, - Protocol__ProgranMessage *msg, +void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size){ void * buffer; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4801d21686..d2504e4dec 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -38,7 +38,7 @@ #include "log.h" -int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -47,6 +47,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot void *buffer; int size; err_code_t err_code; + xid_t xid; //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; @@ -63,6 +64,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; + xid = (stats_req->header)->xid; // Check the type of request that is made switch(stats_req->body_case) { diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 6584111825..569eb51e5e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -70,7 +70,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From e78075e8310de179176db94aa6ae0be7746d872d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 16:22:59 +0200 Subject: [PATCH 023/182] Integrated task manager with system frame and subframe clock and added support for one task queue per eNB --- openair2/ENB_APP/enb_agent_task_manager.c | 51 +++++++++++++---------- openair2/ENB_APP/enb_agent_task_manager.h | 14 ++++--- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c index 0b987f1c22..e2c31319e4 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -40,6 +40,7 @@ #include #include "enb_agent_task_manager.h" +#include "enb_agent_common.c" /* Util macros */ @@ -74,8 +75,8 @@ void enb_agent_task_destroy(enb_agent_task_t *task) { free(task); } -enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { +enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { enb_agent_task_queue_t *queue = NULL; queue = malloc(sizeof(enb_agent_task_queue_t)); @@ -88,6 +89,8 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, else queue->cmp = cmp; + queue->mod_id = mod_id; + queue->first_frame = 0; queue->first_subframe = 0; @@ -115,8 +118,8 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, return NULL; } -enb_agent_task_queue_t *enb_agent_task_queue_default_init() { - return enb_agent_task_queue_init(DEFAULT_CAPACITY, NULL); +enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id) { + return enb_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); } void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { @@ -157,7 +160,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta i = queue->count; queue->count++; /*Swap elements to maintain heap properties*/ - while(i > 0 && queue->cmp(queue->task[i], queue->task[PARENT(i)]) > 0) { + while(i > 0 && queue->cmp(queue->mod_id, queue->task[i], queue->task[PARENT(i)]) > 0) { tmp = queue->task[i]; queue->task[i] = queue->task[PARENT(i)]; queue->task[PARENT(i)] = tmp; @@ -178,11 +181,6 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { int err_code; - - /*TODO*/ - /* Find current frame and subframe number */ - uint16_t curr_frame=1; - uint8_t curr_subframe=1; if (pthread_mutex_lock(queue->mutex)) { /*TODO*/ @@ -195,6 +193,11 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age err_code = HEAP_EMPTY; goto error; } + + /* Find current frame and subframe number */ + uint16_t curr_frame=get_current_frame(queue->mod_id); + uint8_t curr_subframe=get_current_subframe(queue->mod_id); + /* If no task is scheduled for the current subframe, return without any task */ if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { *task = NULL; @@ -206,7 +209,16 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age queue->count--; /* Restore heap property */ _enb_agent_task_queue_heapify(queue, 0); - + + /*If queue has no element*/ + if (queue->count < 1) { + queue->first_frame = 0; + queue->first_subframe = 0; + } else { + queue->first_frame = queue->task[0]->frame_num; + queue->first_subframe = queue->task[0]->subframe_num; + } + if (pthread_mutex_unlock(queue->mutex)) { // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -228,14 +240,14 @@ void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { r_idx = RIGHT(idx); /* Left child exists, compare left child with its parent */ - if (l_idx < queue->count && queue->cmp(queue->task[l_idx], queue->task[idx]) > 0) { + if (l_idx < queue->count && queue->cmp(queue->mod_id, queue->task[l_idx], queue->task[idx]) > 0) { lrg_idx = l_idx; } else { lrg_idx = idx; } /* Right child exists, compare right child with the largest element */ - if (r_idx < queue->count && queue->cmp(queue->task[r_idx], queue->task[lrg_idx]) > 0) { + if (r_idx < queue->count && queue->cmp(queue->mod_id, queue->task[r_idx], queue->task[lrg_idx]) > 0) { lrg_idx = r_idx; } @@ -266,12 +278,12 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { return HEAP_NOREALLOC; } -int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2) { +int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2) { if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) return 0; - /* TODO: need to get current frame and subframe number */ - uint16_t curr_frame = 0; - uint8_t curr_subframe = 7; + + uint16_t curr_frame = get_current_frame(mod_id); + uint8_t curr_subframe = get_current_subframe(mod_id); int f_offset, sf_offset, tmp1, tmp2; @@ -296,8 +308,3 @@ int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t to be the only comparisson parameter in all other cases */ return f_offset*100 + sf_offset; } - - -int main(int argc, char **argv) { - return 0; -} diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h index 5a3b5eb327..ef60152b27 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -43,6 +43,8 @@ #include "progran.pb-c.h" +#include "enb_agent_common.h" + #ifdef __cplusplus extern "C" { #endif @@ -65,6 +67,7 @@ typedef struct enb_agent_task_s { * Priority Queue Structure for tasks */ typedef struct enb_agent_task_queue_s { + mid_t mod_id; /* The amount of allocated memory for agent tasks in the heap*/ volatile size_t capacity; /* The actual size of the tasks heap at a certain time */ @@ -76,7 +79,7 @@ typedef struct enb_agent_task_queue_s { /* An array of prioritized tasks stored in a heap */ enb_agent_task_t **task; /* A pointer to a comparator function, used to prioritize elements */ - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); pthread_mutex_t *mutex; } enb_agent_task_queue_t; @@ -103,13 +106,13 @@ void enb_agent_task_destroy(enb_agent_task_t *task); /** * Allocate initial memory for storing the tasks */ -enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)); /** * Allocate initial memory for storing the tasks using default parameters */ -enb_agent_task_queue_t *enb_agent_task_queue_default_init(); +enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id); /** * De-allocate memory for the tasks queue @@ -148,8 +151,9 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); * returns 0 if tasks t1, t2 have the same priority * return negative value if t1 needs to be executed after t2 * return positive value if t1 preceeds t2 + * Need to give eNB id for the comparisson based on the current frame-subframe */ -int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); #ifdef __cplusplus } From e88779c4ef7c265c32d73f83ca7ba3ca78821638 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 18:06:48 +0200 Subject: [PATCH 024/182] Added support for lightweight finegrained task timer --- openair2/ENB_APP/enb_agent.c | 30 ++++++++++++++++++++++------- openair2/ENB_APP/enb_agent_common.c | 9 +++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 3c9ad7d24d..e8a4466b26 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -50,7 +50,7 @@ enb_agent_info_t enb_agent_info; char in_ip[40]; static uint16_t in_port; -//void *send_thread(void *args); +void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); err_code_t enb_agent_timeout(void* args); @@ -100,20 +100,35 @@ void *enb_agent_task(void *args){ return NULL; } -/* + void *send_thread(void *args) { +#ifdef TEST_TIMER + msg_context_t *d = args; void *data; int size; int priority; - - while (1) { + struct timeval t1, t2; + long long t; + struct timespec ts; + unsigned int delay = 250*1000; + while(1) { + gettimeofday(&t1, NULL); + enb_agent_sleep_until(&ts, delay); + gettimeofday(&t2, NULL); + t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); + LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); + sleep(1); + } + +#endif + /* while (1) { // need logic for the timer, and usleep(10); if (message_put(d->tx_mq, data, size, priority)) goto error; - } + }*/ return NULL; @@ -121,7 +136,7 @@ error: printf("receive_thread: there was an error\n"); return NULL; } -*/ + void *receive_thread(void *args) { msg_context_t *d = args; @@ -293,9 +308,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); #endif - // new_thread(send_thread, &shared_ctxt); + new_thread(send_thread, &shared_ctxt); //while (1) pause(); + LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0fe2c8e1ac..490658c671 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -476,6 +476,15 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); } +void enb_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, enb_agent_map, &enb_agent_head) { diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f918914f92..d12d3849ec 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -39,6 +39,7 @@ #ifndef ENB_AGENT_COMMON_H_ #define ENB_AGENT_COMMON_H_ +#include #include "header.pb-c.h" #include "progran.pb-c.h" @@ -228,6 +229,9 @@ err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); +/*Specify a delay in nanoseconds to timespec and sleep until then*/ +void enb_agent_sleep_until(struct timespec *ts, int delay); + /* RB_PROTOTYPE is for .h files */ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); From 11b2f829367c39ab7479a0b410cd62e773d24117 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 7 Jan 2016 17:41:51 +0200 Subject: [PATCH 025/182] Integrated timer to work with periodic report messages and agent tasks --- openair2/ENB_APP/enb_agent.c | 104 ++++++++++------- openair2/ENB_APP/enb_agent_common.c | 2 +- openair2/ENB_APP/enb_agent_common.h | 16 +-- openair2/ENB_APP/enb_agent_handler.c | 24 +++- openair2/ENB_APP/enb_agent_mac.c | 169 +++++++++++++++++++++++++-- openair2/ENB_APP/enb_agent_mac.h | 13 +++ 6 files changed, 263 insertions(+), 65 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index e8a4466b26..dbefc60502 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -53,7 +53,7 @@ static uint16_t in_port; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -err_code_t enb_agent_timeout(void* args); +Protocol__ProgranMessage *enb_agent_timeout(void* args); /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller @@ -61,6 +61,13 @@ err_code_t enb_agent_timeout(void* args); */ void *enb_agent_task(void *args){ + msg_context_t *d = (msg_context_t *) args; + Protocol__ProgranMessage *msg; + void *data; + int size; + err_code_t err_code; + int priority; + MessageDef *msg_p = NULL; const char *msg_name = NULL; instance_t instance; @@ -86,7 +93,15 @@ void *enb_agent_task(void *args){ break; case TIMER_HAS_EXPIRED: - enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, &msg_p->ittiMsg.timer_has_expired.arg); + msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); + if (msg != NULL){ + data=enb_agent_send_message(msg,&size); + if (message_put(d->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } break; default: @@ -96,46 +111,49 @@ void *enb_agent_task(void *args){ 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(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code); } while (1); return NULL; } -void *send_thread(void *args) { +/* void *send_thread(void *args) { */ -#ifdef TEST_TIMER +/* #ifdef TEST_TIMER */ - msg_context_t *d = args; - void *data; - int size; - int priority; +/* msg_context_t *d = args; */ +/* void *data; */ +/* int size; */ +/* int priority; */ - struct timeval t1, t2; - long long t; - struct timespec ts; - unsigned int delay = 250*1000; - while(1) { - gettimeofday(&t1, NULL); - enb_agent_sleep_until(&ts, delay); - gettimeofday(&t2, NULL); - t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); - LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); - sleep(1); - } +/* struct timeval t1, t2; */ +/* long long t; */ +/* struct timespec ts; */ +/* unsigned int delay = 250*1000; */ +/* while(1) { */ +/* gettimeofday(&t1, NULL); */ +/* enb_agent_sleep_until(&ts, delay); */ +/* gettimeofday(&t2, NULL); */ +/* t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); */ +/* LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); */ +/* sleep(1); */ +/* } */ -#endif - /* while (1) { - // need logic for the timer, and - usleep(10); - if (message_put(d->tx_mq, data, size, priority)) goto error; - }*/ +/* #endif */ +/* /\* while (1) { */ +/* // need logic for the timer, and */ +/* usleep(10); */ +/* if (message_put(d->tx_mq, data, size, priority)) goto error; */ +/* }*\/ */ - return NULL; +/* return NULL; */ -error: - printf("receive_thread: there was an error\n"); - return NULL; -} +/* error: */ +/* printf("receive_thread: there was an error\n"); */ +/* return NULL; */ +/* } */ void *receive_thread(void *args) { @@ -290,25 +308,25 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * start the enb agent task for tx and interaction with the underlying network function */ - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, NULL) < 0) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; } -#ifdef TEST_TIMER + //#ifdef TEST_TIMER long timer_id=0; enb_agent_timer_args_t timer_args; memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); timer_args.mod_id = mod_id; - timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; - timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - timer_args.ue_actions = ENB_AGENT_ACTION_SEND; - timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + //timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; + //timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + //timer_args.ue_actions = ENB_AGENT_ACTION_SEND; + //timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); -#endif + //#endif - new_thread(send_thread, &shared_ctxt); + //new_thread(send_thread, &shared_ctxt); //while (1) pause(); @@ -342,15 +360,15 @@ int enb_agent_stop(mid_t mod_id){ -err_code_t enb_agent_timeout(void* args){ +Protocol__ProgranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; LOG_I(ENB_AGENT, "enb_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); + //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 0; + return NULL; } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 490658c671..0417f4956e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -311,7 +311,7 @@ uint16_t get_sfn_sf (mid_t mod_id) { frame = (uint16_t) get_current_frame(mod_id); subframe = (uint16_t) get_current_subframe(mod_id); - sfn_sf = (frame << 12) | subframe; + sfn_sf = (subframe << 12) | frame; return sfn_sf; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index d12d3849ec..31d882d0c9 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -86,6 +86,8 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); +Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); + void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size); @@ -107,7 +109,7 @@ int get_current_frame(mid_t mod_id); int get_current_subframe(mid_t mod_id); /*Return the frame and subframe number in compact 16-bit format. - Bits 0-3 frame, rest for subframe. Required by progRAN protocol*/ + 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); @@ -137,7 +139,7 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Type of the callback executed when the timer expired */ -typedef err_code_t (*enb_agent_timer_callback_t)(void*); +typedef Protocol__ProgranMessage *(*enb_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ @@ -169,13 +171,7 @@ typedef enum { typedef struct enb_agent_timer_args_s{ mid_t mod_id; - - agent_action_t cc_actions; - uint32_t cc_report_flags; - - agent_action_t ue_actions; - uint32_t ue_report_flags; - + Protocol__ProgranMessage *msg; } enb_agent_timer_args_t; @@ -225,7 +221,7 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 8c2b9e010a..2841f9b6e5 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -133,11 +133,28 @@ void * enb_agent_send_message(Protocol__ProgranMessage *msg, error : LOG_E(ENB_AGENT,"errno %d occured\n",err_code); - return NULL; - + return NULL; } -err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { + err_code_t err_code; + enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + + Protocol__ProgranMessage *timed_task, *reply_message; + timed_task = timer_args->msg; + err_code = ((*messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + if ( err_code < 0 ){ + goto error; + } + + return reply_message; + + error: + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + return NULL; +} + +Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); @@ -148,7 +165,6 @@ err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ LOG_W(ENB_AGENT,"null timer args\n"); return found->cb(timer_args); - error: LOG_E(ENB_AGENT, "can't get the timer element\n"); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d2504e4dec..1a21db5e15 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -48,6 +48,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int size; err_code_t err_code; xid_t xid; + uint32_t usec_interval, sec_interval; //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; @@ -70,12 +71,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { - //TODO: Must create a periodic report. Implement once the - // timer functionality is supported - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /* if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { */ + /* //TODO: Must create a periodic report. Implement once the */ + /* // timer functionality is supported */ + /* *msg = NULL; */ + /* return 0; */ + /* } else */ + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism *msg = NULL; return 0; @@ -83,7 +85,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr //TODO: Must implement to deactivate the event based reporting *msg = NULL; return 0; - } else { //One-off reporting + } else { //One-off or periodical reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -114,6 +116,33 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr 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__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { + /* Create a one off progran message as an argument for the periodical task */ + Protocol__ProgranMessage *timer_msg; + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); + /* Create a timer */ + long timer_id = 0; + enb_agent_timer_args_t *timer_args; + timer_args = malloc(sizeof(enb_agent_timer_args_t)); + memset (timer_args, 0, sizeof(enb_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); + } + enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } } break; case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; @@ -172,6 +201,132 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr return err_code; } +int enb_agent_mac_stats_request(mid_t mod_id, + xid_t xid, + const stats_request_config_t *report_config, + Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) + goto error; + + Protocol__PrpStatsRequest *stats_request_msg; + stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); + if(stats_request_msg == NULL) + goto error; + + protocol__prp_stats_request__init(stats_request_msg); + stats_request_msg->header = header; + + stats_request_msg->type = report_config->report_type; + stats_request_msg->has_type = 1; + + switch (report_config->report_type) { + case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; + Protocol__PrpCompleteStatsRequest *complete_stats; + complete_stats = malloc(sizeof(Protocol__PrpCompleteStatsRequest)); + if(complete_stats == NULL) + goto error; + protocol__prp_complete_stats_request__init(complete_stats); + complete_stats->report_frequency = report_config->report_frequency; + complete_stats->has_report_frequency = 1; + complete_stats->sf = report_config->period; + complete_stats->has_sf = 1; + complete_stats->has_cell_report_flags = 1; + complete_stats->has_ue_report_flags = 1; + if (report_config->config->nr_cc > 0) { + complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags; + } + if (report_config->config->nr_ue > 0) { + complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags; + } + stats_request_msg->complete_stats_request = complete_stats; + break; + case PROTOCOL__PRP_STATS_TYPE__PRST_CELL_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST; + Protocol__PrpCellStatsRequest *cell_stats; + cell_stats = malloc(sizeof(Protocol__PrpCellStatsRequest)); + if(cell_stats == NULL) + goto error; + protocol__prp_cell_stats_request__init(cell_stats); + cell_stats->n_cell = report_config->config->nr_cc; + cell_stats->has_flags = 1; + if (cell_stats->n_cell > 0) { + uint32_t *cells; + cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell); + for (i = 0; i < cell_stats->n_cell; i++) { + cells[i] = report_config->config->cc_report_type[i].cc_id; + } + cell_stats->cell = cells; + cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags; + } + stats_request_msg->cell_stats_request = cell_stats; + break; + case PROTOCOL__PRP_STATS_TYPE__PRST_UE_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST; + Protocol__PrpUeStatsRequest *ue_stats; + ue_stats = malloc(sizeof(Protocol__PrpUeStatsRequest)); + if(ue_stats == NULL) + goto error; + protocol__prp_ue_stats_request__init(ue_stats); + ue_stats->n_rnti = report_config->config->nr_ue; + ue_stats->has_flags = 1; + if (ue_stats->n_rnti > 0) { + uint32_t *ues; + ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti); + for (i = 0; i < ue_stats->n_rnti; i++) { + ues[i] = report_config->config->ue_report_type[i].ue_rnti; + } + ue_stats->rnti = ues; + ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags; + } + stats_request_msg->ue_stats_request = ue_stats; + break; + default: + goto error; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->stats_request_msg = stats_request_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (stats_request_msg != NULL) + free(stats_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG) + goto error; + free(msg->stats_request_msg->header); + if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { + free(msg->stats_request_msg->cell_stats_request->cell); + } + if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST) { + free(msg->stats_request_msg->ue_stats_request->rnti); + } + free(msg->stats_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 569eb51e5e..871d6e5ae2 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -69,11 +69,24 @@ typedef struct { cc_report_type_t *cc_report_type; } report_config_t; +typedef struct { + uint8_t report_type; + uint8_t report_frequency; + uint16_t period; /*In number of subframes*/ + report_config_t *config; +} stats_request_config_t; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg); + int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); + + #endif From 3e2adfbcbc8d2e51c364c3573a42def46b528199 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 8 Jan 2016 12:53:34 +0200 Subject: [PATCH 026/182] Fixed bug to allocate memory in the stack instead of dynamically for the timer search key --- openair2/ENB_APP/enb_agent_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0417f4956e..1522cad07d 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -470,10 +470,11 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s *search= calloc(1,sizeof(*search)); - search->timer_id = timer_id; + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); } void enb_agent_sleep_until(struct timespec *ts, int delay) { From 2ef32ad9bc4683016d32906a228ec9bee9c3590e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 8 Jan 2016 15:59:24 +0200 Subject: [PATCH 027/182] Added support for turning off periodical timer tasks --- openair2/ENB_APP/enb_agent.c | 13 ------ openair2/ENB_APP/enb_agent_common.c | 65 +++++++++++++++++++--------- openair2/ENB_APP/enb_agent_common.h | 10 +++-- openair2/ENB_APP/enb_agent_handler.c | 7 ++- openair2/ENB_APP/enb_agent_mac.c | 10 +---- 5 files changed, 59 insertions(+), 46 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index dbefc60502..6fff535590 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -313,19 +313,6 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ return -1; } - - //#ifdef TEST_TIMER - long timer_id=0; - enb_agent_timer_args_t timer_args; - memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); - timer_args.mod_id = mod_id; - //timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; - //timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - //timer_args.ue_actions = ENB_AGENT_ACTION_SEND; - //timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; - enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); - //#endif - //new_thread(send_thread, &shared_ctxt); //while (1) pause(); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1522cad07d..8d9997e746 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -377,6 +377,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, agent_id_t agent_id, instance_t instance, uint32_t timer_type, + xid_t xid, enb_agent_timer_callback_t cb, void* timer_args, long *timer_id){ @@ -424,7 +425,8 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->instance = instance; e->state = ENB_AGENT_TIMER_STATE_ACTIVE; e->timer_id = *timer_id; - // e->timer_args = timer_args; + e->xid = xid; + e->timer_args = timer_args; e->cb = cb; /*element should be a real pointer*/ RB_INSERT(enb_agent_map, &timer_instance.enb_agent_head, e); @@ -440,7 +442,8 @@ err_code_t enb_agent_destroy_timer(long timer_id){ struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, &e); + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + enb_agent_destroy_progran_message(e->timer_args->msg); free(e); } @@ -454,13 +457,35 @@ err_code_t enb_agent_destroy_timer(long timer_id){ return TIMER_REMOVED_FAILED ; } +err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { + struct enb_agent_timer_element_s *e = NULL; + long timer_id; + RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + if (e->xid == xid) { + timer_id = e->timer_id; + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + enb_agent_destroy_progran_message(e->timer_args->msg); + free(e); + if (timer_remove(timer_id) < 0 ) { + goto error; + } + } + } + return 0; + + error: + LOG_E(ENB_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s *e = NULL; RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - timer_remove(e->timer_id); + timer_remove(e->timer_id); + enb_agent_destroy_progran_message(e->timer_args->msg); free(e); } @@ -468,15 +493,6 @@ err_code_t enb_agent_destroy_timers(void){ } -struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); - search.timer_id = timer_id; - - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); -} - void enb_agent_sleep_until(struct timespec *ts, int delay) { ts->tv_nsec += delay; if(ts->tv_nsec >= 1000*1000*1000){ @@ -493,15 +509,15 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { } */ -/* -err_code_t enb_agent_stop_timer(uint32_t timer_id){ + +err_code_t enb_agent_stop_timer(long 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; - } + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + e = RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); if (e != NULL ) { e->state = ENB_AGENT_TIMER_STATE_STOPPED; @@ -510,9 +526,18 @@ err_code_t enb_agent_stop_timer(uint32_t timer_id){ timer_remove(timer_id); return 0; - } +struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { + + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); +} + +/* // this will change the timer_id err_code_t enb_agent_restart_timer(uint32_t *timer_id){ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 31d882d0c9..c2c57ca4ea 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -70,6 +70,8 @@ typedef int (*enb_agent_message_destruction_callback)( int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); + int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); @@ -189,9 +191,11 @@ typedef struct enb_agent_timer_element_s{ 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*/ enb_agent_timer_callback_t cb; - // void* timer_args; + enb_agent_timer_args_t *timer_args; } enb_agent_timer_element_t; @@ -206,12 +210,14 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, agent_id_t agent_id, instance_t instance, uint32_t timer_type, + xid_t xid, enb_agent_timer_callback_t cb, void* timer_args, long *timer_id); err_code_t enb_agent_destroy_timers(void); err_code_t enb_agent_destroy_timer(long timer_id); +err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); err_code_t enb_agent_stop_timer(long timer_id); @@ -219,8 +225,6 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); - - Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2841f9b6e5..02092a84f8 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -54,9 +54,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_hello, enb_agent_destroy_echo_request, enb_agent_destroy_echo_reply, - 0, /*No stats request message is created in the agent. No need for a callback*/ + enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - }; static const char *enb_agent_direction2String[] = { @@ -170,3 +169,7 @@ Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_a LOG_E(ENB_AGENT, "can't get the timer element\n"); return TIMER_ELEMENT_NOT_FOUND; } + +err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg) { + return ((*message_destruction_callback[msg->msg_case-1])(msg)); +} diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 1a21db5e15..411480254f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -71,18 +71,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - /* if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { */ - /* //TODO: Must create a periodic report. Implement once the */ - /* // timer functionality is supported */ - /* *msg = NULL; */ - /* return 0; */ - /* } else */ if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism *msg = NULL; return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { - //TODO: Must implement to deactivate the event based reporting + enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; } else { //One-off or periodical reporting @@ -141,7 +135,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr sec_interval = usec_interval/(1000*1000); usec_interval = usec_interval%(1000*1000); } - enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); } } break; From a9a67824dd8c7f343bf25bed72710a2f8bc28df8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 11 Jan 2016 14:58:31 +0200 Subject: [PATCH 028/182] Added API functions for eNB agent - technology interaction --- openair2/ENB_APP/enb_agent_mac.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 871d6e5ae2..11e981a51b 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -88,5 +88,19 @@ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *re int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +/********************************** + * eNB agent - technology mac API + **********************************/ + +/*Set DCI for particular RNTI in defined subframe (UL/DL)*/ +int enb_agent_mac_dl_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +int enb_agent_mac_ul_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +/*Push controller configurations to the eNB for cells and UEs*/ +int enb_agent_set_cell_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +int enb_agent_set_ue_config(mid_t mod_id, Protocol__ProgranMessage *msg); + #endif From 3ce2ba4e5d19cda16176981304d0b2f69cdb1300 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 14:24:31 +0200 Subject: [PATCH 029/182] Added support for scheduling requests messages --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 995cd6861b..53718b87c4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -12,6 +12,7 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; + prp_ul_sr_info ul_sr_info_msg = 6; } } @@ -82,6 +83,15 @@ message prp_stats_reply { repeated prp_cell_stats_report cell_report = 3; } +// +// Asynchronous messages +// + +message prp_ul_sr_info { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated uint32 rnti = 3; +} // Extensions of the echo request and reply // messages for carrying a latency value in ms From a8dabcefea873ab7f7374b292d8a55516af29971 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 17:58:09 +0200 Subject: [PATCH 030/182] Added support for UL SR info type in the header of progRAN messages --- openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index b2319c8220..5670b9bd77 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -15,5 +15,8 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; + + //Asynchronous messages + PRPT_UL_SR_INFO = 5; } From 694a5bb1b5a03339143ced6bee734ce544ef4dd2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 18:02:07 +0200 Subject: [PATCH 031/182] Changed the function signature for handling the packing of protocol messages --- openair2/ENB_APP/enb_agent.c | 6 ++++-- openair2/ENB_APP/enb_agent_common.h | 13 ++++++++----- openair2/ENB_APP/enb_agent_handler.c | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 6fff535590..d3e74348f8 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -38,6 +38,8 @@ #include "log.h" #include "enb_agent.h" +#include "enb_agent_extern.h" + #include "assertions.h" //#define TEST_TIMER @@ -95,7 +97,7 @@ void *enb_agent_task(void *args){ case TIMER_HAS_EXPIRED: msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ - data=enb_agent_send_message(msg,&size); + data=enb_agent_pack_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; @@ -182,7 +184,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ - data=enb_agent_send_message(msg,&size); + data=enb_agent_pack_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index c2c57ca4ea..f4add1ae2e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -67,9 +67,17 @@ typedef int (*enb_agent_message_destruction_callback)( Protocol__ProgranMessage *msg ); +/********************************** + * progRAN protocol messages helper + * functions and generic handlers + **********************************/ + int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +void * enb_agent_pack_message(Protocol__ProgranMessage *msg, + uint32_t * size); + err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); @@ -90,11 +98,6 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); -void * enb_agent_send_message(Protocol__ProgranMessage *msg, - uint32_t * size); - - - diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 02092a84f8..0f5146fe6d 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -56,6 +56,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, + enb_agent_mac_destroy_sr_info, }; static const char *enb_agent_direction2String[] = { @@ -108,7 +109,7 @@ error: -void * enb_agent_send_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__ProgranMessage *msg, uint32_t * size){ void * buffer; From 22d0f60e126b359aa348a062f53a5fcdc0f50bae Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 18:08:57 +0200 Subject: [PATCH 032/182] Added support for creation of SR protocol messages and defined initial MAC-Agent interface --- openair2/ENB_APP/enb_agent_extern.h | 50 +++++++++++ openair2/ENB_APP/enb_agent_mac.c | 121 ++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_mac.h | 21 +++-- openair2/ENB_APP/enb_agent_mac_defs.h | 54 ++++++++++++ 4 files changed, 238 insertions(+), 8 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_extern.h create mode 100644 openair2/ENB_APP/enb_agent_mac_defs.h diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h new file mode 100644 index 0000000000..2cd072f25a --- /dev/null +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -0,0 +1,50 @@ +/******************************************************************************* + 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 . + + 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_APP/extern.h + * \brief enb agent - mac interface primitives + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + * \mail x.foukas@sms.ed.ac.uk + */ + +#ifndef __ENB_AGENT_EXTERN_H__ +#define __ENB_AGENT_EXTERN_H__ + +#include "enb_agent_defs.h" +#include "enb_agent_mac_defs.h" + +extern msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; + +extern AGENT_MAC_xface *agent_mac_xface; + +extern unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; + +#endif diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 411480254f..36b7788d23 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -760,3 +760,124 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } + +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_SR_INFO, &header) != 0) + goto error; + + Protocol__PrpUlSrInfo *ul_sr_info_msg; + ul_sr_info_msg = malloc(sizeof(Protocol__PrpUlSrInfo)); + if (ul_sr_info_msg == NULL) { + goto error; + } + protocol__prp_ul_sr_info__init(ul_sr_info_msg); + + ul_sr_info_msg->header = header; + ul_sr_info_msg->has_sfn_sf = 1; + ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); + /*TODO: Set the number of UEs that sent an SR */ + ul_sr_info_msg->n_rnti = 1; + ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t)); + + if(ul_sr_info_msg->rnti == NULL) { + goto error; + } + /*TODO:Set the rnti of the UEs that sent an SR */ + for (i = 0; i < ul_sr_info_msg->n_rnti; i++) { + ul_sr_info_msg->rnti[i] = 1; + } + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->ul_sr_info_msg = ul_sr_info_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ul_sr_info_msg != NULL) { + free(ul_sr_info_msg->rnti); + free(ul_sr_info_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG) + goto error; + + free(msg->ul_sr_info_msg->header); + free(msg->ul_sr_info_msg->rnti); + free(msg->ul_sr_info_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + int xid = 1; + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + + if (message_put(context->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send sr message\n"); +} + +int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { + if (!mac_agent_registered[mod_id]) { + LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); + return -1; + } + + xface->agent_ctxt = &shared_ctxt[mod_id]; + xface->enb_agent_send_sr_info = enb_agent_send_sr_info; + + mac_agent_registered[mod_id] = 1; + return 1; +} + +int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { + + if(mac_agent_registered[mod_id]) { + LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); + return -1; + } + + xface->agent_ctxt = NULL; + xface->enb_agent_send_sr_info = NULL; + + mac_agent_registered[mod_id] = NULL; + return 1; +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 11e981a51b..7945082410 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -43,7 +43,10 @@ #include "stats_common.pb-c.h" #include "enb_agent_common.h" +#include "enb_agent_extern.h" +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; /* These types will be used to give instructions for the type of stats reports @@ -87,20 +90,22 @@ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *re int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API **********************************/ -/*Set DCI for particular RNTI in defined subframe (UL/DL)*/ -int enb_agent_mac_dl_config(mid_t mod_id, Protocol__ProgranMessage *msg); +/*Inform controller about received scheduling requests during a subframe*/ +void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); -int enb_agent_mac_ul_config(mid_t mod_id, Protocol__ProgranMessage *msg); - -/*Push controller configurations to the eNB for cells and UEs*/ -int enb_agent_set_cell_config(mid_t mod_id, Protocol__ProgranMessage *msg); - -int enb_agent_set_ue_config(mid_t mod_id, Protocol__ProgranMessage *msg); +/*Register technology specific interface callbacks*/ +int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); +/*Unregister technology specific callbacks*/ +int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h new file mode 100644 index 0000000000..28a424706b --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -0,0 +1,54 @@ +/******************************************************************************* + 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 . + + 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_mac_defs.h + * \brief enb agent - mac interface primitives + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + * \mail x.foukas@sms.ed.ac.uk + */ + +#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__ +#define __ENB_AGENT_MAC_PRIMITIVES_H__ + +#include "enb_agent_defs.h" + +/* ENB AGENT-MAC Interface */ +typedef struct { + msg_context_t *agent_ctxt; + + /// Inform the controller about the scheduling requests received during the subframe + void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ + +} AGENT_MAC_xface; + +#endif From dbcf482f07284a547400b835d37e5cd8256c1c44 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 17:46:06 +0200 Subject: [PATCH 033/182] Added eNB agent abstract network interface support --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_net_comm.c | 196 ++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_net_comm.h | 90 ++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_net_comm.c create mode 100644 openair2/ENB_APP/enb_agent_net_comm.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0777e1f3a0..8cd37613fa 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -747,6 +747,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c new file mode 100644 index 0000000000..096779f261 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -0,0 +1,196 @@ +/******************************************************************************* + 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 . + + 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 "enb_agent_net_comm.h" +#include "log.h" + +enb_agent_channel_t *agent_channel[ENB_AGENT_MAX]; +enb_agent_channel_instance_t channel_instance; +int enb_agent_channel_id = 0; + +int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + enb_agent_channel_t *channel; + channel = agent_channel[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(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + enb_agent_channel_t *channel; + channel = agent_channel[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(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int enb_agent_register_channel(enb_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[i] = channel; + } + } else { + agent_channel[agent_id] = channel; + } + return 0; +} + +void enb_agent_unregister_channel(agent_id_t agent_id) { + int i; + + if (agent_id == ENB_AGENT_MAX) { + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[i] = NULL; + } + } else { + agent_channel[agent_id] = NULL; + } +} + +int enb_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)(enb_agent_channel_t *channel)) { + + int channel_id = ++enb_agent_channel_id; + enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_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(enb_agent_channel_map, &channel_instance.enb_agent_head, channel); + + LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + + return channel_id; +} + +int enb_agent_destroy_channel(int channel_id) { + int i; + + /*Check to see if channel exists*/ + struct enb_agent_channel_s *e = NULL; + struct enb_agent_channel_s search; + memset(&search, 0, sizeof(struct enb_agent_channel_s)); + + e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + + if (e == NULL) { + return -1; + } + + /*Unregister the channel from all agents*/ + for (i = 0; i < ENB_AGENT_MAX; i++) { + if (agent_channel[i] != NULL) { + if (agent_channel[i]->channel_id == e->channel_id) { + agent_channel[i] == NULL; + } + } + } + + /*Remove the channel from the tree and free memory*/ + RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e); + e->release(e); + free(e); + + return 0; +} + +err_code_t enb_agent_init_channel_container(void) { + int i; + LOG_I(ENB_AGENT, "init RB tree for channel container\n"); + + RB_INIT(&channel_instance.enb_agent_head); + + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[i] == NULL; + } + + return 0; +} + +RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel); + +int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_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; +} + +enb_agent_channel_t * get_channel(int channel_id) { + + struct enb_agent_channel_s search; + memset(&search, 0, sizeof(struct enb_agent_channel_s)); + search.channel_id = channel_id; + + return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + +} diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h new file mode 100644 index 0000000000..50237379d4 --- /dev/null +++ b/openair2/ENB_APP/enb_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 . + + 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 ENB_AGENT_NET_COMM_H_ +#define ENB_AGENT_NET_COMM_H_ + +#include "enb_agent_defs.h" + +#include "tree.h" + +/*Channel related information used for Tx/Rx of protocol messages*/ +typedef struct enb_agent_channel_s { + RB_ENTRY(enb_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 enb_agent_channel_s *channel); +} enb_agent_channel_t; + +typedef struct enb_agent_channel_instance_s{ + RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head; +} enb_agent_channel_instance_t; + +/*Send and receive messages using the channel registered for a specific agent*/ +int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id); + +int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id); + +/*Register a channel to an agent. Use ENB_AGENT_MAX to register the + *same channel to all agents*/ +int enb_agent_register_channel(enb_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 enb_agent_unregister_channel(agent_id_t agent_id); + +/*Create a new channel. Returns the id of the new channel or negative number otherwise*/ +int enb_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)(enb_agent_channel_t *channel)); + +/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ +int enb_agent_destroy_channel(int channel_id); + +/*Return an agent communication channel based on its id*/ +enb_agent_channel_t * get_channel(int channel_id); + +/*Should be called before performing any channel operations*/ +err_code_t enb_agent_init_channel_container(void); + +int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b); + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel); + +#endif /*ENB_AGENT_COMM_H_*/ From e6762ffe1fbade7087bea5031b09814f97a94e13 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 19:10:27 +0200 Subject: [PATCH 034/182] Added support for multiple eNBs in an emulation environment --- openair2/ENB_APP/enb_agent_net_comm.c | 44 +++++++++++++++------------ openair2/ENB_APP/enb_agent_net_comm.h | 8 ++--- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c index 096779f261..5c4544ad63 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -37,17 +37,17 @@ #include "enb_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[ENB_AGENT_MAX]; +enb_agent_channel_t *agent_channel[NUM_MAX_ENB_AGENT][ENB_AGENT_MAX]; enb_agent_channel_instance_t channel_instance; int enb_agent_channel_id = 0; -int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) { +int enb_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; } enb_agent_channel_t *channel; - channel = agent_channel[agent_id]; + channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -61,13 +61,13 @@ int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) return -1; } -int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id) { +int enb_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; } enb_agent_channel_t *channel; - channel = agent_channel[agent_id]; + channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -81,7 +81,7 @@ int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_i return -1; } -int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id) { +int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) { int i; if (channel == NULL) { @@ -90,23 +90,23 @@ int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id if (agent_id == ENB_AGENT_MAX) { for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[i] = channel; + agent_channel[mod_id][i] = channel; } } else { - agent_channel[agent_id] = channel; + agent_channel[mod_id][agent_id] = channel; } return 0; } -void enb_agent_unregister_channel(agent_id_t agent_id) { +void enb_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[i] = NULL; + agent_channel[mod_id][i] = NULL; } } else { - agent_channel[agent_id] = NULL; + agent_channel[mod_id][agent_id] = NULL; } } @@ -132,7 +132,7 @@ int enb_agent_create_channel(void *channel_info, } int enb_agent_destroy_channel(int channel_id) { - int i; + int i, j; /*Check to see if channel exists*/ struct enb_agent_channel_s *e = NULL; @@ -146,10 +146,12 @@ int enb_agent_destroy_channel(int channel_id) { } /*Unregister the channel from all agents*/ - for (i = 0; i < ENB_AGENT_MAX; i++) { - if (agent_channel[i] != NULL) { - if (agent_channel[i]->channel_id == e->channel_id) { - agent_channel[i] == NULL; + for (i = 0; i < NUM_MAX_ENB_AGENT; 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; + } } } } @@ -163,13 +165,15 @@ int enb_agent_destroy_channel(int channel_id) { } err_code_t enb_agent_init_channel_container(void) { - int i; + int i, j; LOG_I(ENB_AGENT, "init RB tree for channel container\n"); RB_INIT(&channel_instance.enb_agent_head); - - for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[i] == NULL; + + for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (j = 0; j < ENB_AGENT_MAX; j++) { + agent_channel[i][j] == NULL; + } } return 0; diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h index 50237379d4..ab42bdc34f 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/enb_agent_net_comm.h @@ -56,16 +56,16 @@ typedef struct enb_agent_channel_instance_s{ } enb_agent_channel_instance_t; /*Send and receive messages using the channel registered for a specific agent*/ -int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id); +int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id); +int enb_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 enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id); +int enb_agent_register_channel(mid_t mod_id, enb_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 enb_agent_unregister_channel(agent_id_t agent_id); +void enb_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 enb_agent_create_channel(void *channel_info, From 8fde111b93ba7c6736758300ef4df4d8ba8e18cb Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 19:49:02 +0200 Subject: [PATCH 035/182] Channel implementation for async interface --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_async.c | 107 +++++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_async.h | 51 ++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_async.c create mode 100644 openair2/ENB_APP/enb_agent_async.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8cd37613fa..56ee7b71d3 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -748,6 +748,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c new file mode 100644 index 0000000000..962e1a81ed --- /dev/null +++ b/openair2/ENB_APP/enb_agent_async.c @@ -0,0 +1,107 @@ +/******************************************************************************* + 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 . + + 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 "enb_agent_async.h" +#include "enb_agent_defs.h" + +#include "log.h" + +enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { + + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *) malloc(sizeof(enb_agent_instance_t)); + + if (channel == NULL) + goto error; + + channel->mod_id = mod_id; + /*Create a socket*/ + channel->link = new_link_client(dst_ip, dst_port); + if (channel->link == NULL) goto error; + + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + channel->mod_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(ENB_AGENT,"there was an error\n"); + return 1; +} + +int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *)channel_info; + + return message_put(channel->send_queue, data, size, priority); +} + +int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *)channel_info; + + return message_get(channel->receive_queue, data, size, priority); +} + +void enb_agent_async_release(enb_agent_channel_t *channel) { + enb_agent_instance_t *channel_info; + channel_info = (enb_agent_instance_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/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h new file mode 100644 index 0000000000..53614cc87d --- /dev/null +++ b/openair2/ENB_APP/enb_agent_async.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 . + + 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 ENB_AGENT_ASYNC_H_ +#define ENB_AGENT_ASYNC_H_ + +#include "enb_agent_net_comm.h" + +enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); + +int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); + +int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); + +void enb_agent_async_release(enb_agent_channel_t *channel); + + +#endif /*ENB_AGENT_ASYNC_H_*/ From ed7e13c6ebf0bdfb95bc3951d512e76cb6d0fef3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 14:31:21 +0200 Subject: [PATCH 036/182] Integrated abstract network communication in main agent --- openair2/ENB_APP/enb_agent.c | 169 ++++++++++++++++-------------- openair2/ENB_APP/enb_agent_defs.h | 4 +- openair2/ENB_APP/enb_agent_mac.c | 12 ++- 3 files changed, 98 insertions(+), 87 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index d3e74348f8..fa24cacf8a 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -42,6 +42,9 @@ #include "assertions.h" +#include "enb_agent_net_comm.h" +#include "enb_agent_async.h" + //#define TEST_TIMER enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; @@ -98,10 +101,15 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (message_put(d->tx_mq, data, size, priority)){ + if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(d->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } break; @@ -121,42 +129,6 @@ void *enb_agent_task(void *args){ return NULL; } -/* void *send_thread(void *args) { */ - -/* #ifdef TEST_TIMER */ - -/* msg_context_t *d = args; */ -/* void *data; */ -/* int size; */ -/* int priority; */ - -/* struct timeval t1, t2; */ -/* long long t; */ -/* struct timespec ts; */ -/* unsigned int delay = 250*1000; */ -/* while(1) { */ -/* gettimeofday(&t1, NULL); */ -/* enb_agent_sleep_until(&ts, delay); */ -/* gettimeofday(&t2, NULL); */ -/* t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); */ -/* LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); */ -/* sleep(1); */ -/* } */ - -/* #endif */ -/* /\* while (1) { */ -/* // need logic for the timer, and */ -/* usleep(10); */ -/* if (message_put(d->tx_mq, data, size, priority)) goto error; */ -/* }*\/ */ - -/* return NULL; */ - -/* error: */ -/* printf("receive_thread: there was an error\n"); */ -/* return NULL; */ -/* } */ - void *receive_thread(void *args) { msg_context_t *d = args; @@ -168,10 +140,15 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (message_get(d->rx_mq, &data, &size, &priority)){ + if (enb_agent_msg_recv(d->mod_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } + + /* if (message_get(d->rx_mq, &data, &size, &priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"received message with size %d\n", size); @@ -186,10 +163,15 @@ void *receive_thread(void *args) { if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (message_put(d->tx_mq, data, size, priority)){ + if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(d->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } @@ -229,7 +211,9 @@ pthread_t new_thread(void *(*f)(void *), void *b) { } int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ - + + int channel_id; + // set_enb_vars(mod_id, RAN_LTE_OAI); enb_agent[mod_id].mod_id = mod_id; @@ -255,48 +239,78 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ in_ip, in_port); - //#define TEST_TIMER 0 -#if !defined TEST_TIMER + /* + * Initialize the channel container + */ + enb_agent_init_channel_container(); - /* - * create a socket - */ - enb_agent[mod_id].link = new_link_client(in_ip, in_port); - if (enb_agent[mod_id].link == NULL) goto error; - - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].mod_id, - in_ip, - in_port); - /* - * create a message queue - */ - - enb_agent[mod_id].send_queue = new_message_queue(); - if (enb_agent[mod_id].send_queue == NULL) goto error; - enb_agent[mod_id].receive_queue = new_message_queue(); - if (enb_agent[mod_id].receive_queue == NULL) goto error; - - /* - * create a link manager - */ - - enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); - if (enb_agent[mod_id].manager == NULL) goto error; + /*Create the async channel info*/ + enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); + + /*Create a channel using the async channel info*/ + channel_id = enb_agent_create_channel((void *) channel_info, + enb_agent_async_msg_send, + enb_agent_async_msg_recv, + enb_agent_async_release); - memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt[mod_id].mod_id = mod_id; - shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; - shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; + if (channel_id <= 0) { + goto error; + } + + enb_agent_channel_t *channel = get_channel(channel_id); + + if (channel == NULL) { + goto error; + } + + /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ + enb_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); + */ + + /* /\* */ + /* * create a socket */ + /* *\/ */ + /* enb_agent[mod_id].link = new_link_client(in_ip, in_port); */ + /* if (enb_agent[mod_id].link == NULL) goto error; */ + + /* LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", */ + /* enb_agent[mod_id].mod_id, */ + /* in_ip, */ + /* in_port); */ + /* /\* */ + /* * create a message queue */ + /* *\/ */ + + /* enb_agent[mod_id].send_queue = new_message_queue(); */ + /* if (enb_agent[mod_id].send_queue == NULL) goto error; */ + /* enb_agent[mod_id].receive_queue = new_message_queue(); */ + /* if (enb_agent[mod_id].receive_queue == NULL) goto error; */ + + /* /\* */ + /* * create a link manager */ + /* *\/ */ + + /* enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); */ + /* if (enb_agent[mod_id].manager == NULL) goto error; */ + + /* memset(&shared_ctxt, 0, sizeof(msg_context_t)); */ + + /* shared_ctxt[mod_id].mod_id = mod_id; */ + /* shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; */ + /* shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; */ /* * start the enb agent rx thread */ + memset(&shared_ctxt, 0, sizeof(msg_context_t)); + shared_ctxt[mod_id].mod_id = mod_id; + new_thread(receive_thread, &shared_ctxt[mod_id]); - -#endif /* * initilize a timer @@ -304,8 +318,6 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_init_timer(); - - /* * start the enb agent task for tx and interaction with the underlying network function */ @@ -313,12 +325,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; - } - - //new_thread(send_thread, &shared_ctxt); - - //while (1) pause(); - + } LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 416e61a431..e7ffe60c3f 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -133,8 +133,8 @@ typedef struct { typedef struct { mid_t mod_id; - message_queue_t *tx_mq; - message_queue_t *rx_mq; + // message_queue_t *tx_mq; + // message_queue_t *rx_mq; xid_t tx_xid; xid_t rx_xid; } msg_context_t; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 36b7788d23..41a3ff6a3b 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -836,19 +836,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { err_code_t err_code; /*TODO: Must use a proper xid*/ - int xid = 1; - err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); if (err_code < 0) { goto error; } if (msg != NULL){ data=enb_agent_pack_message(msg, &size); - - if (message_put(context->tx_mq, data, size, priority)){ + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(context->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: From 2fbe01e15fd2c020f6a448d20db16db16c5d2808 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 16:38:37 +0200 Subject: [PATCH 037/182] Added support for timing messages in DL/UL --- cmake_targets/CMakeLists.txt | 2 ++ openair2/ENB_APP/MESSAGES/V2/header.proto | 6 +++- openair2/ENB_APP/MESSAGES/V2/progran.proto | 21 +++++++++++++- .../ENB_APP/MESSAGES/V2/time_common.proto | 29 +++++++++++++++++++ openair2/ENB_APP/enb_agent_handler.c | 5 ++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/time_common.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 56ee7b71d3..a040013e56 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -709,6 +709,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/progran.proto ${PRPT_MSG_DIR}/stats_common.proto ${PRPT_MSG_DIR}/stats_messages.proto + ${PRPT_MSG_DIR}/time_common.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -720,6 +721,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/progran.pb-c.c ${PRPT_C_DIR}/stats_common.pb-c.c ${PRPT_C_DIR}/stats_messages.pb-c.c + ${PRPT_C_DIR}/time_common.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 5670b9bd77..7130f8448c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -15,8 +15,12 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; + + // Time indication messages + PRPT_DL_TRIGGER = 5; + PRPT_UL_TRIGGER = 6; //Asynchronous messages - PRPT_UL_SR_INFO = 5; + PRPT_UL_SR_INFO = 7; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 53718b87c4..314678b1d6 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -3,6 +3,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; +import "time_common.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -12,7 +13,9 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; - prp_ul_sr_info ul_sr_info_msg = 6; + prp_dl_trigger dl_trigger_msg = 6; + prp_ul_trigger ul_trigger_msg = 7; + prp_ul_sr_info ul_sr_info_msg = 8; } } @@ -83,6 +86,22 @@ message prp_stats_reply { repeated prp_cell_stats_report cell_report = 3; } +// +// Time indication messages +// + +message prp_dl_trigger { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_dl_info dl_info = 3; +} + +message prp_ul_trigger { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_ul_info ul_info = 3; +} + // // Asynchronous messages // diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto new file mode 100644 index 0000000000..4c3ac4911e --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/time_common.proto @@ -0,0 +1,29 @@ +package protocol; + +enum prp_harq_status { + PRHS_ACK = 0; + PRHS_NACK = 1; + PRHS_DTX = 2; +} + +enum prp_reception_status { + PRRS_OK = 0; + PRRS_NOT_OK = 1; + PRRS_NOT_VALID = 2; +} + +message prp_dl_info { + optional uint32 rnti = 1; + optional uint32 harq_process_id = 2; + repeated uint32 harq_status = 3; + optional uint32 serv_cell_index = 4; +} + +message prp_ul_info { + optional uint32 rnti = 1; + repeated uint32 ul_reception = 2; + optional uint32 reception_status = 3; + optional uint32 tpc = 4; + optional uint32 serv_cell_index = 5; +} + diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 0f5146fe6d..62b026e63b 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -47,6 +47,9 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0,0,0}, /*DL_TRIGGER*/ + {0,0,0}, /*UL_TRIGGER*/ + {0,0,0}, /*SR_INFO*/ }; @@ -56,6 +59,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, + 0, + 0, enb_agent_mac_destroy_sr_info, }; From 5cec297209a9253f0a342e38778c99e94af50060 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 18:07:42 +0200 Subject: [PATCH 038/182] Implemented handlers for the UL/DL trigger messages --- openair2/ENB_APP/enb_agent_handler.c | 4 +- openair2/ENB_APP/enb_agent_mac.c | 261 +++++++++++++++++++++++++- openair2/ENB_APP/enb_agent_mac.h | 13 ++ openair2/ENB_APP/enb_agent_mac_defs.h | 4 + 4 files changed, 276 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 62b026e63b..4a936ff3db 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -59,8 +59,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - 0, - 0, + enb_agent_mac_destroy_dl_trigger, + enb_agent_mac_destroy_ul_trigger, enb_agent_mac_destroy_sr_info, }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 41a3ff6a3b..194d8c96b8 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -828,6 +828,209 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i,j; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_TRIGGER, &header) != 0) + goto error; + + Protocol__PrpDlTrigger *dl_trigger_msg; + dl_trigger_msg = malloc(sizeof(Protocol__PrpDlTrigger)); + if (dl_trigger_msg == NULL) { + goto error; + } + protocol__prp_dl_trigger__init(dl_trigger_msg); + + dl_trigger_msg->header = header; + dl_trigger_msg->has_sfn_sf = 1; + dl_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + + /*TODO: Fill in the number of dl HARQ related info, based on the number of currently + *transmitting UEs + */ + dl_trigger_msg->n_dl_info = get_num_ues(mod_id); + + Protocol__PrpDlInfo **dl_info = NULL; + + if (dl_trigger_msg->n_dl_info > 0) { + dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * dl_trigger_msg->n_dl_info); + if(dl_info == NULL) + goto error; + //Fill the status of the current HARQ process for each UE + for(i = 0; i++; i < dl_trigger_msg->n_dl_info) { + dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); + if(dl_info[i] == NULL) + goto error; + protocol__prp_dl_info__init(dl_info[i]); + dl_info[i]->rnti = get_ue_crnti(mod_id, i); + dl_info[i]->has_rnti = 1; + /*TODO: fill in the right id of this round's HARQ process for this UE*/ + dl_info[i]->harq_process_id = 1; + dl_info[i]->has_harq_process_id = 1; + /*TODO: fill in the status of the HARQ process (2 TBs)*/ + dl_info[i]->n_harq_status = 2; + dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); + for (j = 0; j < dl_info[j]->n_harq_status; j++) { + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + } + /*TODO: fill in the serving cell index for this UE */ + dl_info[i]->serv_cell_index = 0; + dl_info[i]->has_serv_cell_index = 1; + } + } + + dl_trigger_msg->dl_info = dl_info; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->dl_trigger_msg = dl_trigger_msg; + return 0; + + error: + if (header != NULL) + free(header); + if (dl_trigger_msg != NULL) { + for (i = 0; i < dl_trigger_msg->n_dl_info; i++) { + free(dl_trigger_msg->dl_info[i]->harq_status); + } + free(dl_trigger_msg->dl_info); + free(dl_trigger_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg) { + int i; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG) + goto error; + + free(msg->dl_trigger_msg->header); + for (i = 0; i < msg->dl_trigger_msg->n_dl_info; i++) { + free(msg->dl_trigger_msg->dl_info[i]->harq_status); + } + free(msg->dl_trigger_msg->dl_info); + free(msg->dl_trigger_msg); + free(msg); + + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i,j; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_TRIGGER, &header) != 0) + goto error; + + Protocol__PrpUlTrigger *ul_trigger_msg; + ul_trigger_msg = malloc(sizeof(Protocol__PrpUlTrigger)); + if (ul_trigger_msg == NULL) { + goto error; + } + protocol__prp_ul_trigger__init(ul_trigger_msg); + + ul_trigger_msg->header = header; + ul_trigger_msg->has_sfn_sf = 1; + /*TODO: Must fix this to get the proper subframe number*/ + ul_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + + /*TODO: Fill in the number of UL reception status related info, based on the number of currently + *transmitting UEs + */ + ul_trigger_msg->n_ul_info = get_num_ues(mod_id); + + Protocol__PrpUlInfo **ul_info = NULL; + + if (ul_trigger_msg->n_ul_info > 0) { + ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * ul_trigger_msg->n_ul_info); + if(ul_info == NULL) + goto error; + //Fill the reception info for each transmitting UE + for(i = 0; i++; i < ul_trigger_msg->n_ul_info) { + ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); + if(ul_info[i] == NULL) + goto error; + protocol__prp_ul_info__init(ul_info[i]); + ul_info[i]->rnti = get_ue_crnti(mod_id, i); + ul_info[i]->has_rnti = 1; + /*TODO: fill in the Tx power control command for this UE (if available)*/ + ul_info[i]->tpc = 1; + ul_info[i]->has_tpc = 0; + /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the + given logical channel*/ + ul_info[i]->n_ul_reception = 11; + ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); + for (j = 0; j < ul_info[j]->n_ul_reception; j++) { + ul_info[i]->ul_reception[j] = 100; + } + /*TODO: Fill in the reception status for each UEs data*/ + ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; + ul_info[i]->has_reception_status = 1; + /*TODO: fill in the serving cell index for this UE */ + ul_info[i]->serv_cell_index = 0; + ul_info[i]->has_serv_cell_index = 1; + } + } + + ul_trigger_msg->ul_info = ul_info; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->ul_trigger_msg = ul_trigger_msg; + return 0; + + error: + if (header != NULL) + free(header); + if (ul_trigger_msg != NULL) { + for (i = 0; i < ul_trigger_msg->n_ul_info; i++) { + free(ul_trigger_msg->ul_info[i]->reception_status); + } + free(ul_trigger_msg->ul_info); + free(ul_trigger_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg) { + int i; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG) + goto error; + + free(msg->ul_trigger_msg->header); + for (i = 0; i < msg->ul_trigger_msg->n_ul_info; i++) { + free(msg->ul_trigger_msg->ul_info[i]->reception_status); + } + free(msg->ul_trigger_msg->ul_info); + free(msg->ul_trigger_msg); + free(msg); + + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { int size; Protocol__ProgranMessage *msg; @@ -849,16 +1052,66 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { goto error; } - /* if (message_put(context->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } +void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + err_code = enb_agent_mac_dl_trigger(mod_id, (void *) &(context->tx_xid), &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send dl trigger message\n"); +} + +void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + err_code = enb_agent_mac_ul_trigger(mod_id, (void *) &(context->tx_xid), &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send ul trigger message\n"); +} + int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { if (!mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 7945082410..18a91716b0 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,6 +94,14 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); +int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg); + +int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API @@ -102,6 +110,11 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); /*Inform controller about received scheduling requests during a subframe*/ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); +/*Inform the controller about the current UL/DL subframe*/ +void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context); + +void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context); + /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 28a424706b..14d149f40c 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -46,6 +46,10 @@ typedef struct { /// Inform the controller about the scheduling requests received during the subframe void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + + /// Inform the controller about the current UL/DL subframe + void (*enb_agent_send_dl_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_ul_trigger)(mid_t mod_id, msg_context_t *context); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ From 876d9eac5214e3ad954d3ac075f64bced0785f5a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 10:12:48 +0000 Subject: [PATCH 039/182] Fixed bug when creating cell report stats reply --- openair2/ENB_APP/enb_agent_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 194d8c96b8..d13f7fa63a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -595,7 +595,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Fill in the Cell reports for (i = 0; i < report_config->nr_cc; i++) { cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); - if(ue_report[i] == NULL) + if(cell_report[i] == NULL) goto error; protocol__prp_cell_stats_report__init(cell_report[i]); cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; From 1f520630658f071c32b89b13cfd126cdeea0a002 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 11:11:05 +0000 Subject: [PATCH 040/182] Merged UL/DL trigger messages to a single SF trigger message --- openair2/ENB_APP/MESSAGES/V2/header.proto | 5 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 14 +- openair2/ENB_APP/enb_agent_handler.c | 6 +- openair2/ENB_APP/enb_agent_mac.c | 177 ++++++--------------- openair2/ENB_APP/enb_agent_mac.h | 12 +- openair2/ENB_APP/enb_agent_mac_defs.h | 3 +- 6 files changed, 60 insertions(+), 157 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 7130f8448c..8534d2f304 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -17,10 +17,9 @@ enum prp_type { PRPT_STATS_REPLY = 4; // Time indication messages - PRPT_DL_TRIGGER = 5; - PRPT_UL_TRIGGER = 6; + PRPT_SF_TRIGGER = 5; //Asynchronous messages - PRPT_UL_SR_INFO = 7; + PRPT_UL_SR_INFO = 6; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 314678b1d6..730726aab4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -13,9 +13,8 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; - prp_dl_trigger dl_trigger_msg = 6; - prp_ul_trigger ul_trigger_msg = 7; - prp_ul_sr_info ul_sr_info_msg = 8; + prp_sf_trigger sf_trigger_msg = 6; + prp_ul_sr_info ul_sr_info_msg = 7; } } @@ -90,16 +89,11 @@ message prp_stats_reply { // Time indication messages // -message prp_dl_trigger { +message prp_sf_trigger { optional prp_header header = 1; optional uint32 sfn_sf = 2; repeated prp_dl_info dl_info = 3; -} - -message prp_ul_trigger { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_ul_info ul_info = 3; + repeated prp_ul_info ul_info = 4; } // diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 4a936ff3db..7b63227d7e 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -47,8 +47,7 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0,0,0}, /*DL_TRIGGER*/ - {0,0,0}, /*UL_TRIGGER*/ + {0,0,0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ {0,0,0}, /*SR_INFO*/ }; @@ -59,8 +58,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - enb_agent_mac_destroy_dl_trigger, - enb_agent_mac_destroy_ul_trigger, + enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d13f7fa63a..34423ee01a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -828,37 +828,37 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i,j; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_TRIGGER, &header) != 0) + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_SF_TRIGGER, &header) != 0) goto error; - Protocol__PrpDlTrigger *dl_trigger_msg; - dl_trigger_msg = malloc(sizeof(Protocol__PrpDlTrigger)); - if (dl_trigger_msg == NULL) { + Protocol__PrpSfTrigger *sf_trigger_msg; + sf_trigger_msg = malloc(sizeof(Protocol__PrpSfTrigger)); + if (sf_trigger_msg == NULL) { goto error; } - protocol__prp_dl_trigger__init(dl_trigger_msg); + protocol__prp_sf_trigger__init(sf_trigger_msg); - dl_trigger_msg->header = header; - dl_trigger_msg->has_sfn_sf = 1; - dl_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + sf_trigger_msg->header = header; + sf_trigger_msg->has_sfn_sf = 1; + sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs */ - dl_trigger_msg->n_dl_info = get_num_ues(mod_id); + sf_trigger_msg->n_dl_info = get_num_ues(mod_id); Protocol__PrpDlInfo **dl_info = NULL; - if (dl_trigger_msg->n_dl_info > 0) { - dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * dl_trigger_msg->n_dl_info); + if (sf_trigger_msg->n_dl_info > 0) { + dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * sf_trigger_msg->n_dl_info); if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE - for(i = 0; i++; i < dl_trigger_msg->n_dl_info) { + for(i = 0; i++; i < sf_trigger_msg->n_dl_info) { dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); if(dl_info[i] == NULL) goto error; @@ -880,85 +880,21 @@ int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__Progran } } - dl_trigger_msg->dl_info = dl_info; - - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if(*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->dl_trigger_msg = dl_trigger_msg; - return 0; - - error: - if (header != NULL) - free(header); - if (dl_trigger_msg != NULL) { - for (i = 0; i < dl_trigger_msg->n_dl_info; i++) { - free(dl_trigger_msg->dl_info[i]->harq_status); - } - free(dl_trigger_msg->dl_info); - free(dl_trigger_msg); - } - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} + sf_trigger_msg->dl_info = dl_info; -int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg) { - int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG) - goto error; - - free(msg->dl_trigger_msg->header); - for (i = 0; i < msg->dl_trigger_msg->n_dl_info; i++) { - free(msg->dl_trigger_msg->dl_info[i]->harq_status); - } - free(msg->dl_trigger_msg->dl_info); - free(msg->dl_trigger_msg); - free(msg); - - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; - int i,j; - const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_TRIGGER, &header) != 0) - goto error; - - Protocol__PrpUlTrigger *ul_trigger_msg; - ul_trigger_msg = malloc(sizeof(Protocol__PrpUlTrigger)); - if (ul_trigger_msg == NULL) { - goto error; - } - protocol__prp_ul_trigger__init(ul_trigger_msg); - - ul_trigger_msg->header = header; - ul_trigger_msg->has_sfn_sf = 1; - /*TODO: Must fix this to get the proper subframe number*/ - ul_trigger_msg->sfn_sf = get_sfn_sf(mod_id); - - /*TODO: Fill in the number of UL reception status related info, based on the number of currently + /*TODO: Fill in the number of UL reception status related info, based on the number of currently *transmitting UEs */ - ul_trigger_msg->n_ul_info = get_num_ues(mod_id); + sf_trigger_msg->n_ul_info = get_num_ues(mod_id); Protocol__PrpUlInfo **ul_info = NULL; - if (ul_trigger_msg->n_ul_info > 0) { - ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * ul_trigger_msg->n_ul_info); + if (sf_trigger_msg->n_ul_info > 0) { + ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * sf_trigger_msg->n_ul_info); if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE - for(i = 0; i++; i < ul_trigger_msg->n_ul_info) { + for(i = 0; i++; i < sf_trigger_msg->n_ul_info) { ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); if(ul_info[i] == NULL) goto error; @@ -984,26 +920,30 @@ int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__Progran } } - ul_trigger_msg->ul_info = ul_info; - + sf_trigger_msg->ul_info = ul_info; + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG; + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->ul_trigger_msg = ul_trigger_msg; + (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; error: if (header != NULL) free(header); - if (ul_trigger_msg != NULL) { - for (i = 0; i < ul_trigger_msg->n_ul_info; i++) { - free(ul_trigger_msg->ul_info[i]->reception_status); + if (sf_trigger_msg != NULL) { + for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { + free(sf_trigger_msg->dl_info[i]->harq_status); } - free(ul_trigger_msg->ul_info); - free(ul_trigger_msg); + free(sf_trigger_msg->dl_info); + for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { + free(sf_trigger_msg->ul_info[i]->reception_status); + } + free(sf_trigger_msg->ul_info); + free(sf_trigger_msg); } if(*msg != NULL) free(*msg); @@ -1011,17 +951,21 @@ int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__Progran return -1; } -int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG) + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; - free(msg->ul_trigger_msg->header); - for (i = 0; i < msg->ul_trigger_msg->n_ul_info; i++) { - free(msg->ul_trigger_msg->ul_info[i]->reception_status); + free(msg->sf_trigger_msg->header); + for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { + free(msg->sf_trigger_msg->dl_info[i]->harq_status); } - free(msg->ul_trigger_msg->ul_info); - free(msg->ul_trigger_msg); + free(msg->sf_trigger_msg->dl_info); + for (i = 0; i < msg->sf_trigger_msg->n_ul_info; i++) { + free(msg->sf_trigger_msg->ul_info[i]->reception_status); + } + free(msg->sf_trigger_msg->ul_info); + free(msg->sf_trigger_msg); free(msg); return 0; @@ -1058,7 +1002,7 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { int size; Protocol__ProgranMessage *msg; void *data; @@ -1066,7 +1010,7 @@ void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { err_code_t err_code; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_dl_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); if (err_code < 0) { goto error; } @@ -1082,34 +1026,7 @@ void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: - LOG_D(ENB_AGENT, "Could not send dl trigger message\n"); -} - -void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context) { - int size; - Protocol__ProgranMessage *msg; - void *data; - int priority; - err_code_t err_code; - - /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_ul_trigger(mod_id, (void *) &(context->tx_xid), &msg); - if (err_code < 0) { - goto error; - } - - if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(ENB_AGENT,"sent message with size %d\n", size); - } - error: - LOG_D(ENB_AGENT, "Could not send ul trigger message\n"); + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); } int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1120,6 +1037,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; + xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; mac_agent_registered[mod_id] = 1; return 1; @@ -1134,6 +1052,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; + xface->enb_agent_send_sf_trigger = NULL; mac_agent_registered[mod_id] = NULL; return 1; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 18a91716b0..4f8afbac08 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,13 +94,9 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); -int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg); - -int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); - -int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); /********************************** @@ -111,9 +107,7 @@ int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context); - -void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 14d149f40c..a570165919 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -48,8 +48,7 @@ typedef struct { void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_dl_trigger)(mid_t mod_id, msg_context_t *context); - void (*enb_agent_send_ul_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sf_trigger)(mid_t mod_id, msg_context_t *context); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ From 78bc736c19584dcac9106ad33cbaa39e0b9d05d2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 14:51:20 +0000 Subject: [PATCH 041/182] Fixed frame-subframe numbering bug --- openair2/ENB_APP/enb_agent_common.c | 25 +++++++++++++++++-------- openair2/ENB_APP/enb_agent_common.h | 10 ++++++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 8d9997e746..ce838766ee 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -292,13 +292,18 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } -int get_current_frame (mid_t mod_id) { - +unsigned int get_current_frame (mid_t mod_id) { + + #warning "SFN will not be in [0-1023] when oaisim is used" return ((eNB_MAC_INST *)enb[mod_id])->frame; } -int get_current_subframe (mid_t mod_id) { +unsigned int get_current_system_frame_num(mid_t mod_id) { + return (get_current_frame(mod_id) %1024); +} + +unsigned int get_current_subframe (mid_t mod_id) { return ((eNB_MAC_INST *)enb[mod_id])->subframe; @@ -306,12 +311,16 @@ int get_current_subframe (mid_t mod_id) { uint16_t get_sfn_sf (mid_t mod_id) { - uint16_t frame, subframe; - uint16_t sfn_sf; + frame_t frame; + sub_frame_t subframe; + uint16_t sfn_sf, frame_mask, sf_mask; + + frame = (frame_t) get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) get_current_subframe(mod_id); + frame_mask = ((1<<12) - 1); + sf_mask = ((1<<4) -1); + sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); - frame = (uint16_t) get_current_frame(mod_id); - subframe = (uint16_t) get_current_subframe(mod_id); - sfn_sf = (subframe << 12) | frame; return sfn_sf; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f4add1ae2e..4762637b66 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -109,9 +109,15 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran); int get_current_time_ms (mid_t mod_id, int subframe_flag); -int get_current_frame(mid_t mod_id); +/*Return the current frame number + *Could be using implementation specific numbering of frames + */ +unsigned int get_current_frame(mid_t mod_id); -int get_current_subframe(mid_t mod_id); +/*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*/ From a054eb81396bb49504fb8875ffafb719ff87dbbc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 21 Jan 2016 15:27:52 +0000 Subject: [PATCH 042/182] Added helper functions for the continuous update of MAC stats --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_defs.h | 1 + openair2/ENB_APP/enb_agent_mac_internal.c | 560 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_mac_internal.h | 104 ++++ 4 files changed, 666 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_mac_internal.c create mode 100644 openair2/ENB_APP/enb_agent_mac_internal.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a040013e56..eb9474e670 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -751,6 +751,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac_internal.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index e7ffe60c3f..0ddbc2064e 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -44,6 +44,7 @@ #include "link_manager.h" #define NUM_MAX_ENB_AGENT 2 +#define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c new file mode 100644 index 0000000000..c3cc584bcd --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -0,0 +1,560 @@ +/******************************************************************************* + 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 . + + 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_mac_internal.c + * \brief Helper functions for the MAC agent + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_mac_internal.h" + +Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, + Protocol__ProgranMessage *old_message) { + + int i, j; + + Protocol__PrpStatsReply *old_report, *new_report; + + Protocol__PrpStatsReply *stats_reply_msg = NULL; + Protocol__ProgranMessage *msg = NULL; + + Protocol__PrpUeStatsReport **ue_report; + Protocol__PrpUeStatsReport *tmp_ue_report[NUM_MAX_UE]; + Protocol__PrpCellStatsReport **cell_report; + Protocol__PrpCellStatsReport *tmp_cell_report[NUM_MAX_UE]; + + old_report = old_message->stats_reply_msg; + new_report = new_message->stats_reply_msg; + + /*Flags to designate changes in various levels of the message*/ + int stats_had_changes = 0; + int ue_had_change = 0; + int cell_had_change = 0; + + /*See how many and which UE reports should be included in the final stats message*/ + int n_ue_report = 0; + int ue_found = 0; + + /*Go through each RNTI of the new report and see if it exists in the old one*/ + for (i = 0; i < new_report->n_ue_report; i++) { + for (j = 0; j < old_report->n_ue_report; i++) { + if (new_report->ue_report[i]->rnti == old_report->ue_report[j]->rnti) { + ue_found = 1; + /*Need to check if something changed*/ + if (compare_ue_stats_reports(new_report->ue_report[i], old_report->ue_report[j]) != 0) { + tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); + n_ue_report++; + } + break; + } + } + if (!ue_found) { + tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); + n_ue_report++; + } + ue_found = 0; + } + + /*See how many and which cell reports should be included in the final stats message*/ + int n_cell_report = 0; + int cell_found = 0; + + /*Go through each cell of the new report and see if it exists in the old one*/ + for (i = 0; i < new_report->n_cell_report; i++) { + for (j = 0; j < old_report->n_cell_report; i++) { + if (new_report->cell_report[i]->carrier_index == old_report->cell_report[j]->carrier_index) { + cell_found = 1; + /*Need to check if something changed*/ + if (compare_cell_stats_reports(new_report->cell_report[i], old_report->cell_report[j]) != 0) { + tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); + n_cell_report++; + } + break; + } + } + if (!cell_found) { + tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); + n_cell_report++; + } + cell_found = 0; + } + + /*TODO: create the reply message based on the findings*/ + /*Create ue report list*/ + if (n_ue_report > 0) { + ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *)); + for (i = 0; i 0) { + cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *)); + for (i = 0; i 0 || n_ue_report > 0) { + /*Create header*/ + int xid = old_report->header->xid; + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) { + goto error; + } + stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg->header = header; + stats_reply_msg->n_ue_report = n_ue_report; + stats_reply_msg->ue_report = ue_report; + stats_reply_msg->n_cell_report = n_cell_report; + stats_reply_msg->cell_report = cell_report; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if(msg == NULL) + goto error; + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + msg->stats_reply_msg = stats_reply_msg; + } + return msg; + + error: + return NULL; +} + +int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, + Protocol__PrpUeStatsReport *rep2) { + return 1; +} + +int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, + Protocol__PrpCellStatsReport *rep2) { + return 1; +} + +Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original) { + int i; + Protocol__PrpUeStatsReport *copy = malloc(sizeof(Protocol__PrpUeStatsReport)); + if (copy == NULL) + goto error; + protocol__prp_ue_stats_report__init(copy); + copy->rnti = original->rnti; + copy->has_rnti = original->has_rnti; + copy->flags = original->flags; + copy->has_flags = original->has_flags; + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + copy->n_bsr = original->n_bsr; + if (copy->n_bsr > 0) { + uint32_t *elem; + elem = (uint32_t *) malloc(sizeof(uint32_t)*copy->n_bsr); + if (elem == NULL) + goto error; + for (i = 0; i < original->n_bsr; i++) { + elem[i] = original->bsr[i]; + } + copy->bsr = elem; + } + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + copy->has_phr = original->has_phr; + copy->phr = original->phr; + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + copy->n_rlc_report = original->n_rlc_report; + if (copy->n_rlc_report > 0) { + Protocol__PrpRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * copy->n_rlc_report); + if (rlc_reports == NULL) + goto error; + for (i = 0; i < copy->n_rlc_report; i++) { + rlc_reports[i] = copy_rlc_report(original->rlc_report[i]); + } + copy->rlc_report = rlc_reports; + } + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + copy->has_pending_mac_ces = original->has_pending_mac_ces; + copy->pending_mac_ces = original->pending_mac_ces; + + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + copy->dl_cqi_report = copy_dl_cqi_report(original->dl_cqi_report); + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + /*Copy the Paging Buffer report*/ + copy->pbr = copy_paging_buffer_report(original->pbr); + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + /*TODO: Copy the UL report*/ + copy->ul_cqi_report = copy_ul_cqi_report(original->ul_cqi_report); + } + + return copy; + + error: + return NULL; +} + +Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { + Protocol__PrpRlcBsr * copy = malloc(sizeof(Protocol__PrpRlcBsr)); + if (copy == NULL) + goto error; + protocol__prp_rlc_bsr__init(copy); + copy->lc_id = original->lc_id; + copy->has_lc_id = original->has_lc_id; + copy->tx_queue_size = original->tx_queue_size; + copy->has_tx_queue_size = original->has_tx_queue_size; + copy->tx_queue_hol_delay = original->tx_queue_hol_delay; + copy->has_tx_queue_hol_delay = original->has_tx_queue_hol_delay; + copy->retransmission_queue_size = original->retransmission_queue_size; + copy->has_retransmission_queue_size = original->has_retransmission_queue_size; + copy->retransmission_queue_hol_delay = original->retransmission_queue_hol_delay; + copy->has_retransmission_queue_hol_delay = original->has_retransmission_queue_hol_delay; + copy->status_pdu_size = original->status_pdu_size; + copy->has_status_pdu_size = original->has_status_pdu_size; + + return copy; + + error: + return NULL; +} + +Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original) { + int i, j; + + //Fill in the full UL CQI report of the UE + Protocol__PrpUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + if(full_ul_report == NULL) { + goto error; + } + protocol__prp_ul_cqi_report__init(full_ul_report); + //TODO:Set the SFN and SF of the generated report + full_ul_report->sfn_sn = original->sfn_sn; + full_ul_report->has_sfn_sn = original->has_sfn_sn; + full_ul_report->n_cqi_meas = original->n_cqi_meas; + + Protocol__PrpUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + if(ul_report == NULL) + goto error; + for(i = 0; i++; i < full_ul_report->n_cqi_meas) { + ul_report[i] = malloc(sizeof(Protocol__PrpUlCqi)); + if(ul_report[i] == NULL) + goto error; + protocol__prp_ul_cqi__init(ul_report[i]); + ul_report[i]->type = original->cqi_meas[i]->type; + ul_report[i]->has_type = original->cqi_meas[i]->has_type; + ul_report[i]->n_sinr = original->cqi_meas[i]->n_sinr; + uint32_t *sinr_meas; + sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[i]->n_sinr); + if (sinr_meas == NULL) + goto error; + for (j = 0; j < ul_report[i]->n_sinr; j++) { + sinr_meas[j] = original->cqi_meas[i]->sinr[j]; + } + ul_report[i]->sinr = sinr_meas; + ul_report[i]->serv_cell_index = original->cqi_meas[i]->serv_cell_index; + ul_report[i]->has_serv_cell_index = original->cqi_meas[i]->has_serv_cell_index; + } + full_ul_report->cqi_meas = ul_report; + + return full_ul_report; + + error: + return NULL; +} + +Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original) { + int i; + /*Copy the DL report*/ + Protocol__PrpDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + if (dl_report == NULL) + goto error; + protocol__prp_dl_cqi_report__init(dl_report); + + dl_report->sfn_sn = original->sfn_sn; + dl_report->has_sfn_sn = original->has_sfn_sn; + dl_report->n_csi_report = original->n_csi_report; + + Protocol__PrpDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *) * dl_report->n_csi_report); + if (csi_reports == NULL) + goto error; + + for (i = 0; i < dl_report->n_csi_report; i++) { + csi_reports[i] = copy_csi_report(original->csi_report[i]); + } + dl_report->csi_report = csi_reports; + return dl_report; + + error: + /*TODO: Must free memory properly*/ + return NULL; +} + +Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original) { + + int i; + Protocol__PrpPagingBufferReport *copy; + copy = malloc(sizeof(Protocol__PrpPagingBufferReport)); + if (copy == NULL) + goto error; + + protocol__prp_paging_buffer_report__init(copy); + copy->n_paging_info = original->n_paging_info; + + Protocol__PrpPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * copy->n_paging_info); + if (p_info == NULL) + goto error; + for (i = 0; i < copy->n_paging_info; i++) { + p_info[i] = malloc(sizeof(Protocol__PrpPagingInfo)); + if(p_info[i] == NULL) + goto error; + protocol__prp_paging_info__init(p_info[i]); + p_info[i]->paging_index = original->paging_info[i]->paging_index; + p_info[i]->has_paging_index = original->paging_info[i]->has_paging_index;; + p_info[i]->paging_message_size = original->paging_info[i]->paging_message_size; + p_info[i]->has_paging_message_size = original->paging_info[i]->has_paging_message_size; + p_info[i]->paging_subframe = original->paging_info[i]->paging_subframe; + p_info[i]->has_paging_subframe = original->paging_info[i]->has_paging_subframe; + p_info[i]->carrier_index = original->paging_info[i]->carrier_index; + p_info[i]->has_carrier_index = original->paging_info[i]->has_carrier_index; + } + copy->paging_info = p_info; + return copy; + + error: + /*TODO: free memory properly*/ + return NULL; +} + +Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { + int i, j; + Protocol__PrpDlCsi *copy = malloc(sizeof(Protocol__PrpDlCsi)); + if (copy == NULL) + goto error; + protocol__prp_dl_csi__init(copy); + copy->serv_cell_index = original->serv_cell_index; + copy->has_serv_cell_index = original->has_serv_cell_index; + copy->ri = original->ri; + copy->has_ri = original->ri; + + copy->type = original->type; + copy->has_type = original->has_type; + copy->report_case = original->report_case; + + switch (copy->report_case) { + case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + copy->p10csi->wb_cqi = original->p10csi->wb_cqi; + copy->p10csi->has_wb_cqi = original->p10csi->has_wb_cqi; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + copy->p11csi->n_wb_cqi = original->p11csi->n_wb_cqi; + copy->p11csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p11csi->n_wb_cqi); + for (i = 0; i < copy->p11csi->n_wb_cqi; i++) { + copy->p11csi->wb_cqi[i] = original->p11csi->wb_cqi[i]; + } + copy->p11csi->has_wb_pmi = original->p11csi->has_wb_pmi; + copy->p11csi->wb_pmi = original->p11csi->wb_pmi; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + copy->p20csi->has_wb_cqi = original->p20csi->has_wb_cqi; + copy->p20csi->wb_cqi = original->p20csi->wb_cqi; + copy->p20csi->has_sb_cqi = original->p20csi->has_sb_cqi; + copy->p20csi->sb_cqi = original->p20csi->sb_cqi; + copy->p20csi->has_bandwidth_part_index = original->p20csi->has_bandwidth_part_index; + copy->p20csi->bandwidth_part_index = original->p20csi->bandwidth_part_index; + copy->p20csi->has_sb_index = original->p20csi->has_sb_index; + copy->p20csi->sb_index = original->p20csi->sb_index; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + copy->p21csi->n_wb_cqi = original->p21csi->n_wb_cqi; + copy->p21csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_wb_cqi); + for (i = 0; i < copy->p21csi->n_wb_cqi; i++) { + copy->p21csi->wb_cqi[i] = original->p21csi->wb_cqi[i]; + } + copy->p21csi->has_wb_pmi = original->p21csi->has_wb_pmi; + copy->p21csi->wb_pmi = original->p21csi->wb_pmi; + copy->p21csi->n_sb_cqi = original->p21csi->n_sb_cqi; + copy->p21csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_sb_cqi); + for (i = 0; i < copy->p21csi->n_sb_cqi; i++) { + copy->p21csi->sb_cqi[i] = original->p21csi->sb_cqi[i]; + } + copy->p21csi->has_badwidth_part_index = original->p21csi->has_badwidth_part_index; + copy->p21csi->badwidth_part_index = original->p21csi->badwidth_part_index; + copy->p21csi->has_sb_index = original->p21csi->has_sb_index; + copy->p21csi->sb_index = original->p21csi->sb_index; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + copy->a12csi->n_wb_cqi = original->a12csi->n_wb_cqi; + copy->a12csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_wb_cqi); + for (i = 0; i < copy->a12csi->n_wb_cqi; i++) { + copy->a12csi->wb_cqi[i] = original->a12csi->wb_cqi[i]; + } + copy->a12csi->n_sb_pmi = original->a12csi->n_sb_pmi; + copy->a12csi->sb_pmi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_sb_pmi); + for (i = 0; i < copy->a12csi->n_sb_pmi; i++) { + copy->a12csi->sb_pmi[i] = original->a12csi->sb_pmi[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + copy->a22csi->n_wb_cqi = original->a22csi->n_wb_cqi; + copy->a22csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_wb_cqi); + for (i = 0; i < copy->a22csi->n_wb_cqi; i++) { + copy->a22csi->wb_cqi[i] = original->a22csi->wb_cqi[i]; + } + copy->a22csi->n_sb_cqi = original->a22csi->n_sb_cqi; + copy->a22csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_cqi); + for (i = 0; i < copy->a22csi->n_sb_cqi; i++) { + copy->a22csi->sb_cqi[i] = original->a22csi->sb_cqi[i]; + } + copy->a22csi->has_wb_pmi = original->a22csi->has_wb_pmi; + copy->a22csi->wb_pmi = original->a22csi->wb_pmi; + copy->a22csi->has_sb_pmi = original->a22csi->has_sb_pmi; + copy->a22csi->sb_pmi = original->a22csi->sb_pmi; + copy->a22csi->n_sb_list = original->a22csi->n_sb_list; + copy->a22csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_list); + for (i = 0; i < copy->a22csi->n_sb_list; i++) { + copy->a22csi->sb_list[i] = original->a22csi->sb_list[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + copy->a20csi->has_wb_cqi = original->a20csi->has_wb_cqi; + copy->a20csi->wb_cqi = original->a20csi->wb_cqi; + copy->a20csi->has_sb_cqi = original->a20csi->has_sb_cqi; + copy->a20csi->sb_cqi = original->a20csi->sb_cqi; + copy->a20csi->n_sb_list = original->a20csi->n_sb_list; + copy->a20csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a20csi->n_sb_list); + for (i = 0; i < copy->a20csi->n_sb_list; i++) { + copy->a20csi->sb_list[i] = original->a20csi->sb_list[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + copy->a30csi->has_wb_cqi = original->a30csi->has_wb_cqi; + copy->a30csi->wb_cqi = original->a30csi->wb_cqi; + copy->a30csi->n_sb_cqi = original->a30csi->n_sb_cqi; + copy->a30csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a30csi->n_sb_cqi); + for (i = 0; i < copy->a30csi->n_sb_cqi; i++) { + copy->a30csi->sb_cqi[i] = original->a30csi->sb_cqi[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + copy->a31csi->n_wb_cqi = original->a31csi->n_wb_cqi; + copy->a31csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->n_wb_cqi); + for (i = 0; i < copy->a31csi->n_wb_cqi; i++) { + copy->a31csi->wb_cqi[i] = original->a31csi->wb_cqi[i]; + } + copy->a31csi->has_wb_pmi = original->a31csi->has_wb_pmi; + copy->a31csi->wb_pmi = original->a31csi->wb_pmi; + copy->a31csi->n_sb_cqi = original->a31csi->n_sb_cqi; + copy->a31csi->sb_cqi = malloc(sizeof(Protocol__PrpMsbCqi *) * copy->a31csi->n_sb_cqi); + if (copy->a31csi == NULL) { + goto error; + } + for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { + copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__PrpMsbCqi)); + if (copy->a31csi->sb_cqi[i] == NULL) { + goto error; + } + protocol__prp_msb_cqi__init(copy->a31csi->sb_cqi[i]); + copy->a31csi->sb_cqi[i]->n_sb_cqi = original->a31csi->sb_cqi[i]->n_sb_cqi; + copy->a31csi->sb_cqi[i]->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->sb_cqi[i]->n_sb_cqi); + for (j = 0; j < copy->a31csi->sb_cqi[i]->n_sb_cqi; j++) { + copy->a31csi->sb_cqi[i]->sb_cqi[j] = original->a31csi->sb_cqi[i]->sb_cqi[j]; + } + } + break; + default: + goto error; + } + return copy; + + error: + return NULL; +} + +Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original) { + + Protocol__PrpCellStatsReport * copy = malloc(sizeof(Protocol__PrpCellStatsReport)); + + if(copy == NULL) { + goto error; + } + protocol__prp_cell_stats_report__init(copy); + copy->carrier_index = original->carrier_index; + copy->has_carrier_index = original->has_carrier_index; + copy->flags = original->flags; + copy->has_flags = original->has_flags; + + if(copy->flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + copy->noise_inter_report = copy_noise_inter_report(original->noise_inter_report); + } + + return copy; + + error: + return NULL; +} + +Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original) { + Protocol__PrpNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + if(ni_report == NULL) { + goto error; + } + protocol__prp_noise_interference_report__init(ni_report); + // Current frame and subframe number + ni_report->sfn_sf = original->sfn_sf; + ni_report->has_sfn_sf = original->sfn_sf; + // Received interference power in dbm + ni_report->rip = original->rip; + ni_report->has_rip = original->has_rip; + // Thermal noise power in dbm + ni_report->tnp = original->tnp; + ni_report->has_tnp = original->has_tnp; + + return ni_report; + + error: + return NULL; +} diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h new file mode 100644 index 0000000000..98c15e083f --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -0,0 +1,104 @@ +/******************************************************************************* + 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 . + + 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_mac_internal.h + * \brief Implementation specific definitions for the eNB MAC agent + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_MAC_INTERNAL_H_ +#define ENB_AGENT_MAC_INTERNAL_H_ + +#include + +#include "enb_agent_mac.h" +#include "enb_agent_common.h" + + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; + +/*This will be used for producing continuous status updates for the MAC + *Needs to be thread-safe + */ +typedef struct { + /*Flag showing if continuous mac stats update is enabled*/ + uint8_t is_initialized; + volatile uint8_t cont_update; + xid_t xid; + Protocol__ProgranMessage *stats_req; + Protocol__ProgranMessage *prev_stats_reply; + + pthread_mutex_t *mutex; +} mac_stats_updates_context_t; + +/*Array holding the last stats reports for each eNB. Used for continuous reporting*/ +mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB_AGENT]; + +/*Functions to initialize and destroy the struct required for the + *continuous stats update report*/ +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id); + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id); + + +/*Enable/Disable the continuous stats update service for the MAC*/ +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, + stats_request_config_t *stats_req); + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); + +Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_report, + Protocol__ProgranMessage *old_report); + +Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original); + +Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original); + +Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original); + +Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original); + +Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original); + +Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original); + +Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original); + +Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original); + +int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, + Protocol__PrpUeStatsReport *rep2); + +int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, + Protocol__PrpCellStatsReport *rep2); + +#endif /*ENB_AGENT_MAC_INTERNAL_H_*/ From dec1c93c3dc716bfc9c0abd86677bef8fe1e6c17 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:18:54 +0000 Subject: [PATCH 043/182] Changed channel struct for async_channel implementation --- openair2/ENB_APP/enb_agent_async.c | 22 +++++++++++----------- openair2/ENB_APP/enb_agent_async.h | 10 +++++++++- openair2/ENB_APP/enb_agent_net_comm.c | 6 +++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c index 962e1a81ed..d6389ea65f 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/enb_agent_async.c @@ -39,21 +39,21 @@ #include "log.h" -enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *) malloc(sizeof(enb_agent_instance_t)); + enb_agent_async_channel_t *channel; + channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t)); if (channel == NULL) goto error; - channel->mod_id = mod_id; + 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(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - channel->mod_id, + channel->enb_id, dst_ip, dst_port); @@ -80,22 +80,22 @@ enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, } int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *)channel_info; + enb_agent_async_channel_t *channel; + channel = (enb_agent_channel_t *)channel_info; return message_put(channel->send_queue, data, size, priority); } int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *)channel_info; + enb_agent_async_channel_t *channel; + channel = (enb_agent_async_channel_t *)channel_info; return message_get(channel->receive_queue, data, size, priority); } void enb_agent_async_release(enb_agent_channel_t *channel) { - enb_agent_instance_t *channel_info; - channel_info = (enb_agent_instance_t *) channel->channel_info; + enb_agent_async_channel_t *channel_info; + channel_info = (enb_agent_async_channel_t *) channel->channel_info; destroy_link_manager(channel_info->manager); diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h index 53614cc87d..d722f92a8e 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/enb_agent_async.h @@ -39,7 +39,15 @@ #include "enb_agent_net_comm.h" -enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +typedef struct { + mid_t enb_id; + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; +} enb_agent_async_channel_t; + +enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c index 5c4544ad63..e180d7affd 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -37,7 +37,7 @@ #include "enb_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[NUM_MAX_ENB_AGENT][ENB_AGENT_MAX]; +enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; enb_agent_channel_instance_t channel_instance; int enb_agent_channel_id = 0; @@ -146,7 +146,7 @@ int enb_agent_destroy_channel(int channel_id) { } /*Unregister the channel from all agents*/ - for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + 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) { @@ -170,7 +170,7 @@ err_code_t enb_agent_init_channel_container(void) { RB_INIT(&channel_instance.enb_agent_head); - for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { agent_channel[i][j] == NULL; } From 3ad4d26fd1f619ef98f3fa94f41e5973ce537493 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:26:06 +0000 Subject: [PATCH 044/182] Changed the structures for storing agent context info --- openair2/ENB_APP/enb_agent.c | 103 +++++----------------- openair2/ENB_APP/enb_agent_common.c | 4 +- openair2/ENB_APP/enb_agent_defs.h | 29 ++---- openair2/ENB_APP/enb_agent_extern.h | 7 +- openair2/ENB_APP/enb_agent_mac_defs.h | 10 ++- openair2/ENB_APP/enb_agent_mac_internal.h | 5 +- 6 files changed, 47 insertions(+), 111 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index fa24cacf8a..c48f8f67fb 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -37,6 +37,7 @@ #include "enb_agent_common.h" #include "log.h" #include "enb_agent.h" +#include "enb_agent_mac_defs.h" #include "enb_agent_extern.h" @@ -47,10 +48,7 @@ //#define TEST_TIMER -enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; -msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; -/* this could also go into enb_agent struct*/ -enb_agent_info_t enb_agent_info; +enb_agent_instance_t enb_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; @@ -66,7 +64,7 @@ Protocol__ProgranMessage *enb_agent_timeout(void* args); */ void *enb_agent_task(void *args){ - msg_context_t *d = (msg_context_t *) args; + enb_agent_instance_t *d = (enb_agent_instance_t *) args; Protocol__ProgranMessage *msg; void *data; int size; @@ -101,15 +99,11 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - /* if (message_put(d->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } break; @@ -131,7 +125,7 @@ void *enb_agent_task(void *args){ void *receive_thread(void *args) { - msg_context_t *d = args; + enb_agent_instance_t *d = args; void *data; int size; int priority; @@ -140,38 +134,27 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (enb_agent_msg_recv(d->mod_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { + if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } - /* if (message_get(d->rx_mq, &data, &size, &priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->mod_id, data, size); + msg=enb_agent_handle_message(d->enb_id, data, size); free(data); - d->rx_xid = ((d->rx_xid)+1)%4; - d->tx_xid = d->rx_xid; - // check if there is something to send back to the controller if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - /* if (message_put(d->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } @@ -214,10 +197,8 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - // set_enb_vars(mod_id, RAN_LTE_OAI); - enb_agent[mod_id].mod_id = mod_id; - enb_agent_info.nb_modules+=1; + enb_agent[mod_id].enb_id = mod_id; /* * check the configuration @@ -235,7 +216,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ in_port = DEFAULT_ENB_AGENT_PORT ; } LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].mod_id, + enb_agent[mod_id].enb_id, in_ip, in_port); @@ -271,46 +252,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); */ - /* /\* */ - /* * create a socket */ - /* *\/ */ - /* enb_agent[mod_id].link = new_link_client(in_ip, in_port); */ - /* if (enb_agent[mod_id].link == NULL) goto error; */ + /*Initialize the continuous MAC stats update mechanism*/ + enb_agent_init_cont_mac_stats_update(mod_id); - /* LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", */ - /* enb_agent[mod_id].mod_id, */ - /* in_ip, */ - /* in_port); */ - /* /\* */ - /* * create a message queue */ - /* *\/ */ - - /* enb_agent[mod_id].send_queue = new_message_queue(); */ - /* if (enb_agent[mod_id].send_queue == NULL) goto error; */ - /* enb_agent[mod_id].receive_queue = new_message_queue(); */ - /* if (enb_agent[mod_id].receive_queue == NULL) goto error; */ - - /* /\* */ - /* * create a link manager */ - /* *\/ */ - - /* enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); */ - /* if (enb_agent[mod_id].manager == NULL) goto error; */ - - /* memset(&shared_ctxt, 0, sizeof(msg_context_t)); */ - - /* shared_ctxt[mod_id].mod_id = mod_id; */ - /* shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; */ - /* shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; */ - - /* - * start the enb agent rx thread - */ - - memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt[mod_id].mod_id = mod_id; - - new_thread(receive_thread, &shared_ctxt[mod_id]); + new_thread(receive_thread, &enb_agent[mod_id]); /* * initilize a timer @@ -322,7 +267,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * start the enb agent task for tx and interaction with the underlying network function */ - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; } @@ -338,21 +283,21 @@ error: -int enb_agent_stop(mid_t mod_id){ +/* int enb_agent_stop(mid_t mod_id){ */ - int i=0; +/* int i=0; */ - enb_agent_destroy_timers(); - for ( i =0; i < enb_agent_info.nb_modules; i++) { +/* enb_agent_destroy_timers(); */ +/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */ - destroy_link_manager(enb_agent[i].manager); +/* destroy_link_manager(enb_agent[i].manager); */ - destroy_message_queue(enb_agent[i].send_queue); - destroy_message_queue(enb_agent[i].receive_queue); +/* destroy_message_queue(enb_agent[i].send_queue); */ +/* destroy_message_queue(enb_agent[i].receive_queue); */ - close_link(enb_agent[i].link); - } -} +/* close_link(enb_agent[i].link); */ +/* } */ +/* } */ diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ce838766ee..ab9546036f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -39,8 +39,8 @@ #include "log.h" -void * enb[NUM_MAX_ENB_AGENT]; -void * enb_ue[NUM_MAX_ENB_AGENT]; +void * enb[NUM_MAX_ENB]; +void * enb_ue[NUM_MAX_ENB]; /* * message primitives */ diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 0ddbc2064e..020c631ff1 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -43,7 +43,7 @@ #include "link_manager.h" -#define NUM_MAX_ENB_AGENT 2 +#define NUM_MAX_ENB 2 #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 @@ -108,36 +108,25 @@ typedef uint8_t mid_t; // module or enb id typedef uint8_t lcid_t; typedef int32_t err_code_t; -// tx and rx shared context -typedef struct { - mid_t mod_id; - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; -}enb_agent_instance_t; + typedef struct { /* general info */ - uint32_t nb_modules; - - + /* stats */ uint32_t total_rx_msg; uint32_t total_tx_msg; - uint32_t rx_msg[NUM_MAX_ENB_AGENT]; - uint32_t tx_msg[NUM_MAX_ENB_AGENT]; + uint32_t rx_msg[NUM_MAX_ENB]; + uint32_t tx_msg[NUM_MAX_ENB]; }enb_agent_info_t; typedef struct { - mid_t mod_id; - // message_queue_t *tx_mq; - // message_queue_t *rx_mq; - xid_t tx_xid; - xid_t rx_xid; -} msg_context_t; + mid_t enb_id; + enb_agent_info_t agent_info; + +}enb_agent_instance_t; #endif diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 2cd072f25a..f191d86907 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -41,10 +41,11 @@ #include "enb_agent_defs.h" #include "enb_agent_mac_defs.h" -extern msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; -extern AGENT_MAC_xface *agent_mac_xface; +//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; -extern unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; +extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB][ENB_AGENT_MAX]; + +extern unsigned int mac_agent_registered[NUM_MAX_ENB]; #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index a570165919..f6dccb1570 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -42,14 +42,18 @@ /* ENB AGENT-MAC Interface */ typedef struct { - msg_context_t *agent_ctxt; + //msg_context_t *agent_ctxt; /// Inform the controller about the scheduling requests received during the subframe - void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sr_info)(mid_t mod_id); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_sf_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sf_trigger)(mid_t mod_id); + /// Send to the controller all the mac stat updates that occured during this subframe + /// based on the stats request configuration + void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 98c15e083f..394d3e7730 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -43,9 +43,6 @@ #include "enb_agent_common.h" -/*Flags showing if a mac agent has already been registered*/ -unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; - /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe */ @@ -61,7 +58,7 @@ typedef struct { } mac_stats_updates_context_t; /*Array holding the last stats reports for each eNB. Used for continuous reporting*/ -mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB_AGENT]; +mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ From e3e01a64c97a8db2f8b9501f09f1b48e91959965 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:28:44 +0000 Subject: [PATCH 045/182] Added continuous update functionality in the MAC layer --- openair2/ENB_APP/enb_agent_mac.c | 200 ++++++++++++++++++++++++++++--- 1 file changed, 184 insertions(+), 16 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 34423ee01a..6e66267391 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -35,14 +35,22 @@ */ #include "enb_agent_mac.h" +#include "enb_agent_extern.h" +#include "enb_agent_common.h" +#include "enb_agent_mac_internal.h" #include "log.h" + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist - + // TODO: Must resolve conflicts among stats requests + int i; void *buffer; int size; @@ -71,15 +79,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { - //TODO: Must create an event based report mechanism - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + /*Disable both periodic and continuous updates*/ + enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; - } else { //One-off or periodical reporting + } else { //One-off, periodical or continuous reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -136,6 +142,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /*If request was for continuous updates, disable the previous configuration and + set up a new one*/ + enb_agent_disable_cont_mac_stats_update(mod_id); + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -453,7 +469,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->n_csi_report = 1; //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { @@ -505,7 +521,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, paging_report->n_paging_info = 1; //Provide a report for each pending paging message Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { @@ -975,15 +991,21 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { +/*********************************************** + * eNB agent - technology mac API implementation + ***********************************************/ + +void enb_agent_send_sr_info(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -997,20 +1019,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -1024,6 +1049,60 @@ void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + } + error: + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); +} + +void enb_agent_send_update_mac_stats(mid_t mod_id) { + + Protocol__ProgranMessage *current_report, *msg; + void *data; + int size; + err_code_t err_code; + int priority; + + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; + + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_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 (mac_stats_context[mod_id].prev_stats_reply != NULL) { + + msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); + + /*Destroy the old stats*/ + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + /*Use the current report for future comparissons*/ + mac_stats_context[mod_id].prev_stats_reply = current_report; + + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send any stats updates using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); @@ -1035,12 +1114,14 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = &shared_ctxt[mod_id]; + //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; + xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; mac_agent_registered[mod_id] = 1; - return 1; + + return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1050,10 +1131,97 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = NULL; + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + return 0; +} + + +/****************************************************** + *Implementations of enb_agent_mac_internal.h functions + ******************************************************/ + +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { + + /*Initialize the Mac stats update structure*/ + /*Initially the continuous update is set to false*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 1; + mac_stats_context[mod_id].stats_req = NULL; + mac_stats_context[mod_id].prev_stats_reply = NULL; + mac_stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); + if (mac_stats_context[mod_id].mutex == NULL) + goto error; + if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) + goto error;; + + return 0; + + error: + return -1; +} + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 0; + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + free(mac_stats_context[mod_id].mutex); + mac_agent_registered[mod_id] = NULL; return 1; } + + +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { + /*Enable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + Protocol__ProgranMessage *req_msg; + + enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + mac_stats_context[mod_id].stats_req = req_msg; + mac_stats_context[mod_id].prev_stats_reply = NULL; + + mac_stats_context[mod_id].cont_update = 1; + mac_stats_context[mod_id].xid = xid; + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; +} + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].xid = 0; + if (mac_stats_context[mod_id].stats_req != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + } + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; + +} From 16bbb96d5bb0bdd692bc8365e781bc5e29643b01 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:28:44 +0000 Subject: [PATCH 046/182] Added continuous update functionality in the MAC layer --- openair2/ENB_APP/enb_agent_mac.c | 200 ++++++++++++++++++++++++++++--- openair2/ENB_APP/enb_agent_mac.h | 14 +-- 2 files changed, 191 insertions(+), 23 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 34423ee01a..6e66267391 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -35,14 +35,22 @@ */ #include "enb_agent_mac.h" +#include "enb_agent_extern.h" +#include "enb_agent_common.h" +#include "enb_agent_mac_internal.h" #include "log.h" + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist - + // TODO: Must resolve conflicts among stats requests + int i; void *buffer; int size; @@ -71,15 +79,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { - //TODO: Must create an event based report mechanism - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + /*Disable both periodic and continuous updates*/ + enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; - } else { //One-off or periodical reporting + } else { //One-off, periodical or continuous reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -136,6 +142,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /*If request was for continuous updates, disable the previous configuration and + set up a new one*/ + enb_agent_disable_cont_mac_stats_update(mod_id); + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -453,7 +469,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->n_csi_report = 1; //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { @@ -505,7 +521,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, paging_report->n_paging_info = 1; //Provide a report for each pending paging message Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { @@ -975,15 +991,21 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { +/*********************************************** + * eNB agent - technology mac API implementation + ***********************************************/ + +void enb_agent_send_sr_info(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -997,20 +1019,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -1024,6 +1049,60 @@ void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + } + error: + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); +} + +void enb_agent_send_update_mac_stats(mid_t mod_id) { + + Protocol__ProgranMessage *current_report, *msg; + void *data; + int size; + err_code_t err_code; + int priority; + + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; + + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_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 (mac_stats_context[mod_id].prev_stats_reply != NULL) { + + msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); + + /*Destroy the old stats*/ + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + /*Use the current report for future comparissons*/ + mac_stats_context[mod_id].prev_stats_reply = current_report; + + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send any stats updates using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); @@ -1035,12 +1114,14 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = &shared_ctxt[mod_id]; + //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; + xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; mac_agent_registered[mod_id] = 1; - return 1; + + return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1050,10 +1131,97 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = NULL; + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + return 0; +} + + +/****************************************************** + *Implementations of enb_agent_mac_internal.h functions + ******************************************************/ + +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { + + /*Initialize the Mac stats update structure*/ + /*Initially the continuous update is set to false*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 1; + mac_stats_context[mod_id].stats_req = NULL; + mac_stats_context[mod_id].prev_stats_reply = NULL; + mac_stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); + if (mac_stats_context[mod_id].mutex == NULL) + goto error; + if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) + goto error;; + + return 0; + + error: + return -1; +} + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 0; + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + free(mac_stats_context[mod_id].mutex); + mac_agent_registered[mod_id] = NULL; return 1; } + + +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { + /*Enable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + Protocol__ProgranMessage *req_msg; + + enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + mac_stats_context[mod_id].stats_req = req_msg; + mac_stats_context[mod_id].prev_stats_reply = NULL; + + mac_stats_context[mod_id].cont_update = 1; + mac_stats_context[mod_id].xid = xid; + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; +} + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].xid = 0; + if (mac_stats_context[mod_id].stats_req != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + } + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 4f8afbac08..c30da76d3e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -45,9 +45,6 @@ #include "enb_agent_common.h" #include "enb_agent_extern.h" -/*Flags showing if a mac agent has already been registered*/ -unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; - /* These types will be used to give instructions for the type of stats reports we need to create */ @@ -72,14 +69,13 @@ typedef struct { cc_report_type_t *cc_report_type; } report_config_t; -typedef struct { +typedef struct stats_request_config_s{ uint8_t report_type; uint8_t report_frequency; uint16_t period; /*In number of subframes*/ report_config_t *config; } stats_request_config_t; - int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); @@ -104,10 +100,14 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); **********************************/ /*Inform controller about received scheduling requests during a subframe*/ -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sr_info(mid_t mod_id); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sf_trigger(mid_t mod_id); + +/// Send to the controller all the mac stat updates that occured during this subframe +/// based on the stats request configuration +void enb_agent_send_update_mac_stats(mid_t mod_id); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); From c1c9b0bcbe31fd026f607b2d37f1a73dd248976d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 27 Jan 2016 12:01:37 +0000 Subject: [PATCH 047/182] Added support for DL scheduling command messages --- cmake_targets/CMakeLists.txt | 4 + .../MESSAGES/V2/controller_commands.proto | 58 ++++++++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 + .../ENB_APP/MESSAGES/V2/mac_primitives.proto | 76 +++++++++++++++++++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 15 ++++ 5 files changed, 156 insertions(+) create mode 100644 openair2/ENB_APP/MESSAGES/V2/controller_commands.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index eb9474e670..2a847b3073 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -710,6 +710,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/stats_common.proto ${PRPT_MSG_DIR}/stats_messages.proto ${PRPT_MSG_DIR}/time_common.proto + ${PRPT_MSG_DIR}/controller_commands.proto + ${PRPT_MSG_DIR}/mac_primitives.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -722,6 +724,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/stats_common.pb-c.c ${PRPT_C_DIR}/stats_messages.pb-c.c ${PRPT_C_DIR}/time_common.pb-c.c + ${PRPT_C_DIR}/controller_commands.pb-c.c + ${PRPT_C_DIR}/mac_primitives.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto new file mode 100644 index 0000000000..4ef8c0a370 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto @@ -0,0 +1,58 @@ +package protocol; + +import "mac_primitives.proto"; + +// +// Body of UE DL MAC scheduling configuration info +// + +message prp_dl_data { + optional uint32 rnti = 1; + optional prp_dl_dci dl_dci = 2; + repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB + repeated prp_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid + optional uint32 serv_cell_index = 5; + optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA +} + +// +// Body of the RAR scheduler configuration +// +message prp_dl_rar { + optional uint32 rnti = 1; + optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2 + optional prp_dl_dci rar_dci = 3; + optional uint32 carrier_index = 4; // The carrier index for the RAR +} + +// +// Body of the paging/broadcast configuration message +// + +message prp_dl_broadcast { + optional uint32 type = 1; // The PRBT_* values + optional uint32 index = 2; // Index of the broadcast message: + // 0 - SIB1, + // 1..31 - Six, + // 32..63 - PCCH (PCCH index obtained from prp_paging_info) + optional prp_dl_dci broad_dci = 3; + optional uint32 carrier_index = 4; // Index of the carrier for broadcast +} + +// +// Body of the OFDM symbol count message +// + +message prp_pdcch_ofdm_sym_count { + optional uint32 carrier_index = 1; + optional uint32 num_pdcch_ofdm_symbols = 2; +} + +// +// Types of commands related enums +// + +enum prp_broadcast_type { + PRBT_BCCH = 0; + PRBT_PCCH = 1; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 8534d2f304..10a18ddcef 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -21,5 +21,8 @@ enum prp_type { //Asynchronous messages PRPT_UL_SR_INFO = 6; + + //Controller command messages + PRPT_DL_MAC_CONFIG = 7; } diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto new file mode 100644 index 0000000000..4378e6d668 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto @@ -0,0 +1,76 @@ +package protocol; + +// +// Message containing the DL DCI info +// + +message prp_dl_dci { + optional uint32 rnti = 1; + optional uint32 res_alloc = 2; // Type of resource allocation + optional uint32 rb_bitmap = 3; // Bitmap for RB allocation + optional uint32 rb_shift = 4; // See TS 36.214, section 7.1.6.2 + repeated uint32 tbs_size = 5; // The size of each TBS + repeated uint32 mcs = 6; // The MCS of each TB + repeated uint32 ndi = 7; // New data indicator of each TB + repeated uint32 rv = 8; // Redundancy version of each TB + optional uint32 cce_index = 9; // CCE index used to send the DCI + optional uint32 aggr_level = 10; + optional uint32 precoding_info = 11; // 2 antenna ports:0..6, + // 4 antenna ports:0..50 + optional uint32 format = 12; // DCI format. A PRDCIF_* value + optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1 + optional uint32 harq_process = 14; // HARQ process ID + optional uint32 dai = 15; // TDD only + optional uint32 vrb_format = 16; // One of the PRVRBF_* values + optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag + optional uint32 sps_release = 18; // Flag value + optional uint32 pdcch_order = 19; + optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 + optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 + optional uint32 n_gap = 22; // One of the PRNGV_* values + optional uint32 tbs_idx = 23; // The TBS index for Format 1A + optional uint32 dl_power_offset = 24; // For format 1D + optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB + optional uint32 cif_present = 26; // Boolean. Indication of CIF field + optional uint32 cif = 27; // CIF for cross-carrier scheduling +} + +// +// Messages related to the creation of RLC PDUs +// + +message prp_rlc_pdu { + repeated prp_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB +} + +message prp_rlc_pdu_tb { + optional uint32 logical_channel_id = 1; + optional uint32 size = 2; // Maximum RLC PDU to be created in bytes +} + +// +// MAC content types related enums +// + +enum prp_dci_format { + PRDCIF_1 = 0; + PRDCIF_1A = 1; + PRDCIF_1B = 2; + PRDCIF_1C = 3; + PRDCIF_1D = 4; + PRDCIF_2 = 5; + PRDCIF_2A = 6; + PRDCIF_2B = 7; + PRDCIF_3 = 8; + PRDCIF_3A = 9; +} + +enum prp_vrb_format { + PRVRBF_LOCALIZED = 0; + PRVRBF_DISTRIBUTED = 1; +} + +enum prp_ngap_val { + PRNGV_1 = 0; + PRNGV_2 = 1; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 730726aab4..5d0ec15518 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -4,6 +4,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; import "time_common.proto"; +import "controller_commands.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -15,6 +16,7 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; + prp_dl_mac_config dl_mac_config_msg = 8; } } @@ -106,6 +108,19 @@ message prp_ul_sr_info { repeated uint32 rnti = 3; } +// +// Controller command messages +// + +message prp_dl_mac_config { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_dl_data dl_ue_data = 3; + repeated prp_dl_rar dl_rar = 4; + repeated prp_dl_broadcast dl_broadcast = 5; + repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 92f547655c4a352d7c65053a30f453b6a06c599b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 27 Jan 2016 12:54:33 +0000 Subject: [PATCH 048/182] Integrated MAC DL config progran message to agent --- openair2/ENB_APP/enb_agent_handler.c | 8 +++-- openair2/ENB_APP/enb_agent_mac.c | 53 ++++++++++++++++++++++++---- openair2/ENB_APP/enb_agent_mac.h | 4 +++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 7b63227d7e..3e9752b539 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -46,9 +46,10 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ - {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0,0,0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0,0,0}, /*SR_INFO*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ + {0, 0, 0}, /*SR_INFO*/ + {0, 0, 0}, /*DL_MAC_CONFIG*/ }; @@ -60,6 +61,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_stats_reply, enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, + enb_agent_mac_destroy_dl_config, }; static const char *enb_agent_direction2String[] = { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 6e66267391..157b83581d 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -45,6 +45,9 @@ /*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]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input @@ -991,6 +994,43 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg) { + + int xid = 0; + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_MAC_CONFIG, &header) != 0) + goto error; + + Protocol__PrpDlMacConfig *dl_mac_config_msg; + dl_mac_config_msg = malloc(sizeof(Protocol__PrpDlMacConfig)); + if (dl_mac_config_msg == NULL) { + goto error; + } + protocol__prp_dl_mac_config__init(dl_mac_config_msg); + + dl_mac_config_msg->header = header; + dl_mac_config_msg->has_sfn_sf = 1; + dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->dl_mac_config_msg = dl_mac_config_msg; + + return 0; + + error: + return -1; +} + +int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { + //TODO: De-allocate the memory of the message + return -1; +} + /*********************************************** * eNB agent - technology mac API implementation ***********************************************/ @@ -1109,7 +1149,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - if (!mac_agent_registered[mod_id]) { + if (mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); return -1; } @@ -1119,22 +1159,23 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; + mac_agent_registered[mod_id] = 1; + agent_mac_xface[mod_id] = xface; return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - if(mac_agent_registered[mod_id]) { - LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); - return -1; - } - //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + xface->enb_agent_send_update_mac_stats = NULL; + mac_agent_registered[mod_id] = 0; + agent_mac_xface[mod_id] = NULL; + return 0; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index c30da76d3e..221d76e57f 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,6 +94,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API From cb8007bb3182acf0be139d94b67ba9f821064d90 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 28 Jan 2016 14:45:47 +0000 Subject: [PATCH 049/182] Added support for enb agent MAC scheduler hot-plugging. Deactivated schedule_ue_spec and added agent UE specific DL scheduler --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent.c | 6 + openair2/ENB_APP/enb_agent_extern.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 4 + openair2/ENB_APP/enb_agent_mac_defs.h | 9 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 944 ++++++++++++++++++ openair2/LAYER2/MAC/eNB_scheduler.c | 273 ++++- openair2/LAYER2/MAC/proto.h | 10 + 8 files changed, 1228 insertions(+), 21 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 2a847b3073..01d0c8aabd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1007,6 +1007,7 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c + ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c ) set (ENB_APP_SRC diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c48f8f67fb..c9c42a41d9 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -256,6 +256,12 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_init_cont_mac_stats_update(mod_id); new_thread(receive_thread, &enb_agent[mod_id]); + + /*Initialize and register the mac xface. Must be modified later + *for more flexibility in agent management */ + + 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 diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index f191d86907..1ef2250483 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,7 +44,7 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; -extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB][ENB_AGENT_MAX]; +extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 157b83581d..05b2a7a364 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -39,6 +39,8 @@ #include "enb_agent_common.h" #include "enb_agent_mac_internal.h" +#include "LAYER2/MAC/proto.h" + #include "log.h" @@ -1158,6 +1160,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; mac_agent_registered[mod_id] = 1; @@ -1172,6 +1175,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; xface->enb_agent_send_update_mac_stats = NULL; + xface->enb_agent_schedule_ue_spec = NULL; mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index f6dccb1570..67b89bf610 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -53,7 +53,14 @@ typedef struct { /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration void (*enb_agent_send_update_mac_stats)(mid_t mod_id); - + + /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that + /// dl_info is already initialized as prp_dl_mac_config and fills the + /// prp_dl_data part of it + void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, + unsigned int *nb_rb_used, unsigned int *nCCE_used, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c new file mode 100644 index 0000000000..5adc4abc40 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -0,0 +1,944 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue.c + * \brief procedures related to eNB for the DLSCH transport channel + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "assertions.h" +#include "PHY/defs.h" +#include "PHY/extern.h" + +#include "SCHED/defs.h" +#include "SCHED/extern.h" + +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/extern.h" +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" +#include "OCG.h" +#include "OCG_extern.h" + +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + +#include "ENB_APP/enb_agent_defs.h" + +//#include "LAYER2/MAC/pre_processor.c" +#include "pdcp.h" + +#include "header.pb-c.h" +#include "progran.pb-c.h" + +#include "SIMULATION/TOOLS/defs.h" // for taus + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#define ENABLE_MAC_PAYLOAD_DEBUG + +//------------------------------------------------------------------------------ +void +schedule_ue_spec_default( + mid_t mod_id, + uint32_t frame, + uint32_t subframe, + unsigned int *nb_rb_used, + unsigned int *nCCE_used, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_info +) +//------------------------------------------------------------------------------ +{ + //TODO + uint8_t CC_id; + int UE_id; + uint16_t nCCE[MAX_NUM_CCs]; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + void *DLSCH_dci = NULL; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; + // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int continue_flag=0; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + Protocol__PrpDlData *dl_data[NUM_MAX_UE]; + int num_ues_added = 0; + + Protocol__PrpDlDci *dl_dci; + Protocol__PrpRlcPdu *rlc_pdus[11]; + uint32_t *ce_bitmap; + Protocol__PrpRlcPdu **rlc_pdu; + int num_tb; + uint32_t ce_flags = 0; + + uint8_t rballoc_sub[25]; + int i; + + + if (UE_list->head==-1) { + return; + } + + start_meas(&eNB->schedule_dlsch); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); + + //weight = get_ue_weight(module_idP,UE_id); + aggregation = 1; // set to the maximum aggregation level + + for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); + total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; + nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; + + // store the global enb stats: + eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; + eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id]; + eNB->eNB_stats[CC_id].dlsch_bytes_tx=0; + eNB->eNB_stats[CC_id].dlsch_pdus_tx=0; + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN); + + start_meas(&eNB->schedule_dlsch_preprocessor); + dlsch_scheduler_pre_processor(mod_id, + frame, + subframe, + N_RBG, + mbsfn_flag); + stop_meas(&eNB->schedule_dlsch_preprocessor); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); + + for (CC_id=0; CC_id0) + continue; + + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + continue_flag=0; // reset the flag to allow allocation for the remaining UEs + rnti = UE_RNTI(mod_id, UE_id); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + if (rnti==NOT_A_RNTI) { + LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); + // mac_xface->macphy_exit("Cannot find rnti for UE_id"); + continue_flag=1; + } + + if (eNB_UE_stats==NULL) { + LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); + // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); + continue_flag=1; + } + + if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) + continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 + // else + // break; + } + + if (frame_parms[CC_id]->frame_type == TDD) { + set_ue_dai (subframe, + frame_parms[CC_id]->tdd_config, + UE_id, + CC_id, + UE_list); + // update UL DAI after DLSCH scheduling + set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); + } + + if (continue_flag == 1 ) { + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_NONE); + continue; + } + + // After this point all the UEs will be scheduled + // TODO create a Protocol__PrpDlData struct for the UE + dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); + protocol__prp_dl_data__init(dl_data[num_ues_added]); + dl_data[num_ues_added]->has_rnti = 1; + dl_data[num_ues_added]->rnti = rnti; + dl_data[num_ues_added]->n_rlc_pdu = 0; + dl_data[num_ues_added]->has_serv_cell_index = 1; + dl_data[num_ues_added]->serv_cell_index = CC_id; + + nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; + harq_pid = ue_sched_ctl->harq_pid[CC_id]; + round = ue_sched_ctl->round[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + + + sdu_length_total=0; + num_sdus=0; + + /* + DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), + eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); + */ + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + + +#ifdef EXMIMO + + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + } + +#endif + + // store stats + UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + + // initializing the rb allocation indicator for each UE + for(j=0; jN_RBG; j++) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; + } + + LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", + mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, + eNB_UE_stats->DL_cqi[0], eNB_UE_stats->dlsch_mcs1, + nCCE[CC_id], + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + + dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); + protocol__prp_dl_dci__init(dl_dci); + dl_data[num_ues_added]->dl_dci = dl_dci; + + + dl_dci->has_rnti = 1; + dl_dci->rnti = rnti; + dl_dci->has_harq_process = 1; + dl_dci->harq_process = harq_pid; + + /* process retransmission */ + + if (round > 0) { + + if (frame_parms[CC_id]->frame_type == TDD) { + UE_list->UE_template[CC_id][UE_id].DAI++; + update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); + LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", + CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); + } + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + if (nb_rb <= nb_available_rb) { + + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + } + } else { + nb_rb_temp = nb_rb; + j = 0; + + while((nb_rb_temp > 0) && (jN_RBG)) { + if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + if((j == frame_parms[CC_id]->N_RBG-1) && + ((frame_parms[CC_id]->N_RB_DL == 25)|| + (frame_parms[CC_id]->N_RB_DL == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + } else { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; + } + } + + j = j + 1; + } + } + + nb_available_rb -= nb_rb; + aggregation = process_ue_cqi(mod_id, UE_id); + nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; + + for(j=0; jN_RBG; j++) { + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + } + + switch (mac_xface->get_transmission_mode(mod_id,CC_id,rnti)) { + case 1: + case 2: + default: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 4: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->ndi[1] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->rv[1] = round&3; + + break; + case 5: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + + break; + case 6: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + + break; + } + + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_SCHEDULED); + + //eNB_UE_stats->dlsch_trials[round]++; + UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + } else { + LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", + mod_id, frame, CC_id, UE_id); + } + + num_ues_added += 1; + + } else { /* This is a potentially new SDU opportunity */ + + rlc_status.bytes_in_buffer = 0; + // Now check RLC information to compute number of required RBs + // get maximum TBS size for RLC request + //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + // check first for RLC data on DCCH + // add the length for all the control elements (timing adv, drx, etc) : header + payload + + //#ifndef EXMIMO_IOT + // to be checked by RK, NN, FK + uint8_t update_TA=4; + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + update_TA = 1; + break; + + case 25: + update_TA = 4; + break; + + case 50: + update_TA = 8; + break; + + case 100: + update_TA = 16; + break; + } + + ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0; + + dl_data[num_ues_added]->n_ce_bitmap = 2; + dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); + + if (ta_len > 0) { + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; + } + + + header_len_dcch = 2; // 2 bytes DCCH SDU subheader + + if ( TBS-ta_len-header_len_dcch > 0 ) { + + + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH, + (TBS-ta_len-header_len_dcch)); // transport block set size + + if (rlc_status.bytes_in_buffer > 0) { + sdu_length_total = cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch); + // TODO: This should be replaced with the proper description of the CE + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CR; + } else { + header_len_dcch = 0; + sdu_length_total = 0; + } + } + + // check for DCCH1 and update header information (assume 2 byte sub-header) + if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH+1, + (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + // DCCH SDU + + if (rlc_status.bytes_in_buffer > 0) { + // TODO: Again hypothetical flag. Need to check how to find the actual type of CE + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CA; + sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total); + header_len_dcch += 2; + } + } + + // Add the control element flags to the progran message + dl_data[num_ues_added]->ce_bitmap = ce_flags; + + // check for DTCH and update header information + // here we should loop over all possible DTCH + + header_len_dtch = 3; // 3 bytes DTCH SDU subheader + + LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", + mod_id, frame, CC_id, DTCH, TBS, + TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DTCH, + TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if (rlc_status.bytes_in_buffer > 0) { + + //TODO: Set rlc pdu info. Hardcoded for the moment + + dl_data[num_ues_added]->n_rlc_pdu++; + rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[0]); + rlc_pdus[0]->n_rlc_pdu_tb = 2; + rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; + rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; + + // Add rlc_pdus to the dl_data message + dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->n_rlc_pdu); + for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; + } + + sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if(cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch) < 128) { + header_len_dtch = 2; + } + + } else { + header_len_dtch = 0; + } + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch )> 0)) { + // Now compute number of required RBs for total sdu length + // Assume RAH format 2 + // adjust header lengths + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + mcs = eNB_UE_stats->dlsch_mcs1; + + if (mcs==0) { + nb_rb = 4; // don't let the TBS get too small + } else { + nb_rb=min_rb_unit[CC_id]; + } + + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + + while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { + nb_rb += min_rb_unit[CC_id]; // + + if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs + // (can happen if N_RB_DL is odd) + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + nb_rb = nb_available_rb; + break; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb); + } + + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + } + } else { + nb_rb_temp = nb_rb; + j = 0; + + while((nb_rb_temp > 0) && (jN_RBG)) { + if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + + if ((j == frame_parms[CC_id]->N_RBG-1) && + ((frame_parms[CC_id]->N_RB_DL == 25)|| + (frame_parms[CC_id]->N_RB_DL == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + } else { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; + } + } + + j = j+1; + } + } + + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; + + for(j=0; jN_RBG; j++) { + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + } + + // decrease mcs until TBS falls below required length + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) { + mcs--; + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + } + + // if we have decreased too much or we don't have enough RBs, increase MCS + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs<28)) + || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs<=15)))) { + mcs++; + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + } + + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * 2); + dl_dci->tbs_size[0] = TBS; + dl_dci->tbs_size[1] = TBS; + + LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n",eNB_UE_stats->dlsch_mcs1, mcs); + + aggregation = process_ue_cqi(mod_id,UE_id); + dl_dci->has_aggr_level = 1; + dl_dci->aggr_level = aggregation; + dl_dci->has_cce_index = 1; + dl_dci->cce_index = nCCE_used[CC_id]; + nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; + + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_SCHEDULED); + + if (frame_parms[CC_id]->frame_type == TDD) { + UE_list->UE_template[CC_id][UE_id].DAI++; + // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); +#warning only for 5MHz channel + update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); + } + + // do PUCCH power control + // this is the normalized RX power + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + normalized_rx_power = eNB_UE_stats->Po_PUCCH_dBm; + target_rx_power = mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; + + // this assumes accumulated tpc + // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out + int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; + + if (((framex10psubframe+10)<=(frame*10+subframe)) || //normal case + ((framex10psubframe>(frame*10+subframe)) && (((10240-framex10psubframe+frame*10+subframe)>=10)))) //frame wrap-around + if (eNB_UE_stats->Po_PUCCH_update == 1) { + eNB_UE_stats->Po_PUCCH_update = 0; + + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frame; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframe; + if (normalized_rx_power>(target_rx_power+1)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power<(target_rx_power-1)) { + tpc = 2; //+1 + tpc_accumulated++; + } else { + tpc = 1; //0 + } + LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", + mod_id, frame, subframe, harq_pid, tpc, + tpc_accumulated, normalized_rx_power, target_rx_power); + } // Po_PUCCH has been updated + else { + tpc = 1; //0 + } // time to do TPC update + else { + tpc = 1; //0 + } + + for(i=0; ilte_frame_parms.N_RBG; i++) { + rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; + } + + switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { + case 1: + case 2: + default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 3: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 0; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->rv[1] = 1; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = 0; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 0; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->rv[1] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = 0; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + + break; + case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + break; + } + // Toggle NDI for next time + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frame, subframe, UE_id, + UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + + // Increase the pointer for the number of scheduled UEs + num_ues_added++; + } else { // There is no data from RLC or MAC header, so don't schedule + + } + } + if (frame_parms[CC_id]->frame_type == TDD) { + set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); + } + } + } + + // Add all the dl_data elements to the progran message + dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; + dl_info->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + for (i = 0; i < num_ues_added; i++) { + dl_info->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; + } + + stop_meas(&eNB->schedule_dlsch); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); +} diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 329c40be05..0de9253fef 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,6 +59,10 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" + #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif @@ -85,6 +89,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, int mbsfn_status[MAX_NUM_CCs]; uint32_t RBalloc[MAX_NUM_CCs]; protocol_ctxt_t ctxt; + + Protocol__ProgranMessage *msg; + #ifdef EXMIMO int ret; #endif @@ -275,7 +282,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,1,5,nCCE); } @@ -287,7 +306,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // TDD, nothing // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,2,6,nCCE); } @@ -306,7 +337,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -314,7 +357,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,3,7,nCCE); @@ -341,7 +396,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; @@ -352,7 +419,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD // schedule_RA(module_idP,frameP, subframeP, 0, nprb, nCCE); // schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8, nCCE); - schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, RBalloc, 1, mbsfn_status); } @@ -408,13 +487,37 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 5: schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -423,7 +526,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -438,12 +553,36 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3,nprb,nCCE); // 3 = Msg3 subframeP, not - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -452,7 +591,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -472,7 +623,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP,nprb,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -481,7 +644,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -495,28 +670,76 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); schedule_RA(module_idP,frameP,subframeP,7,nprb,nCCE); // 7 = Msg3 subframeP, not - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE); //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -525,7 +748,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index d02e42ee16..28df04ef64 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -35,6 +35,11 @@ */ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ + +#include "enb_agent_defs.h" +#include "header.pb-c.h" +#include "progran.pb-c.h" + /** \addtogroup _mac * @{ */ @@ -139,6 +144,11 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,u */ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,unsigned int *nb_rb_used0,unsigned int *nCCE_used,int *mbsfn_flag); +//To be used by the agent +void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + unsigned int *nb_rb_used, unsigned int *nCCE_used, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. @param Mod_id Module id of UE @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE From cdb3e36b9949f15dbfbe57f0b62dd7af217df19b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sun, 31 Jan 2016 18:13:05 +0000 Subject: [PATCH 050/182] Fixes to merge with develop --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 691 ++++++++++++++++-- openair2/LAYER2/MAC/eNB_scheduler.c | 273 +------ 2 files changed, 630 insertions(+), 334 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 5adc4abc40..30894909a7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -129,6 +129,8 @@ schedule_ue_spec_default( uint8_t rballoc_sub[25]; int i; + uint32_t data_to_request; + uint32_t dci_tbs; if (UE_list->head==-1) { @@ -233,10 +235,10 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + //UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; sdu_length_total=0; @@ -246,20 +248,22 @@ schedule_ue_spec_default( DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); */ - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + + mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); #ifdef EXMIMO - if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); - } + // if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + // eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + // } #endif // store stats - UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; // initializing the rb allocation indicator for each UE for(j=0; jN_RBG; j++) { @@ -268,7 +272,7 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, - eNB_UE_stats->DL_cqi[0], eNB_UE_stats->dlsch_mcs1, + eNB_UE_stats->DL_cqi[0], mcs, nCCE[CC_id], UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); @@ -338,8 +342,21 @@ schedule_ue_spec_default( case 1: case 2: default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; //eNB_UE_stats->dlsch_mcs1; + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid], UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; @@ -357,12 +374,20 @@ schedule_ue_spec_default( } break; case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; dl_dci->ndi[1] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 2; @@ -372,11 +397,19 @@ schedule_ue_spec_default( break; case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; @@ -392,11 +425,19 @@ schedule_ue_spec_default( break; case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; @@ -415,18 +456,18 @@ schedule_ue_spec_default( S_DL_SCHEDULED); //eNB_UE_stats->dlsch_trials[round]++; - UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + + num_ues_added += 1; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); } - - num_ues_added += 1; } else { /* This is a potentially new SDU opportunity */ @@ -434,7 +475,8 @@ schedule_ue_spec_default( // Now check RLC information to compute number of required RBs // get maximum TBS size for RLC request //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); + dci_tbs = TBS; // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -468,13 +510,19 @@ schedule_ue_spec_default( if (ta_len > 0) { ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; } - + + + // Add the control element flags to the progran message + dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; + dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; header_len_dcch = 2; // 2 bytes DCCH SDU subheader + // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - + //If we have space, we need to see how much data we can request at most (if any are available) + rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -485,10 +533,30 @@ schedule_ue_spec_default( DCCH, (TBS-ta_len-header_len_dcch)); // transport block set size + //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - sdu_length_total = cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch); - // TODO: This should be replaced with the proper description of the CE - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CR; + + // Fill at most 1/3 of the remaining TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[0]); + rlc_pdus[0]->n_rlc_pdu_tb = 2; + rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DCCH; + rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + + //Set this to the max value that we might request + sdu_length_total = data_to_request; } else { header_len_dcch = 0; sdu_length_total = 0; @@ -496,7 +564,9 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) { + if (TBS-ta_len-header_len_dcch+2-sdu_length_total > 0 ) { + + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -505,20 +575,36 @@ schedule_ue_spec_default( ENB_FLAG_YES, MBMS_FLAG_NO, DCCH+1, - (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + (TBS-ta_len-header_len_dcch+2-sdu_length_total)); // transport block set size less allocations for timing advance and // DCCH SDU + // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { - // TODO: Again hypothetical flag. Need to check how to find the actual type of CE - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CA; - sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total); header_len_dcch += 2; + + //Fill another 1/3 of the remaining TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[1]); + rlc_pdus[1]->n_rlc_pdu_tb = 2; + rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[1]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[1]->rlc_pdu_tb[1]->logical_channel_id = DCCH+1; + rlc_pdus[1]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[1]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + + sdu_length_total += data_to_request; } } - // Add the control element flags to the progran message - dl_data[num_ues_added]->ce_bitmap = ce_flags; - // check for DTCH and update header information // here we should loop over all possible DTCH @@ -529,6 +615,8 @@ schedule_ue_spec_default( TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -539,36 +627,31 @@ schedule_ue_spec_default( DTCH, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + // If data are available in DTCH if (rlc_status.bytes_in_buffer > 0) { - //TODO: Set rlc pdu info. Hardcoded for the moment + //Fill what remains in the TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[2]); + rlc_pdus[2]->n_rlc_pdu_tb = 2; + rlc_pdus[2]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[2]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[2]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[2]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[2]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[2]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[2]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[2]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[2]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[2]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[2]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[0]); - rlc_pdus[0]->n_rlc_pdu_tb = 2; - rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; - rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; - // Add rlc_pdus to the dl_data message - dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * - dl_data[num_ues_added]->n_rlc_pdu); - for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { - dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; - } + sdu_length_total += data_to_request; - sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - if(cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch) < 128) { + if(data_to_request < 128) { header_len_dtch = 2; } @@ -577,41 +660,53 @@ schedule_ue_spec_default( } } + // Add rlc_pdus to the dl_data message + dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->n_rlc_pdu); + for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; + } + // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch )> 0)) { + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths header_len_dcch_tmp = header_len_dcch; header_len_dtch_tmp = header_len_dtch; - if (header_len_dtch==0) { + if (header_len_dtch == 0) { header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field } else { header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU } - mcs = eNB_UE_stats->dlsch_mcs1; + int mcs2; - if (mcs==0) { + mcs2 = mcs; + + // TODO: Need to compute this and not take it from the stats + // mcs = eNB_UE_stats->dlsch_mcs1; + + if (mcs2==0) { nb_rb = 4; // don't let the TBS get too small } else { nb_rb=min_rb_unit[CC_id]; } - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs2, nb_available_rb); nb_rb = nb_available_rb; break; } - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs, nb_rb); } if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -647,16 +742,16 @@ schedule_ue_spec_default( } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) { - mcs--; - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs2>0)) { + mcs2--; + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs<28)) - || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs<=15)))) { - mcs++; - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs2<28)) + || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs2<=15)))) { + mcs2++; + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); } dl_dci->n_tbs_size = 2; @@ -664,7 +759,7 @@ schedule_ue_spec_default( dl_dci->tbs_size[0] = TBS; dl_dci->tbs_size[1] = TBS; - LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n",eNB_UE_stats->dlsch_mcs1, mcs); + LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n", mcs, mcs2); aggregation = process_ue_cqi(mod_id,UE_id); dl_dci->has_aggr_level = 1; @@ -745,7 +840,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -754,6 +849,9 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t)); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -777,7 +875,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -812,7 +910,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; // 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -846,7 +944,7 @@ schedule_ue_spec_default( dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi = 1;//(uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -915,10 +1013,10 @@ schedule_ue_spec_default( break; } // Toggle NDI for next time - LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", - CC_id, frame, subframe, UE_id, - UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + //LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + // CC_id, frame, subframe, UE_id, + // UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + //UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; @@ -942,3 +1040,436 @@ schedule_ue_spec_default( stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } + +void apply_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + uint32_t *rballoc, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info) { + + uint8_t CC_id; + int UE_id; + uint16_t nCCE[MAX_NUM_CCs]; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + void *DLSCH_dci = NULL; + DCI_PDU *DCI_pdu; + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + int i; + int size_bits,size_bytes; + + Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + Protocol__PrpDlData *dl_data; + Protocol__PrpDlDci *dl_dci; + + uint32_t rlc_size, n_lc, lcid; + + // Check if there is any scheduling command for UE data + if (mac_config->n_dl_ue_data > 0) { + + // For each UE-related command + for (i = 0; i < mac_config->n_dl_ue_data; i++) { + + dl_data = mac_config->dl_ue_data[i]; + dl_dci = dl_data->dl_dci; + + CC_id = dl_data->serv_cell_index; + rnti = dl_data->rnti; + UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + //NOTICE: Maybe later will not be required, once scheduler fully restructured + eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; + + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + round = dl_dci->rv[0]; + harq_pid = dl_dci->harq_process; + + // Note this code is for a specific DCI format + DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; + DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_TDD_t); + size_bits = sizeof_DCI1_1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_FDD_t); + size_bits = sizeof_DCI1_1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 25: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_TDD_t); + size_bits = sizeof_DCI1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + if (dl_dci->has_rb_bitmap) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + } + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_FDD_t); + size_bits = sizeof_DCI1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 50: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_TDD_t); + size_bits = sizeof_DCI1_10MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_FDD_t); + size_bits = sizeof_DCI1_10MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 100: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_TDD_t); + size_bits = sizeof_DCI1_20MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_FDD_t); + size_bits = sizeof_DCI1_20MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + } + + // If this is a new transmission + if (round == 0) { + // First we have to deal with the creation of the PDU based on the message instructions + rlc_status.bytes_in_buffer = 0; + + TBS = dl_dci->tbs_size[0]; + + if (dl_data->n_ce_bitmap > 0) { + //Check if there is TA command + if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { + ta_len = 2; + } else { + ta_len = 0; + } + } + + n_lc = dl_data->n_rlc_pdu; + num_sdus = 0; + // Go through each one of the channel commands and create SDUs + for (i = 0; i < n_lc; i++) { + lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; + + if (rlc_size > 0) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size + + sdu_lengths[i]=0; + + LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); + + sdu_lengths[i] += mac_rlc_data_req( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_lengths[i]]); + + LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + sdu_lcids[i] = lcid; + + if (lcid == DCCH || lcid == DCCH+1) { + header_len_dcch += 2; + } else if (lcid == DTCH) { + if (sdu_lengths[i] < 128) { + header_len_dtch = 2; + } else { + header_len_dtch = 3; + } + } + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[i]; + num_sdus++; + + } + } // SDU creation end + + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; + + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + } + } + + uint8_t update_TA=4; + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + update_TA = 1; + break; + + case 25: + update_TA = 4; + break; + + case 50: + update_TA = 8; + break; + + case 100: + update_TA = 16; + break; + } + + if (ta_len > 0) { + ta_update = eNB_UE_stats->timing_advance_update/update_TA; + } else { + ta_update = 0; + } + /*#else + ta_update = 0; + #endif*/ + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + +#ifdef DEBUG_eNB_SCHEDULER + LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); + + for (i=0; i<16; i++) { + LOG_T(MAC,"%x.",dlsch_buffer[i]); + } + + LOG_T(MAC,"\n"); +#endif + // cycle through SDUs and place in dlsch_buffer + memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); + // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); + + // fill remainder of DLSCH with random data + for (j=0; j<(TBS-sdu_length_total-offset); j++) { + UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); + } + + //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); + if (opt_enabled == 1) { + trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), + eNB->subframe,0,0); + LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", + mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); + } + + // store stats + eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; + eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used = nCCE[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; + + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; + UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + // TODO + + + } else { + // No need to create anything apart of DCI in case of retransmission + } + + //Add DCI based on format + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + process_ue_cqi (mod_id, UE_id),//aggregation + size_bits, + format1, + 0); + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + process_ue_cqi (mod_id, UE_id),//aggregation + size_bits, + format2A, + 0); + } + } + } +} + diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 0de9253fef..329c40be05 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,10 +59,6 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -//Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" - #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif @@ -89,9 +85,6 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, int mbsfn_status[MAX_NUM_CCs]; uint32_t RBalloc[MAX_NUM_CCs]; protocol_ctxt_t ctxt; - - Protocol__ProgranMessage *msg; - #ifdef EXMIMO int ret; #endif @@ -282,19 +275,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,1,5,nCCE); } @@ -306,19 +287,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // TDD, nothing // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,2,6,nCCE); } @@ -337,19 +306,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -357,19 +314,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,3,7,nCCE); @@ -396,19 +341,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; @@ -419,19 +352,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD // schedule_RA(module_idP,frameP, subframeP, 0, nprb, nCCE); // schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8, nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); + schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, RBalloc, 1, mbsfn_status); } @@ -487,37 +408,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 5: schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -526,19 +423,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -553,36 +438,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3,nprb,nCCE); // 3 = Msg3 subframeP, not - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 5: - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -591,19 +452,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -623,19 +472,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP,nprb,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -644,19 +481,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -670,76 +495,28 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); schedule_RA(module_idP,frameP,subframeP,7,nprb,nCCE); // 7 = Msg3 subframeP, not - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE); //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -748,19 +525,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } From a91a25c97258ab6307628dc2de10b5f5359ae9e8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 1 Feb 2016 11:38:07 +0000 Subject: [PATCH 051/182] Changed signature of DL scheduling function of agent --- openair2/ENB_APP/enb_agent_mac_defs.h | 1 - .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 67b89bf610..c2891e87ca 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -58,7 +58,6 @@ typedef struct { /// dl_info is already initialized as prp_dl_mac_config and fills the /// prp_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 30894909a7..7435194d33 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -78,8 +78,6 @@ schedule_ue_spec_default( mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, - unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info ) @@ -146,8 +144,8 @@ schedule_ue_spec_default( for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); - total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; - nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + //total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; + //nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; // store the global enb stats: @@ -195,8 +193,8 @@ schedule_ue_spec_default( } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + // LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", + // mod_id, frame, UE_id, CC_id, nb_rb_used[CC_id], ue_sched_ctl->pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 // else @@ -329,7 +327,7 @@ schedule_ue_spec_default( nb_available_rb -= nb_rb; aggregation = process_ue_cqi(mod_id, UE_id); nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -765,9 +763,9 @@ schedule_ue_spec_default( dl_dci->has_aggr_level = 1; dl_dci->aggr_level = aggregation; dl_dci->has_cce_index = 1; - dl_dci->cce_index = nCCE_used[CC_id]; + // dl_dci->cce_index = nCCE_used[CC_id]; nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; add_ue_dlsch_info(mod_id, @@ -1044,7 +1042,6 @@ schedule_ue_spec_default( void apply_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, - uint32_t *rballoc, int *mbsfn_flag, Protocol__ProgranMessage *dl_scheduling_info) { From ab0e4aadaebe1fc40d4a4359f76424b866685210 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 1 Feb 2016 17:20:35 +0000 Subject: [PATCH 052/182] Reintroduced support for agent scheduler after merge with develop --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 476 +++++++++--------- openair2/LAYER2/MAC/eNB_scheduler.c | 441 +++++++++++++++- openair2/LAYER2/MAC/proto.h | 1 - 3 files changed, 668 insertions(+), 250 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 7435194d33..a4fbac6de2 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -86,7 +86,6 @@ schedule_ue_spec_default( //TODO uint8_t CC_id; int UE_id; - uint16_t nCCE[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; @@ -103,9 +102,8 @@ schedule_ue_spec_default( // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - int mcs; + int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; - short ta_update = 0; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; @@ -144,15 +142,18 @@ schedule_ue_spec_default( for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); - //total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; - //nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + // get number of PRBs less those used by common channels + total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL; + for (i=0;iN_RB_DL;i++) + if (eNB->common_channels[CC_id].vrb_map[i]!=0) + total_nb_available_rb[CC_id]--; + N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; // store the global enb stats: eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id]; - eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id]; eNB->eNB_stats[CC_id].dlsch_bytes_tx=0; eNB->eNB_stats[CC_id].dlsch_pdus_tx=0; } @@ -192,15 +193,17 @@ schedule_ue_spec_default( continue_flag=1; } - if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated + CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti) + ) { + LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", + mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 // else // break; } - + if (frame_parms[CC_id]->frame_type == TDD) { set_ue_dai (subframe, frame_parms[CC_id]->tdd_config, @@ -233,6 +236,8 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; + + /* TODO: Must add these stats (probably in the apply_scheduling function) */ //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; @@ -248,15 +253,18 @@ schedule_ue_spec_default( */ mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + + /*TODO: Must also update these stats*/ //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); #ifdef EXMIMO - // if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { - // eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); - // } + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + } #endif @@ -264,14 +272,13 @@ schedule_ue_spec_default( //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; // initializing the rb allocation indicator for each UE - for(j=0; jN_RBG; j++) { + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; } - LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", + LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, eNB_UE_stats->DL_cqi[0], mcs, - nCCE[CC_id], UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); @@ -301,14 +308,14 @@ schedule_ue_spec_default( if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (jN_RBG)) { + while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; if((j == frame_parms[CC_id]->N_RBG-1) && @@ -326,8 +333,6 @@ schedule_ue_spec_default( nb_available_rb -= nb_rb; aggregation = process_ue_cqi(mod_id, UE_id); - nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -344,7 +349,8 @@ schedule_ue_spec_default( dl_dci->res_alloc = 0; dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; //eNB_UE_stats->dlsch_mcs1; + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -352,7 +358,7 @@ schedule_ue_spec_default( dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid], UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; @@ -374,29 +380,48 @@ schedule_ue_spec_default( case 4: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; dl_dci->ndi[1] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; dl_dci->rv[1] = round&3; - + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } break; case 5: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; @@ -404,8 +429,8 @@ schedule_ue_spec_default( dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; @@ -425,6 +450,12 @@ schedule_ue_spec_default( case 6: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; @@ -432,8 +463,8 @@ schedule_ue_spec_default( dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; @@ -447,17 +478,18 @@ schedule_ue_spec_default( break; } - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_SCHEDULED); + /*We now probably don't need this*/ + /* add_ue_dlsch_info(mod_id, */ + /* CC_id, */ + /* UE_id, */ + /* subframe, */ + /* S_DL_SCHEDULED); */ //eNB_UE_stats->dlsch_trials[round]++; //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; @@ -475,33 +507,12 @@ schedule_ue_spec_default( //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; + // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload - //#ifndef EXMIMO_IOT - // to be checked by RK, NN, FK - uint8_t update_TA=4; - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - update_TA = 1; - break; - - case 25: - update_TA = 4; - break; - - case 50: - update_TA = 8; - break; - - case 100: - update_TA = 16; - break; - } - - ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0; - + ta_len = (ue_sched_ctl->ta_update!=0) ? 2 : 0; + dl_data[num_ues_added]->n_ce_bitmap = 2; dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); @@ -509,6 +520,7 @@ schedule_ue_spec_default( ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; } + /*TODO: Add other flags if DRX and other CE are required*/ // Add the control element flags to the progran message dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; @@ -519,24 +531,22 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - //If we have space, we need to see how much data we can request at most (if any are available) - - rlc_status = mac_rlc_status_ind( - mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH, - (TBS-ta_len-header_len_dcch)); // transport block set size + //If we have space, we need to see how much data we can request at most (if any available) + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH, + (dci_tbs-ta_len-header_len_dcch)); // transport block set size //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - - // Fill at most 1/3 of the remaining TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); - + LOG_D(MAC, "[TEST]Have %d bytes in buffer DCCH during first call\n", rlc_status.bytes_in_buffer); + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; + LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[0]); rlc_pdus[0]->n_rlc_pdu_tb = 2; @@ -562,26 +572,25 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (TBS-ta_len-header_len_dcch+2-sdu_length_total > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind( - mod_id, + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH+1, - (TBS-ta_len-header_len_dcch+2-sdu_length_total)); // transport block set size less allocations for timing advance and + (dci_tbs-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and // DCCH SDU // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { header_len_dcch += 2; - - //Fill another 1/3 of the remaining TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[1]); @@ -589,7 +598,7 @@ schedule_ue_spec_default( rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH+1; rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); @@ -610,27 +619,26 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", mod_id, frame, CC_id, DTCH, TBS, - TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind( - mod_id, + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, DTCH, - TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); // If data are available in DTCH if (rlc_status.bytes_in_buffer > 0) { - + LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); //Fill what remains in the TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); - + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; + LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[2]); rlc_pdus[2]->n_rlc_pdu_tb = 2; @@ -654,14 +662,14 @@ schedule_ue_spec_default( } } else { - header_len_dtch = 0; + header_len_dtch = 3; } } // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); - for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) { dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; } @@ -674,51 +682,48 @@ schedule_ue_spec_default( header_len_dtch_tmp = header_len_dtch; if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch > 0) ? 1 : header_len_dcch; // remove length field } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } - int mcs2; - - mcs2 = mcs; + mcs_tmp = mcs; // TODO: Need to compute this and not take it from the stats // mcs = eNB_UE_stats->dlsch_mcs1; - if (mcs2==0) { + if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small } else { nb_rb=min_rb_unit[CC_id]; } - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // - if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs + if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) - TBS = mac_xface->get_TBS_DL(mcs2, nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb); nb_rb = nb_available_rb; break; } - TBS = mac_xface->get_TBS_DL(mcs, nb_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (jN_RBG)) { + while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if ((j == frame_parms[CC_id]->N_RBG-1) && ((frame_parms[CC_id]->N_RB_DL == 25)|| (frame_parms[CC_id]->N_RB_DL == 50))) { @@ -735,44 +740,41 @@ schedule_ue_spec_default( PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j=0; jN_RBG; j++) { + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs2>0)) { - mcs2--; - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs_tmp > 0)) { + mcs_tmp--; + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs2<28)) - || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs2<=15)))) { - mcs2++; - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && + ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28)) || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) { + mcs_tmp++; + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * 2); - dl_dci->tbs_size[0] = TBS; - dl_dci->tbs_size[1] = TBS; + LOG_D(MAC,"dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); - LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n", mcs, mcs2); + dci_tbs = TBS; + + mcs = mcs_tmp; aggregation = process_ue_cqi(mod_id,UE_id); dl_dci->has_aggr_level = 1; dl_dci->aggr_level = aggregation; - dl_dci->has_cce_index = 1; - // dl_dci->cce_index = nCCE_used[CC_id]; - nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_SCHEDULED); + /*Deactivate here as well*/ + /* add_ue_dlsch_info(mod_id, */ + /* CC_id, */ + /* UE_id, */ + /* subframe, */ + /* S_DL_SCHEDULED); */ if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; @@ -838,8 +840,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_rv = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; @@ -848,16 +850,11 @@ schedule_ue_spec_default( dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t)); + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 3: @@ -873,26 +870,25 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; - dl_dci->rv[1] = 1; + dl_dci->rv[1] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 2; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = 0; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 4: @@ -901,33 +897,32 @@ schedule_ue_spec_default( dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; // 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; - dl_dci->rv[1] = round&3; + dl_dci->rv[1] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 2; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = 0; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 5: @@ -942,8 +937,8 @@ schedule_ue_spec_default( dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; - dl_dci->ndi = 1;//(uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -952,14 +947,12 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { @@ -985,7 +978,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -997,11 +990,6 @@ schedule_ue_spec_default( if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } dl_dci->has_dl_power_offset = 1; @@ -1011,14 +999,14 @@ schedule_ue_spec_default( break; } // Toggle NDI for next time - //LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", - // CC_id, frame, subframe, UE_id, - // UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - //UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frame, subframe, UE_id, + UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; - } else { // There is no data from RLC or MAC header, so don't schedule + } else { // There is no data from RLC or MAC header, so don't schedule } } @@ -1047,7 +1035,6 @@ void apply_scheduling_decisions(mid_t mod_id, uint8_t CC_id; int UE_id; - uint16_t nCCE[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; @@ -1097,7 +1084,7 @@ void apply_scheduling_decisions(mid_t mod_id, UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); //NOTICE: Maybe later will not be required, once scheduler fully restructured - eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; + //eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -1275,6 +1262,7 @@ void apply_scheduling_decisions(mid_t mod_id, ta_len = 0; } } + n_lc = dl_data->n_rlc_pdu; num_sdus = 0; @@ -1282,7 +1270,7 @@ void apply_scheduling_decisions(mid_t mod_id, for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - + LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { rlc_status = mac_rlc_status_ind( mod_id, @@ -1294,11 +1282,13 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, rlc_size); // transport block set size - sdu_lengths[i]=0; + sdu_lengths[i] = 0; LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); + LOG_D(MAC, "[TEST] Have %d bytes in buffer DCCH during second call\n", rlc_status.bytes_in_buffer); + sdu_lengths[i] += mac_rlc_data_req( mod_id, rnti, @@ -1309,6 +1299,8 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_lengths[i]]); + LOG_D(MAC, "[TEST] This is what I actuallty got %d\n", sdu_lengths[i]); + LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; sdu_lcids[i] = lcid; @@ -1331,72 +1323,58 @@ void apply_scheduling_decisions(mid_t mod_id, } // SDU creation end - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU - } + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { - // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); - post_padding = 0; - } else { - padding = 0; + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header - } - } - - uint8_t update_TA=4; - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - update_TA = 1; - break; - - case 25: - update_TA = 4; - break; - - case 50: - update_TA = 8; - break; - - case 100: - update_TA = 16; - break; - } - - if (ta_len > 0) { - ta_update = eNB_UE_stats->timing_advance_update/update_TA; - } else { - ta_update = 0; - } - /*#else - ta_update = 0; - #endif*/ - - offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], - num_sdus, //num_sdus - sdu_lengths, // - sdu_lcids, - 255, // no drx - ta_update, // timing advance - NULL, // contention res id - padding, - post_padding); - - + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + } + } + + LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); + + + if (ta_len > 0) { + ta_update = ue_sched_ctl->ta_update; + } else { + ta_update = 0; + } + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); @@ -1428,9 +1406,13 @@ void apply_scheduling_decisions(mid_t mod_id, eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used = nCCE[CC_id]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; @@ -1441,6 +1423,10 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; // TODO + + } + + } else { // No need to create anything apart of DCI in case of retransmission diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 21e9337dbb..f0e0a9f84b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,12 +59,18 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" + #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +//#define ENABLE_ENB_AGENT_DL_SCHEDULER + //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -99,6 +105,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list; rnti_t rnti; + Protocol__ProgranMessage *msg; + LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); start_meas(&eNB_mac_inst[module_idP].eNB_scheduler); @@ -252,10 +260,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, (mac_xface->lte_frame_parms->tdd_config == 6)) { //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); } - +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); - +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 1: @@ -267,12 +292,16 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 0: case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; default: @@ -280,8 +309,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,1,5); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -292,8 +340,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,2,6); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -310,8 +377,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -320,8 +406,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,3,7); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -345,9 +450,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); - fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); + fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -358,8 +481,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,frameP, subframeP, 0); schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } } @@ -376,15 +518,55 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { schedule_RA(module_idP,frameP,subframeP,1); schedule_ulsch(module_idP,frameP,cooperation_flag,5,9); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } else if ((mac_xface->lte_frame_parms->tdd_config == 0) || // TDD Config 0 (mac_xface->lte_frame_parms->tdd_config == 6)) { // TDD Config 6 //schedule_ulsch(module_idP,cooperation_flag,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif } else { +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -402,25 +584,67 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 5: schedule_RA(module_idP,frameP,subframeP,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 3: case 4: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -428,8 +652,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -443,13 +686,51 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 5: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -457,8 +738,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -477,8 +777,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -486,8 +805,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -500,29 +838,105 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4); //schedule_RA(module_idP,frameP,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -530,8 +944,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index c522d5920e..faf0bf9954 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -135,7 +135,6 @@ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe //To be used by the agent void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. From 07edce1712e61db5e8d72c908feb59745ad4653c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 2 Feb 2016 16:39:39 +0000 Subject: [PATCH 053/182] Changes to the progran default scheduler --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 264 +++++++++--------- openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index a4fbac6de2..fcf866d657 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -115,6 +115,7 @@ schedule_ue_spec_default( Protocol__PrpDlData *dl_data[NUM_MAX_UE]; int num_ues_added = 0; + int channels_added = 0; Protocol__PrpDlDci *dl_dci; Protocol__PrpRlcPdu *rlc_pdus[11]; @@ -237,11 +238,6 @@ schedule_ue_spec_default( harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - /* TODO: Must add these stats (probably in the apply_scheduling function) */ - //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - //UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; sdu_length_total=0; @@ -363,10 +359,10 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round+1) % 4; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -401,8 +397,8 @@ schedule_ue_spec_default( dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->rv[1] = round&3; + dl_dci->rv[0] = (round+1) % 4; + dl_dci->rv[1] = (round+1) % 4; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -437,7 +433,7 @@ schedule_ue_spec_default( dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round + 1) % 4; if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { ue_sched_ctl->dl_pow_off[CC_id] = 1; @@ -471,28 +467,12 @@ schedule_ue_spec_default( dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round + 1) % 4; dl_dci->has_dl_power_offset = 1; dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; break; } - - /*We now probably don't need this*/ - /* add_ue_dlsch_info(mod_id, */ - /* CC_id, */ - /* UE_id, */ - /* subframe, */ - /* S_DL_SCHEDULED); */ - - //eNB_UE_stats->dlsch_trials[round]++; - //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; - num_ues_added += 1; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", @@ -529,6 +509,7 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader // Need to see if we have space for data from this channel + if ( TBS-ta_len-header_len_dcch > 0 ) { //If we have space, we need to see how much data we can request at most (if any available) @@ -543,26 +524,28 @@ schedule_ue_spec_default( //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in buffer DCCH during first call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST]Have %d bytes in buffer during first call\n", rlc_status.bytes_in_buffer); //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[0]); - rlc_pdus[0]->n_rlc_pdu_tb = 2; - rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DCCH; - rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DCCH; - rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; //Set this to the max value that we might request sdu_length_total = data_to_request; } else { @@ -572,7 +555,7 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, @@ -581,33 +564,36 @@ schedule_ue_spec_default( frame, ENB_FLAG_YES, MBMS_FLAG_NO, - DCCH+1, - (dci_tbs-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + DCCH1, + (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2)); // transport block set size less allocations for timing advance and // DCCH SDU // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { + //Add this subheader header_len_dcch += 2; //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; - rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[1]); - rlc_pdus[1]->n_rlc_pdu_tb = 2; - rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH+1; - rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[1]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[1]->logical_channel_id = DCCH+1; - rlc_pdus[1]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[1]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; sdu_length_total += data_to_request; } } @@ -615,7 +601,7 @@ schedule_ue_spec_default( // check for DTCH and update header information // here we should loop over all possible DTCH - header_len_dtch = 3; // 3 bytes DTCH SDU subheader + header_len_dtch = 3; // Assume max 3 bytes DTCH SDU subheader LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", mod_id, frame, CC_id, DTCH, TBS, @@ -623,6 +609,8 @@ schedule_ue_spec_default( if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + LOG_D(MAC, "[TEST] This is how much we request at most during first call %d\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -639,33 +627,34 @@ schedule_ue_spec_default( //Fill what remains in the TB data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[2]); - rlc_pdus[2]->n_rlc_pdu_tb = 2; - rlc_pdus[2]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[2]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[2]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[2]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[2]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[2]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[2]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[2]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[2]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[2]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[2]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; sdu_length_total += data_to_request; if(data_to_request < 128) { header_len_dtch = 2; } - } else { - header_len_dtch = 3; + header_len_dtch = 0; } } - + // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); @@ -674,7 +663,7 @@ schedule_ue_spec_default( } // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + if (( dl_data[num_ues_added]->n_rlc_pdu > 0)) { // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths @@ -682,15 +671,12 @@ schedule_ue_spec_default( header_len_dtch_tmp = header_len_dtch; if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch > 0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch > 0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field } else { header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } mcs_tmp = mcs; - - // TODO: Need to compute this and not take it from the stats - // mcs = eNB_UE_stats->dlsch_mcs1; if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small @@ -757,7 +743,7 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); + LOG_D(MAC,"[TEST] dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); dci_tbs = TBS; @@ -840,8 +826,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; @@ -870,8 +856,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; - dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; + dl_dci->ndi[1] = 1; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -904,8 +890,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; - dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; + dl_dci->ndi[1] = 1; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -938,10 +924,10 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = 1; - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 1; @@ -978,7 +964,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -1106,7 +1092,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1122,7 +1108,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1142,7 +1128,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1157,10 +1143,8 @@ void apply_scheduling_decisions(mid_t mod_id, if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - if (dl_dci->has_rb_bitmap) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - } - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1180,7 +1164,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1196,7 +1180,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1216,7 +1200,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1232,7 +1216,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1266,14 +1250,17 @@ void apply_scheduling_decisions(mid_t mod_id, n_lc = dl_data->n_rlc_pdu; num_sdus = 0; + sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { - rlc_status = mac_rlc_status_ind( - mod_id, + if (lcid == 3) { + rlc_size--; + } + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, @@ -1287,25 +1274,27 @@ void apply_scheduling_decisions(mid_t mod_id, LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); - LOG_D(MAC, "[TEST] Have %d bytes in buffer DCCH during second call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST] Have %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - sdu_lengths[i] += mac_rlc_data_req( - mod_id, + sdu_lengths[i] += mac_rlc_data_req(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, - (char *)&dlsch_buffer[sdu_lengths[i]]); + (char *)&dlsch_buffer[sdu_lengths[sdu_length_total]]); - LOG_D(MAC, "[TEST] This is what I actuallty got %d\n", sdu_lengths[i]); + LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); - LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; sdu_lcids[i] = lcid; - if (lcid == DCCH || lcid == DCCH+1) { + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (lcid == DCCH || lcid == DCCH1) { header_len_dcch += 2; } else if (lcid == DTCH) { if (sdu_lengths[i] < 128) { @@ -1313,12 +1302,8 @@ void apply_scheduling_decisions(mid_t mod_id, } else { header_len_dtch = 3; } - } - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[i]; + } num_sdus++; - } } // SDU creation end @@ -1329,15 +1314,16 @@ void apply_scheduling_decisions(mid_t mod_id, header_len_dtch_tmp = header_len_dtch; if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } // there is a payload LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 + || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); post_padding = 0; } else { @@ -1345,18 +1331,19 @@ void apply_scheduling_decisions(mid_t mod_id, // adjust the header len if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) - header_len_dtch = header_len_dtch_tmp; + header_len_dcch = header_len_dcch_tmp; + } else { + header_len_dtch = header_len_dtch_tmp; } - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header } } LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); + if (ta_len > 0) { ta_update = ue_sched_ctl->ta_update; } else { @@ -1373,7 +1360,8 @@ void apply_scheduling_decisions(mid_t mod_id, NULL, // contention res id padding, post_padding); - + + LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); @@ -1411,8 +1399,8 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; @@ -1421,6 +1409,9 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); // TODO @@ -1430,6 +1421,15 @@ void apply_scheduling_decisions(mid_t mod_id, } else { // No need to create anything apart of DCI in case of retransmission + + /*TODO: Must add these */ + //eNB_UE_stats->dlsch_trials[round]++; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; } //Add DCI based on format @@ -1438,7 +1438,7 @@ void apply_scheduling_decisions(mid_t mod_id, DLSCH_dci, rnti, size_bytes, - process_ue_cqi (mod_id, UE_id),//aggregation + dl_dci->aggr_level,//aggregation size_bits, format1, 0); @@ -1447,7 +1447,7 @@ void apply_scheduling_decisions(mid_t mod_id, DLSCH_dci, rnti, size_bytes, - process_ue_cqi (mod_id, UE_id),//aggregation + dl_dci->aggr_level,//aggregation size_bits, format2A, 0); diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index f0e0a9f84b..caf7457fea 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -69,7 +69,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 -//#define ENABLE_ENB_AGENT_DL_SCHEDULER +#define ENABLE_ENB_AGENT_DL_SCHEDULER //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 From a8cd23944f2b3deec8b3d6e586e3588c16adab03 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 2 Feb 2016 19:18:42 +0000 Subject: [PATCH 054/182] Progran scheduler fixes --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index fcf866d657..0b6157932f 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -487,6 +487,8 @@ schedule_ue_spec_default( //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; + + // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -511,7 +513,8 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - + LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); + LOG_D(MAC, "DCCH dci_tbus is %d\n", dci_tbs); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -524,10 +527,10 @@ schedule_ue_spec_default( //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in buffer during first call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; - LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); + LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; @@ -1257,9 +1260,6 @@ void apply_scheduling_decisions(mid_t mod_id, rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { - if (lcid == 3) { - rlc_size--; - } rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -1283,7 +1283,7 @@ void apply_scheduling_decisions(mid_t mod_id, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, - (char *)&dlsch_buffer[sdu_lengths[sdu_length_total]]); + (char *)&dlsch_buffer[sdu_length_total]); LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); @@ -1302,7 +1302,8 @@ void apply_scheduling_decisions(mid_t mod_id, } else { header_len_dtch = 3; } - } + } + num_sdus++; } } // SDU creation end From fd09bd61bfed2ed92fc4273da79a2a7302aa1477 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 14:27:17 +0000 Subject: [PATCH 055/182] Fixed bug with NDI toggling --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 0b6157932f..f31ed2bf86 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -249,6 +249,8 @@ schedule_ue_spec_default( */ mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); + /*TODO: Must also update these stats*/ //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; @@ -514,7 +516,6 @@ schedule_ue_spec_default( if ( TBS-ta_len-header_len_dcch > 0 ) { LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); - LOG_D(MAC, "DCCH dci_tbus is %d\n", dci_tbs); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -552,6 +553,7 @@ schedule_ue_spec_default( //Set this to the max value that we might request sdu_length_total = data_to_request; } else { + LOG_D(MAC, "[TEST]Nothing here\n"); header_len_dcch = 0; sdu_length_total = 0; } @@ -559,6 +561,7 @@ schedule_ue_spec_default( // check for DCCH1 and update header information (assume 2 byte sub-header) if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { + LOG_D(MAC, "[TEST]Requested %d bytes in DCCH1 buffer during first call\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-2); //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, @@ -577,7 +580,7 @@ schedule_ue_spec_default( header_len_dcch += 2; //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); @@ -628,7 +631,7 @@ schedule_ue_spec_default( if (rlc_status.bytes_in_buffer > 0) { LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); //Fill what remains in the TB - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer); LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); @@ -687,11 +690,15 @@ schedule_ue_spec_default( nb_rb=min_rb_unit[CC_id]; } + LOG_D(MAC,"[TEST]The initial number of resource blocks was %d\n", nb_rb); + LOG_D(MAC,"[TEST] The initial mcs was %d\n", mcs_tmp); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); + LOG_D(MAC,"[TEST]The TBS during rate matching was %d\n", TBS); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // - + LOG_D(MAC, "[TEST]Had to increase the number of RBs\n"); if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb); @@ -702,14 +709,18 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } + LOG_D(MAC,"[TEST] After the first pass the resource blocks became %d\n", nb_rb); + LOG_D(MAC,"[TEST] After the first pass the MCS was %d\n", mcs_tmp); + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - + LOG_D(MAC, "[TEST]Will only partially fill the bitmap\n"); while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; @@ -726,6 +737,9 @@ schedule_ue_spec_default( } } + LOG_D(MAC,"[TEST] After the second pass the resource blocks became %d\n", nb_rb); + LOG_D(MAC,"[TEST] After the second pass the mcs was %d\n", mcs_tmp); + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -829,7 +843,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -987,6 +1001,7 @@ schedule_ue_spec_default( dl_dci->precoding_info = 5; // Is this right?? break; } + // Toggle NDI for next time LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, @@ -998,12 +1013,12 @@ schedule_ue_spec_default( } else { // There is no data from RLC or MAC header, so don't schedule } - } + } if (frame_parms[CC_id]->frame_type == TDD) { set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } - } - } + } // UE_id loop + } // CC_id loop // Add all the dl_data elements to the progran message dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; @@ -1072,9 +1087,6 @@ void apply_scheduling_decisions(mid_t mod_id, rnti = dl_data->rnti; UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); - //NOTICE: Maybe later will not be required, once scheduler fully restructured - //eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -1108,6 +1120,7 @@ void apply_scheduling_decisions(mid_t mod_id, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + LOG_D(MAC,"[TEST] Setting DCI format 1\n"); ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; @@ -1240,13 +1253,16 @@ void apply_scheduling_decisions(mid_t mod_id, rlc_status.bytes_in_buffer = 0; TBS = dl_dci->tbs_size[0]; + LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { ta_len = 2; + LOG_D(MAC, "[TEST] Need to send timing advance\n"); } else { ta_len = 0; + LOG_D(MAC, "[TEST] No timing advance\n"); } } @@ -1257,9 +1273,12 @@ void apply_scheduling_decisions(mid_t mod_id, // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); + LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); if (rlc_size > 0) { + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -1271,10 +1290,7 @@ void apply_scheduling_decisions(mid_t mod_id, sdu_lengths[i] = 0; - LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - mod_id, frame, lcid, CC_id, rlc_size); - - LOG_D(MAC, "[TEST] Have %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); sdu_lengths[i] += mac_rlc_data_req(mod_id, rnti, @@ -1285,10 +1301,11 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_length_total]); - LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); + LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; + LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); sdu_lcids[i] = lcid; UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; @@ -1321,7 +1338,6 @@ void apply_scheduling_decisions(mid_t mod_id, } // there is a payload - LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow @@ -1341,9 +1357,6 @@ void apply_scheduling_decisions(mid_t mod_id, } } - LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); - - if (ta_len > 0) { ta_update = ue_sched_ctl->ta_update; @@ -1400,8 +1413,10 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + LOG_D(MAC,"[TEST] %d Number of resource blocks allocated\n", nb_rb); + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; From 3d3c0c7c03d6ed06c37ec4ca86891fa5372a1d76 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 15:39:51 +0000 Subject: [PATCH 056/182] Bug fixes for UE retransmission --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 79 ++++++++++++------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index f31ed2bf86..b97c15c9f5 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -251,12 +251,6 @@ schedule_ue_spec_default( mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); - - /*TODO: Must also update these stats*/ - //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); - - #ifdef EXMIMO if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { @@ -293,6 +287,13 @@ schedule_ue_spec_default( if (round > 0) { + mcs = UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1; + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); + if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); @@ -300,8 +301,7 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } - // get freq_allocation - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + if (nb_rb <= nb_available_rb) { @@ -348,7 +348,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -359,12 +358,18 @@ schedule_ue_spec_default( dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; + dl_dci->n_ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round+1) % 4; + dl_dci->rv[0] = round&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -382,7 +387,6 @@ schedule_ue_spec_default( dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; dl_dci->mcs[1] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -395,12 +399,19 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round+1) % 4; - dl_dci->rv[1] = (round+1) % 4; + dl_dci->rv[0] = round&3; + dl_dci->rv[1] = round&3; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -417,7 +428,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -426,16 +436,22 @@ schedule_ue_spec_default( dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round + 1) % 4; + dl_dci->rv[0] = round&3; if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { ue_sched_ctl->dl_pow_off[CC_id] = 1; @@ -451,7 +467,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -460,16 +475,22 @@ schedule_ue_spec_default( dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round + 1) % 4; + dl_dci->rv[0] = round&3; dl_dci->has_dl_power_offset = 1; dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; @@ -843,7 +864,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -873,8 +894,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->ndi[1] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -907,8 +928,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->ndi[1] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -941,7 +962,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = 1; - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -981,7 +1002,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; From e8f4e4e01f7b4cef8b284e7bb8bad87bc9899aca Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 17:44:20 +0000 Subject: [PATCH 057/182] Separated control from data plane in MAC agent scheduler --- cmake_targets/CMakeLists.txt | 1 + .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 458 +----------------- openair2/LAYER2/MAC/eNB_scheduler.c | 45 +- 3 files changed, 29 insertions(+), 475 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 631872f847..b555f67ebc 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1010,6 +1010,7 @@ set (MAC_SRC ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c + ${MAC_DIR}/eNB_agent_scheduler_dataplane.c ) set (ENB_APP_SRC diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index b97c15c9f5..6da07ac558 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -44,6 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -83,25 +84,19 @@ schedule_ue_spec_default( ) //------------------------------------------------------------------------------ { - //TODO uint8_t CC_id; int UE_id; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char sdu_lcids[11],offset,num_sdus=0; - uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; - uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; - unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; + uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; + uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; unsigned char harq_pid = 0; void *DLSCH_dci = NULL; LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint16_t sdu_length_total = 0; - // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; - // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; @@ -241,7 +236,6 @@ schedule_ue_spec_default( sdu_length_total=0; - num_sdus=0; /* DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), @@ -261,7 +255,7 @@ schedule_ue_spec_default( #endif // store stats - //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + // // initializing the rb allocation indicator for each UE for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { @@ -1051,445 +1045,3 @@ schedule_ue_spec_default( stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } - -void apply_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info) { - - uint8_t CC_id; - int UE_id; - int N_RBG[MAX_NUM_CCs]; - unsigned char aggregation; - mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char sdu_lcids[11],offset,num_sdus=0; - uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; - uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; - unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; - unsigned char round = 0; - unsigned char harq_pid = 0; - void *DLSCH_dci = NULL; - DCI_PDU *DCI_pdu; - - LTE_eNB_UE_stats *eNB_UE_stats = NULL; - uint16_t sdu_length_total = 0; - int mcs; - uint16_t min_rb_unit[MAX_NUM_CCs]; - short ta_update = 0; - eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; - UE_list_t *UE_list = &eNB->UE_list; - LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; - int32_t normalized_rx_power, target_rx_power; - int32_t tpc=1; - static int32_t tpc_accumulated=0; - UE_sched_ctrl *ue_sched_ctl; - - int i; - int size_bits,size_bytes; - - Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; - Protocol__PrpDlData *dl_data; - Protocol__PrpDlDci *dl_dci; - - uint32_t rlc_size, n_lc, lcid; - - // Check if there is any scheduling command for UE data - if (mac_config->n_dl_ue_data > 0) { - - // For each UE-related command - for (i = 0; i < mac_config->n_dl_ue_data; i++) { - - dl_data = mac_config->dl_ue_data[i]; - dl_dci = dl_data->dl_dci; - - CC_id = dl_data->serv_cell_index; - rnti = dl_data->rnti; - UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); - - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); - - round = dl_dci->rv[0]; - harq_pid = dl_dci->harq_process; - - // Note this code is for a specific DCI format - DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; - DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; - - frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_1_5MHz_TDD_t); - size_bits = sizeof_DCI1_1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - LOG_D(MAC,"[TEST] Setting DCI format 1\n"); - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_1_5MHz_FDD_t); - size_bits = sizeof_DCI1_1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 25: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_5MHz_TDD_t); - size_bits = sizeof_DCI1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_5MHz_FDD_t); - size_bits = sizeof_DCI1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 50: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_10MHz_TDD_t); - size_bits = sizeof_DCI1_10MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_10MHz_FDD_t); - size_bits = sizeof_DCI1_10MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 100: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_20MHz_TDD_t); - size_bits = sizeof_DCI1_20MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_20MHz_FDD_t); - size_bits = sizeof_DCI1_20MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - } - - // If this is a new transmission - if (round == 0) { - // First we have to deal with the creation of the PDU based on the message instructions - rlc_status.bytes_in_buffer = 0; - - TBS = dl_dci->tbs_size[0]; - LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); - - if (dl_data->n_ce_bitmap > 0) { - //Check if there is TA command - if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { - ta_len = 2; - LOG_D(MAC, "[TEST] Need to send timing advance\n"); - } else { - ta_len = 0; - LOG_D(MAC, "[TEST] No timing advance\n"); - } - } - - - n_lc = dl_data->n_rlc_pdu; - num_sdus = 0; - sdu_length_total = 0; - // Go through each one of the channel commands and create SDUs - for (i = 0; i < n_lc; i++) { - lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; - LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); - rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - mod_id, frame, lcid, CC_id, rlc_size); - if (rlc_size > 0) { - - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - rlc_size); // transport block set size - - sdu_lengths[i] = 0; - - LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - - sdu_lengths[i] += mac_rlc_data_req(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)&dlsch_buffer[sdu_length_total]); - - LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); - - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); - sdu_length_total += sdu_lengths[i]; - LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); - sdu_lcids[i] = lcid; - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - - if (lcid == DCCH || lcid == DCCH1) { - header_len_dcch += 2; - } else if (lcid == DTCH) { - if (sdu_lengths[i] < 128) { - header_len_dtch = 2; - } else { - header_len_dtch = 3; - } - } - - num_sdus++; - } - } // SDU creation end - - - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { - - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; - - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU - } - - // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 - || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); - post_padding = 0; - } else { - padding = 0; - - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header - } - } - - - if (ta_len > 0) { - ta_update = ue_sched_ctl->ta_update; - } else { - ta_update = 0; - } - - offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], - num_sdus, //num_sdus - sdu_lengths, // - sdu_lcids, - 255, // no drx - ta_update, // timing advance - NULL, // contention res id - padding, - post_padding); - - LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); - -#ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); - - for (i=0; i<16; i++) { - LOG_T(MAC,"%x.",dlsch_buffer[i]); - } - - LOG_T(MAC,"\n"); -#endif - // cycle through SDUs and place in dlsch_buffer - memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); - // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); - - // fill remainder of DLSCH with random data - for (j=0; j<(TBS-sdu_length_total-offset); j++) { - UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); - } - - //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); - if (opt_enabled == 1) { - trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), - eNB->subframe,0,0); - LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", - mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); - } - - // store stats - eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; - eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; - - UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - LOG_D(MAC,"[TEST] %d Number of resource blocks allocated\n", nb_rb); - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; - UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - - UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; - UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; - UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; - UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; - - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); - // TODO - - - } - - - - } else { - // No need to create anything apart of DCI in case of retransmission - - /*TODO: Must add these */ - //eNB_UE_stats->dlsch_trials[round]++; - //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; - } - - //Add DCI based on format - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format1, - 0); - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format2A, - 0); - } - } - } -} - diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index caf7457fea..fec058b27e 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -62,6 +62,7 @@ //Agent-related headers #include "ENB_APP/enb_agent_extern.h" #include "ENB_APP/enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -273,7 +274,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -322,7 +323,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -353,7 +354,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -390,7 +391,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -419,7 +420,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -463,7 +464,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -494,7 +495,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -531,7 +532,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -559,7 +560,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -612,7 +613,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -637,7 +638,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -665,7 +666,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -699,7 +700,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -723,7 +724,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -751,7 +752,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -790,7 +791,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -818,7 +819,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -851,7 +852,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -877,7 +878,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -903,7 +904,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -929,7 +930,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -957,7 +958,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, From db255c130dd97721f70bb4f8ba2e70281b2007f9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 11:28:22 +0000 Subject: [PATCH 058/182] Added definitions for the mac agent scheduler --- openair2/ENB_APP/enb_agent_mac_defs.h | 2 + .../MAC/eNB_agent_scheduler_dataplane.c | 544 ++++++++++++++++++ openair2/LAYER2/MAC/enb_agent_mac_proto.h | 71 +++ openair2/LAYER2/MAC/proto.h | 7 - 4 files changed, 617 insertions(+), 7 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c create mode 100644 openair2/LAYER2/MAC/enb_agent_mac_proto.h diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index c2891e87ca..6e960cdb69 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -39,6 +39,8 @@ #define __ENB_AGENT_MAC_PRIMITIVES_H__ #include "enb_agent_defs.h" +#include "progran.pb-c.h" +#include "header.pb-c.h" /* ENB AGENT-MAC Interface */ typedef struct { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c new file mode 100644 index 0000000000..43d4ad2b51 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -0,0 +1,544 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dataplane.c + * \brief data plane procedures related to eNB scheduling + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "assertions.h" +#include "PHY/defs.h" +#include "PHY/extern.h" + +#include "SCHED/defs.h" +#include "SCHED/extern.h" + +#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/extern.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" +#include "OCG.h" +#include "OCG_extern.h" + +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + +#include "header.pb-c.h" +#include "progran.pb-c.h" + +#include "SIMULATION/TOOLS/defs.h" // for taus + + +void apply_dl_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info) { + + Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + + // Check if there is anything to schedule for random access + if (mac_config->n_dl_rar > 0) { + /*TODO: call the random access data plane function*/ + } + + // Check if there is anything to schedule for paging/broadcast + if (mac_config->n_dl_broadcast > 0) { + /*TODO: call the broadcast/paging data plane function*/ + } + + // Check if there is anything to schedule for the UEs + if (mac_config->n_dl_ue_data > 0) { + apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, + mac_config->n_dl_ue_data, mac_config->dl_ue_data); + } + +} + + +void apply_ue_spec_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + uint32_t n_dl_ue_data, + const Protocol__PrpDlData **dl_ue_data) { + + uint8_t CC_id; + int UE_id; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + int i; + + Protocol__PrpDlData *dl_data; + Protocol__PrpDlDci *dl_dci; + + uint32_t rlc_size, n_lc, lcid; + + + // For each UE-related command + for (i = 0; i < n_dl_ue_data; i++) { + + dl_data = dl_ue_data[i]; + dl_dci = dl_data->dl_dci; + + CC_id = dl_data->serv_cell_index; + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + rnti = dl_data->rnti; + UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + round = dl_dci->rv[0]; + harq_pid = dl_dci->harq_process; + + // If this is a new transmission + if (round == 0) { + // First we have to deal with the creation of the PDU based on the message instructions + rlc_status.bytes_in_buffer = 0; + + TBS = dl_dci->tbs_size[0]; + LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); + + if (dl_data->n_ce_bitmap > 0) { + //Check if there is TA command + if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { + ta_len = 2; + LOG_D(MAC, "[TEST] Need to send timing advance\n"); + } else { + ta_len = 0; + LOG_D(MAC, "[TEST] No timing advance\n"); + } + } + + + n_lc = dl_data->n_rlc_pdu; + num_sdus = 0; + sdu_length_total = 0; + // Go through each one of the channel commands and create SDUs + for (i = 0; i < n_lc; i++) { + lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); + rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; + LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); + if (rlc_size > 0) { + + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size + + sdu_lengths[i] = 0; + + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + + sdu_lengths[i] += mac_rlc_data_req(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_length_total]); + + LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); + + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); + sdu_lcids[i] = lcid; + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (lcid == DCCH || lcid == DCCH1) { + header_len_dcch += 2; + } else if (lcid == DTCH) { + if (sdu_lengths[i] < 128) { + header_len_dtch = 2; + } else { + header_len_dtch = 3; + } + } + + num_sdus++; + } + } // SDU creation end + + + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 + || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; + + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header + } + } + + + if (ta_len > 0) { + ta_update = ue_sched_ctl->ta_update; + } else { + ta_update = 0; + } + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); + +#ifdef DEBUG_eNB_SCHEDULER + LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); + + for (i=0; i<16; i++) { + LOG_T(MAC,"%x.",dlsch_buffer[i]); + } + + LOG_T(MAC,"\n"); +#endif + // cycle through SDUs and place in dlsch_buffer + memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); + // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); + + // fill remainder of DLSCH with random data + for (j=0; j<(TBS-sdu_length_total-offset); j++) { + UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); + } + + //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); + if (opt_enabled == 1) { + trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), + eNB->subframe,0,0); + LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", + mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); + } + + // store stats + eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; + eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; + + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; + UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + } + } else { + // No need to create anything apart of DCI in case of retransmission + + /*TODO: Must add these */ + //eNB_UE_stats->dlsch_trials[round]++; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + } + //Fill the proper DCI of OAI + fill_oai_dci(mod_id, CC_id, rnti, dl_dci); + } +} + +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, + const Protocol__PrpDlDci *dl_dci) { + + void *DLSCH_dci = NULL; + DCI_PDU *DCI_pdu; + + unsigned char round = 0; + unsigned char harq_pid = 0; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int size_bits, size_bytes; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + + int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + harq_pid = dl_dci->harq_process; + round = dl_dci->rv[0]; + + // Note this code is for a specific DCI format + DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; + DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_TDD_t); + size_bits = sizeof_DCI1_1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + LOG_D(MAC,"[TEST] Setting DCI format 1\n"); + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_FDD_t); + size_bits = sizeof_DCI1_1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 25: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_TDD_t); + size_bits = sizeof_DCI1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_FDD_t); + size_bits = sizeof_DCI1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 50: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_TDD_t); + size_bits = sizeof_DCI1_10MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_FDD_t); + size_bits = sizeof_DCI1_10MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 100: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_TDD_t); + size_bits = sizeof_DCI1_20MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_FDD_t); + size_bits = sizeof_DCI1_20MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + } + + //Add DCI based on format + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level,//aggregation + size_bits, + format1, + 0); + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level,//aggregation + size_bits, + format2A, + 0); + } +} diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h new file mode 100644 index 0000000000..7fcdbc29c3 --- /dev/null +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -0,0 +1,71 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file enb_agent_mac_proto.h + * \brief MAC functions for eNB agent + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#ifndef __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ +#define __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ + +#include "enb_agent_defs.h" +#include "header.pb-c.h" +#include "progran.pb-c.h" + +/* + * Default scheduler used by the eNB agent + */ +void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + + +/* + * Data plane function for applying the DL decisions of the scheduler + */ +void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info); + +/* + * Data plane function for applying the UE specific DL decisions of the scheduler + */ +void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + uint32_t n_dl_ue_data, const Protocol__PrpDlData **dl_ue_data); + +/* + * Data plane function for filling the DCI structure + */ +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__PrpDlDci *dl_dci); + +#endif diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index faf0bf9954..be553c278d 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -36,10 +36,6 @@ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ -#include "enb_agent_defs.h" -#include "header.pb-c.h" -#include "progran.pb-c.h" - /** \addtogroup _mac * @{ */ @@ -133,9 +129,6 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,i */ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag); -//To be used by the agent -void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. @param Mod_id Module id of UE From e3aa8400d4f8e962195e197f39df1a28a670e61a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 11:28:54 +0000 Subject: [PATCH 059/182] Added support for progran dl_mac_config message destruction --- openair2/ENB_APP/enb_agent_mac.c | 59 +++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 05b2a7a364..df614df60c 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,6 +40,7 @@ #include "enb_agent_mac_internal.h" #include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include "log.h" @@ -1029,7 +1030,63 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage } int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { - //TODO: De-allocate the memory of the message + int i,j, k; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) + goto error; + + Protocol__PrpDlDci *dl_dci; + + free(msg->dl_mac_config_msg->header); + for (i = 0; i < msg->dl_mac_config_msg->n_dl_ue_data; i++) { + free(msg->dl_mac_config_msg->dl_ue_data[i]->ce_bitmap); + for (j = 0; j < msg->dl_mac_config_msg->dl_ue_data[i]->n_rlc_pdu; j++) { + for (k = 0; k < msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->n_rlc_pdu_tb; k++) { + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb[k]); + } + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb); + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]); + } + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu); + dl_dci = msg->dl_mac_config_msg->dl_ue_data[i]->dl_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_ue_data[i]); + } + free(msg->dl_mac_config_msg->dl_ue_data); + + for (i = 0; i < msg->dl_mac_config_msg->n_dl_rar; i++) { + dl_dci = msg->dl_mac_config_msg->dl_rar[i]->rar_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_rar[i]); + } + free(msg->dl_mac_config_msg->dl_rar); + + for (i = 0; i < msg->dl_mac_config_msg->n_dl_broadcast; i++) { + dl_dci = msg->dl_mac_config_msg->dl_broadcast[i]->broad_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_broadcast[i]); + } + free(msg->dl_mac_config_msg->dl_broadcast); + + for ( i = 0; i < msg->dl_mac_config_msg->n_ofdm_sym; i++) { + free(msg->dl_mac_config_msg->ofdm_sym[i]); + } + free(msg->dl_mac_config_msg->ofdm_sym); + + return 0; + + error: return -1; } From b784e6bd64b4aa6512b5c468c3e255d941e81f46 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 12:52:01 +0000 Subject: [PATCH 060/182] Refactored code to improve readability in fill_oai_dci function --- .../MAC/eNB_agent_scheduler_dataplane.c | 205 +++++++----------- openair2/LAYER2/MAC/progran_dci_conversions.h | 59 +++++ 2 files changed, 134 insertions(+), 130 deletions(-) create mode 100644 openair2/LAYER2/MAC/progran_dci_conversions.h diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 43d4ad2b51..6fe11c59cd 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -48,6 +48,7 @@ #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/progran_dci_conversions.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -104,6 +105,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, unsigned char aggregation; mac_rlc_status_resp_t rlc_status; unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; unsigned char sdu_lcids[11],offset,num_sdus=0; uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; @@ -156,27 +158,18 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, rlc_status.bytes_in_buffer = 0; TBS = dl_dci->tbs_size[0]; - LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); if (dl_data->n_ce_bitmap > 0) { - //Check if there is TA command - if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { - ta_len = 2; - LOG_D(MAC, "[TEST] Need to send timing advance\n"); - } else { - ta_len = 0; - LOG_D(MAC, "[TEST] No timing advance\n"); - } + //Check if there is TA command and set the length appropriately + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; } - n_lc = dl_data->n_rlc_pdu; num_sdus = 0; sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; - LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); @@ -204,24 +197,17 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_length_total]); - LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; - LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); sdu_lcids[i] = lcid; UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - if (lcid == DCCH || lcid == DCCH1) { - header_len_dcch += 2; - } else if (lcid == DTCH) { - if (sdu_lengths[i] < 128) { - header_len_dtch = 2; - } else { - header_len_dtch = 3; - } + if (sdu_lengths[i] < 128) { + header_len += 2; + } else { + header_len += 3; } num_sdus++; @@ -229,46 +215,34 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } // SDU creation end - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + if (((sdu_length_total + header_len) > 0)) { + + header_len_tmp = header_len; - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; - - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field + // If we have only a single SDU, header length becomes 1 + if (header_len == 2 || header_len == 3) { + header_len = 1; } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU + header_len--; } // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 - || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + if (((sdu_length_total + header_len) > 0)) { + // If we need a 1 or 2 bit padding or no padding at all + if ((TBS - header_len - sdu_length_total - ta_len) <= 2 + || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow + padding = (TBS - header_len - sdu_length_total - ta_len); post_padding = 0; - } else { + } else { // The last sdu needs to have a length field, since we add padding padding = 0; - - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header + header_len = header_len_tmp; + post_padding = TBS - sdu_length_total - header_len - ta_len - 1; // 1 is for the postpadding header } } - - if (ta_len > 0) { - ta_update = ue_sched_ctl->ta_update; - } else { - ta_update = 0; - } + ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], num_sdus, //num_sdus sdu_lengths, // sdu_lcids, @@ -364,6 +338,8 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + uint32_t format; + harq_pid = dl_dci->harq_process; round = dl_dci->rv[0]; @@ -377,14 +353,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 6: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_TDD_t); size_bits = sizeof_DCI1_1_5MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -394,14 +363,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - LOG_D(MAC,"[TEST] Setting DCI format 1\n"); - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_FDD_t); size_bits = sizeof_DCI1_1_5MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -414,14 +376,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 25: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_TDD_t); size_bits = sizeof_DCI1_5MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -431,13 +386,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_FDD_t); size_bits = sizeof_DCI1_5MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -450,14 +399,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 50: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_TDD_t); size_bits = sizeof_DCI1_10MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -467,13 +409,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_FDD_t); size_bits = sizeof_DCI1_10MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -486,14 +422,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 100: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_TDD_t); size_bits = sizeof_DCI1_20MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -503,13 +432,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_FDD_t); size_bits = sizeof_DCI1_20MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -521,24 +444,46 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, break; } - //Add DCI based on format - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format1, - 0); - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format2A, - 0); + //Set format to the proper type + switch(dl_dci->format) { + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1: + format = format1; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1A: + format = format1A; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1B: + format = format1B; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1C: + format = format1C; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D: + format = format1E_2A_M10PRB; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2: + format = format2; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A: + format = format2A; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2B: + format = format2B; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_3: + format = 3; + break; + default: + /*TODO: Need to deal with unsupported DCI type*/ + return; } + + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level, + size_bits, + format, + 0); } diff --git a/openair2/LAYER2/MAC/progran_dci_conversions.h b/openair2/LAYER2/MAC/progran_dci_conversions.h new file mode 100644 index 0000000000..90324fdb30 --- /dev/null +++ b/openair2/LAYER2/MAC/progran_dci_conversions.h @@ -0,0 +1,59 @@ +/******************************************************************************* + 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 . + + 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 dci_conversions.h + * \brief Conversion helpers from progran messages to OAI formats DCI + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef LAYER2_MAC_PROGRAN_DCI_CONVERISIONS_H__ +#define LAYER2_MAC_DCI_PROGRAN_CONVERISIONS_H__ + +#define FILL_DCI_FDD_1(TYPE, DCI, PROGRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; + +#define FILL_DCI_TDD_1(TYPE, DCI, PROGRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->dai = PROGRAN_DCI->dai; \ + ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; + +#endif From a404bfd96cb853a8dc36ab3ad985b54131a3e1c1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 17:32:37 +0000 Subject: [PATCH 061/182] Refactored eNB agent scheduler code to improve readability --- .../MAC/eNB_agent_scheduler_dataplane.c | 6 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 797 ++++++------------ 2 files changed, 264 insertions(+), 539 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 6fe11c59cd..04efcb44ad 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -104,8 +104,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char header_len = 0, header_len_tmp = 0; + unsigned char ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; unsigned char sdu_lcids[11],offset,num_sdus=0; uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; @@ -252,8 +252,6 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, padding, post_padding); - LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); - #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 6da07ac558..dd0a9942ac 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -90,6 +90,7 @@ schedule_ue_spec_default( unsigned char aggregation; mac_rlc_status_resp_t rlc_status; unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; @@ -102,7 +103,6 @@ schedule_ue_spec_default( eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; - int continue_flag=0; int32_t normalized_rx_power, target_rx_power; int32_t tpc=1; static int32_t tpc_accumulated=0; @@ -123,6 +123,8 @@ schedule_ue_spec_default( int i; uint32_t data_to_request; uint32_t dci_tbs; + uint8_t ue_has_transmission = 0; + uint32_t ndi; if (UE_list->head==-1) { @@ -172,7 +174,6 @@ schedule_ue_spec_default( continue; for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { - continue_flag=0; // reset the flag to allow allocation for the remaining UEs rnti = UE_RNTI(mod_id, UE_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; @@ -180,13 +181,13 @@ schedule_ue_spec_default( if (rnti==NOT_A_RNTI) { LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); // mac_xface->macphy_exit("Cannot find rnti for UE_id"); - continue_flag=1; + continue; } if (eNB_UE_stats==NULL) { LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); - continue_flag=1; + continue; } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated @@ -195,7 +196,7 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) - continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 + continue; //to next user (there might be rbs availiable for other UEs in TM5 // else // break; } @@ -210,17 +211,7 @@ schedule_ue_spec_default( set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } - if (continue_flag == 1 ) { - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_NONE); - continue; - } - // After this point all the UEs will be scheduled - // TODO create a Protocol__PrpDlData struct for the UE dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); protocol__prp_dl_data__init(dl_data[num_ues_added]); dl_data[num_ues_added]->has_rnti = 1; @@ -232,8 +223,6 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - - sdu_length_total=0; @@ -247,16 +236,13 @@ schedule_ue_spec_default( #ifdef EXMIMO - if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti) == 5) { mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + mcs = cmin(mcs,16); } #endif - // store stats - // - // initializing the rb allocation indicator for each UE for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; @@ -295,8 +281,6 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } - - if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -318,7 +302,6 @@ schedule_ue_spec_default( nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } } - j = j + 1; } } @@ -333,171 +316,21 @@ schedule_ue_spec_default( PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } - switch (mac_xface->get_transmission_mode(mod_id,CC_id,rnti)) { - case 1: - case 2: - default: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); - } - break; - case 4: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->rv[1] = round&3; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); - } - break; - case 5: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + for(i=0; ilte_frame_parms.N_RBG; i++) { + rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; + } - if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { - ue_sched_ctl->dl_pow_off[CC_id] = 1; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - - break; - case 6: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - - break; - } - num_ues_added += 1; + ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + tpc = 1; + + ue_has_transmission = 1; + num_ues_added++; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); } - + //End of retransmission } else { /* This is a potentially new SDU opportunity */ - rlc_status.bytes_in_buffer = 0; // Now check RLC information to compute number of required RBs // get maximum TBS size for RLC request @@ -505,8 +338,6 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; - - // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -527,154 +358,61 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader - // Need to see if we have space for data from this channel - - if ( TBS-ta_len-header_len_dcch > 0 ) { - LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); - //If we have space, we need to see how much data we can request at most (if any available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH, - (dci_tbs-ta_len-header_len_dcch)); // transport block set size + // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) + for (j = 1; j < 4; j++) { + header_len+=3; - //If data are available in the DCCH - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); - //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; - LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - //Set this to the max value that we might request - sdu_length_total = data_to_request; - } else { - LOG_D(MAC, "[TEST]Nothing here\n"); - header_len_dcch = 0; - sdu_length_total = 0; - } - } + // Need to see if we have space for data from this channel + if (dci_tbs - ta_len - header_len > 0) { + LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer if channel %d during first call\n", dci_tbs-ta_len-header_len); + //If we have space, we need to see how much data we can request at most (if any available) + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + j, + (dci_tbs-ta_len-header_len)); // transport block set size - // check for DCCH1 and update header information (assume 2 byte sub-header) - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { - LOG_D(MAC, "[TEST]Requested %d bytes in DCCH1 buffer during first call\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-2); - - //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH1, - (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2)); // transport block set size less allocations for timing advance and - // DCCH SDU - - // If data are available in DCCH1 - if (rlc_status.bytes_in_buffer > 0) { - //Add this subheader - header_len_dcch += 2; - - //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer); - - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - sdu_length_total += data_to_request; - } - } - - // check for DTCH and update header information - // here we should loop over all possible DTCH - - header_len_dtch = 3; // Assume max 3 bytes DTCH SDU subheader - - LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", - mod_id, frame, CC_id, DTCH, TBS, - dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { - - LOG_D(MAC, "[TEST] This is how much we request at most during first call %d\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DTCH, - dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - // If data are available in DTCH - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); - //Fill what remains in the TB - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer); - LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - sdu_length_total += data_to_request; - - if(data_to_request < 128) { - header_len_dtch = 2; - } - } else { - header_len_dtch = 0; - } - } + //If data are available in channel j + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len, rlc_status.bytes_in_buffer); + if (data_to_request < 128) { //The header will be one byte less + header_len--; + } + if (j == 1) { + data_to_request++; //It is not correct but fixes some RLC bug for DCCH + } + LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = j; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = j; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + channels_added++; + //Set this to the max value that we might request + sdu_length_total = data_to_request; + } else { + //Take back the assumption of a header for this channel + header_len -= 3; + } //End rlc_status.bytes_in_buffer <= 0 + } //end of if dci_tbs - ta_len - header_len > 0 + } // End of iterating the logical channels // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * @@ -688,17 +426,15 @@ schedule_ue_spec_default( // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; + header_len_tmp = header_len; - if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch > 0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU - } + if (header_len == 2 || header_len == 3) { //Only one SDU, remove length field + header_len = 1; + } else { //Remove length field from the last SDU + header_len--; + } mcs_tmp = mcs; - if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small } else { @@ -711,7 +447,7 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); LOG_D(MAC,"[TEST]The TBS during rate matching was %d\n", TBS); - while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { + while (TBS < (sdu_length_total + header_len + ta_len)) { nb_rb += min_rb_unit[CC_id]; // LOG_D(MAC, "[TEST]Had to increase the number of RBs\n"); if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs @@ -724,9 +460,6 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"[TEST] After the first pass the resource blocks became %d\n", nb_rb); - LOG_D(MAC,"[TEST] After the first pass the MCS was %d\n", mcs_tmp); - if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band @@ -747,13 +480,9 @@ schedule_ue_spec_default( nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } } - j = j+1; } } - - LOG_D(MAC,"[TEST] After the second pass the resource blocks became %d\n", nb_rb); - LOG_D(MAC,"[TEST] After the second pass the mcs was %d\n", mcs_tmp); PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -763,22 +492,19 @@ schedule_ue_spec_default( } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs_tmp > 0)) { + while ((TBS > (sdu_length_total + header_len + ta_len)) && (mcs_tmp > 0)) { mcs_tmp--; TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && + while ((TBS < (sdu_length_total + header_len + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28)) || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) { mcs_tmp++; TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"[TEST] dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); - dci_tbs = TBS; - mcs = mcs_tmp; aggregation = process_ue_cqi(mod_id,UE_id); @@ -787,12 +513,6 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - /*Deactivate here as well*/ - /* add_ue_dlsch_info(mod_id, */ - /* CC_id, */ - /* UE_id, */ - /* subframe, */ - /* S_DL_SCHEDULED); */ if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; @@ -840,183 +560,10 @@ schedule_ue_spec_default( for(i=0; ilte_frame_parms.N_RBG; i++) { rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; - } - - switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { - case 1: - case 2: - default: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 3: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->rv[1] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 4: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->rv[1] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 5: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = 1; - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - - if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { - ue_sched_ctl->dl_pow_off[CC_id] = 1; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - dl_dci->has_precoding_info = 1; - dl_dci->precoding_info = 5; // Is this right?? - - break; - case 6: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - dl_dci->has_precoding_info = 1; - dl_dci->precoding_info = 5; // Is this right?? - break; - } + } + ndi = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + // Toggle NDI for next time LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, @@ -1025,10 +572,190 @@ schedule_ue_spec_default( // Increase the pointer for the number of scheduled UEs num_ues_added++; + ue_has_transmission = 1; } else { // There is no data from RLC or MAC header, so don't schedule + ue_has_transmission = 0; + } + } // End of new scheduling + + // If we has transmission or retransmission + if (ue_has_transmission) { + switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { + case 1: + case 2: + default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 3: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->ndi[1] = ndi; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->rv[1] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->ndi[1] = ndi; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->rv[1] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = 1; + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + + break; + case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + break; } } + if (frame_parms[CC_id]->frame_type == TDD) { set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } From bb874258980e9bb70cbb81b5cf2d676d56f933c7 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Sat, 6 Feb 2016 09:31:33 +0100 Subject: [PATCH 062/182] add eNB agent libs to lte-softmodem --- cmake_targets/CMakeLists.txt | 8 ++++---- openair2/ENB_APP/enb_agent_handler.c | 10 +++++----- openair2/LAYER2/MAC/eNB_scheduler.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b555f67ebc..8631fe92a5 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1512,12 +1512,12 @@ 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 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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -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} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) # lte-softmodem-nos1 is both eNB and UE implementation @@ -1545,11 +1545,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 L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_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} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 3e9752b539..4894683723 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -41,7 +41,7 @@ #include "assertions.h" -enb_agent_message_decoded_callback messages_callback[][3] = { +enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply @@ -85,19 +85,19 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, goto error; } - if ((decoded_message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; goto error; } - if (messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { + if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; goto error; } - err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); + 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; } @@ -147,7 +147,7 @@ Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { Protocol__ProgranMessage *timed_task, *reply_message; timed_task = timer_args->msg; - err_code = ((*messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ goto error; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index fec058b27e..54b31b6e64 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -60,9 +60,9 @@ #include "pdcp.h" //Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "enb_agent_extern.h" +#include "enb_agent_mac.h" +#include "enb_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" From a0289d74fa610bd73ac2bb79d20da8bc8a685411 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 13:03:31 +0000 Subject: [PATCH 063/182] Added support for eNB, cell, UE and logical channel configuration messages to the progRAN protocol --- cmake_targets/CMakeLists.txt | 4 + .../ENB_APP/MESSAGES/V2/config_common.proto | 174 ++++++++++++++++++ .../ENB_APP/MESSAGES/V2/config_messages.proto | 88 +++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 12 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 40 +++- 5 files changed, 315 insertions(+), 3 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/config_common.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/config_messages.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8631fe92a5..93aa36c727 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -713,6 +713,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/time_common.proto ${PRPT_MSG_DIR}/controller_commands.proto ${PRPT_MSG_DIR}/mac_primitives.proto + ${PRPT_MSG_DIR}/config_messages.proto + ${PRPT_MSG_DIR}/config_common.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -727,6 +729,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/time_common.pb-c.c ${PRPT_C_DIR}/controller_commands.pb-c.c ${PRPT_C_DIR}/mac_primitives.pb-c.c + ${PRPT_C_DIR}/config_messages.pb-c.c + ${PRPT_C_DIR}/config_common.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto new file mode 100644 index 0000000000..ab6e8b8c22 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -0,0 +1,174 @@ +//'syntax = "proto2";' +package protocol; + +// +// Cell config related structures and enums +// + +message prp_si_config { + optional uint32 sfn = 1; + optional uint32 sib1_length = 2; // The length of SIB1 in bytes + optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF + repeated prp_si_message si_message = 4; // List of SI messages to be sent. + // The index identifies the type of an SI message + // 0 - SIB1 + // 1..31 - SIx + // 32..63 - PCCH +} + +message prp_si_message { + optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames + optional uint32 length = 2; // The length of the SI message in bytes +} + +enum prp_hopping_mode { + PRHM_INTER = 0; + PRHM_INTERINTRA = 1; +} + +enum prp_phich_resource { + PRPR_ONE_SIXTH = 0; + PRPR_HALF = 1; + PRPR_ONE = 2; + PRPR_TWO = 3; +} + +enum prp_phich_duration { + PRPD_NORMAL = 0; + PRPD_EXTENDED = 1; +} + +enum prp_ul_cyclic_prefix_length { + PRUCPL_NORMAL = 0; + PRUCPL_EXTENDED = 1; +} + +enum prp_dl_cyclic_prefix_length { + PRDCPL_NORMAL = 0; + PRDCPL_EXTENDED = 1; +} + +enum prp_duplex_mode { + PRDM_TDD = 0; + PRDM_FDD = 1; +} + +enum prp_qam { + PREQ_MOD_16QAM = 0; + PREQ_MOD_64QAM = 1; +} + +// +// UE config related structures and enums +// + +message prp_drx_config { + optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321 + optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321 + optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321 + optional uint32 long_drx_cycle = 4; // In SF. See TS 36.321 + optional uint32 long_drx_cycle_start_offset = 5;// See TS 36.321 + optional uint32 short_drx_cycle = 6; // In SF + optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321 +} + +message prp_sps_config { + optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF + optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF + optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321 + repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used + // as part of PRPT_SET_UE_CONFIG + optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS +} + +message prp_sr_config { + optional uint32 sr_action = 1; // Indicates if SR config should be changed or released + // One of the PRSRA_* enum values + optional uint32 sched_interval = 2; // SR scheduling interval in SF + optional uint32 dsr_trans_max = 3; // See TS 36.213 +} + +message prp_cqi_config { + optional uint32 cqi_action = 1; // Indicats if CQI changed or released. + // One of the PRSRA_* enum values + optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF + optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF +} + +message prp_ue_capabilities { + optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation + optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value + optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1 + optional uint32 ue_category = 4; + optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1 +} + +message prp_scell_config { + optional uint32 carrier_index = 1; // Id of the carrier component + optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex) + optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling + // is used by this SCell + optional uint32 sched_cell_index = 4; // Index of the cell responsible for scheduling + // this SCell if cross-carrier scheduling is enabled + optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell +} + +enum prp_meas_gap_config_pattern { + PRMGCP_GP1 = 0; + PRMGCP_GP2 = 1; + PRMGCP_OFF = 2; +} + +enum prp_setup_release_action { + PRSRA_SETUP = 0; + PRSRA_RELEASE = 1; +} + +enum prp_ue_transmission_antenna { + PRUTA_NONE = 0; + PRUTA_OPEN_LOOP = 1; + PRUTA_CLOSED_LOOP = 2; +} + +enum prp_aperiodic_cqi_report_mode { + PRACRM_RM12 = 0; + PRACRM_RM20 = 1; + PRACRM_RM22 = 2; + PRACRM_RM30 = 3; + PRACRM_RM31 = 4; + PRACRM_NONE = 5; +} + +enum prp_tdd_ack_nack_feedback_mode { + PRTANFM_BUNDLING = 0; + PRTANFM_MULTIPLEXING = 1; +} + +// +// Logical channel config related structures and enums +// + +message prp_lc_config { + optional uint32 lcid = 1; // The logical channel id + optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to + optional uint32 direction = 3; // The LC direction. One of the PRLCD_* enum values + optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the PRQBT_* enum values + optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413 + // One less than the actual QCI value + optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) + optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only) + optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only) + optional uint64 e_RAB_guranteed_bitrate_DL = 9; // In bps (GBR only) +} + +enum prp_lc_direction { + PRLCD_UL = 0; + PRLCD_DL = 1; + PRLCD_BOTH = 2; +} + +enum prp_qos_bearer_type { + PRQBT_NON_GBR = 0; + PRQBT_GBR = 1; +} + diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto new file mode 100644 index 0000000000..4e1151a7e8 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -0,0 +1,88 @@ +//'syntax = "proto2";' +package protocol; + +import "config_common.proto"; + +message prp_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 PRHM_* enum values + optional uint32 n_sb = 5; // The number of subbands + optional uint32 phich_resource = 6; // The number of REGs used for PHICH + // One of the PRPR_* enum values + optional uint32 phich_duration = 7; // One of the PRPD_* enum values + optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9 + optional prp_si_config si_config = 9; // The SI configuration + optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs + optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs + optional uint32 ul_cyclic_prefix_length = 13; // One of the PRUCPL_* enum values + optional uint32 dl_cyclic_prefix_length = 14; // One of the PRDCPL_* enum values + optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports + optional uint32 duplex_mode = 16; // One of the PRDM_* enum values + optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only + optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1 + repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional) + repeated uint32 mbsfn_subframe_config_rfoffset = 20; // The radio frame offset (Optional) + repeated uint32 mbsfn_subframe_config_sfalloc = 21; // Bitmap indicating the MBSFN subframes (Optional) + optional uint32 prach_config_index = 22; // See TS 36.211, section 5.7.1 + optional uint32 prach_freq_offset = 23; // See TS 36.211, section 5.7.1 + optional uint32 ra_response_window_size = 24; // The duration of the RA response window in SF + optional uint32 mac_contention_resolution_timer = 25; // Timer for RA + optional uint32 max_HARQ_Msg3Tx = 26; // See TS 36.321 + optional uint32 n1PUCCH_AN = 27; // See TS 36.213, section 10.1 + optional uint32 deltaPUCCH_shift = 28; // See TS 36.211, section 5.4 + optional uint32 nRB_cqi = 29; // See TS 36.211, section 5.4 + optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2 + optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2 + optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only + optional uint32 enable_64QAM = 33; // One of the PREQ_* enum values + optional uint32 carrier_index = 34; // Carrier component index +} + +message prp_ue_config { + optional uint32 rnti = 1; + optional prp_drx_config drx_config = 2; // The DRX configuration (Optional) + optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization + // status of the UE, not the actual advance procedure + // See TS 36.321 + optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration. + // One of the PRMGCP_* enum values + // See TS 36.133 + optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable + optional prp_sps_config sps_config = 6; // The SPS configuration (Optional) + optional prp_sr_config sr_config = 7; // The SR configuration (Optional) + optional prp_cqi_config cqi_config = 8; // The CQI configuration (Optional) + optional uint32 transmission_mode = 9; // The UE transmission mode + optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer + // per UE. See TS 36.413 + optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer + // per UE. See TS 36.413 + optional prp_ue_capabilities capabilities = 12; + optional uint32 ue_transmission_antenna = 13; // One of the PRUTA_* enum values + optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321 + optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL + optional uint32 beta_offset_ACK_index = 16; // See TS 36.213 + optional uint32 beta_offset_RI_index = 17; // See TS 36.213 + optional uint32 beta_offset_CQI_index = 18; // See TS 36.213 + optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213 + optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213 + optional uint32 aperiodic_cqi_rep_mode = 21; // One of the PRACRM_* enum values + optional uint32 tdd_ack_nack_feedback = 22; // One of the PRTANFM_* enum values + optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1 + optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size + optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation + optional uint32 cross_carrier_sched_support = 26; // Boolean value + optional uint32 pcell_carrier_index = 27; // Index of primary cell + repeated prp_scell_config scell_config = 28; // Secondary cells configuration + optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell +} + +message prp_lc_ue_config { + optional uint32 rnti = 1; + repeated prp_lc_config lc_config = 2; // A list of LC configurations for the given UE +} + + + + diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 10a18ddcef..be0341f132 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -19,10 +19,18 @@ enum prp_type { // Time indication messages PRPT_SF_TRIGGER = 5; - //Asynchronous messages + // Asynchronous messages PRPT_UL_SR_INFO = 6; + // eNB configuration messages + PRPT_GET_ENB_CONFIG_REQUEST = 7; + PRPT_GET_ENB_CONFIG_REPLY = 8; + PRPT_GET_UE_CONFIG_REQUEST = 9; + PRPT_GET_UE_CONFIG_REPLY = 10; + PRPT_GET_LC_CONFIG_REQUEST = 11; + PRPT_GET_LC_CONFIG_REPLY = 12; + //Controller command messages - PRPT_DL_MAC_CONFIG = 7; + PRPT_DL_MAC_CONFIG = 13; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 5d0ec15518..f1178c0f57 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -4,6 +4,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; import "time_common.proto"; +import "config_messages.proto"; import "controller_commands.proto"; message progran_message { @@ -16,7 +17,13 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; - prp_dl_mac_config dl_mac_config_msg = 8; + prp_enb_config_request enb_config_request = 8; + prp_enb_config_reply enb_config_reply = 9; + prp_ue_config_request ue_config_request = 10; + prp_ue_config_reply ue_config_reply = 11; + prp_lc_config_request lc_config_request = 12; + prp_lc_config_reply lc_config_reply = 13; + prp_dl_mac_config dl_mac_config_msg = 14; } } @@ -108,6 +115,37 @@ message prp_ul_sr_info { repeated uint32 rnti = 3; } +// +// eNB configuration messages +// +message prp_enb_config_request { + optional prp_header header = 1; +} + +message prp_enb_config_reply { + optional prp_header header = 1; + optional uint32 eNB_id = 2; // Unique id to distinguish the eNB + repeated prp_cell_config cell_config = 3; +} + +message prp_ue_config_request { + optional prp_header header = 1; +} + +message prp_ue_config_reply { + optional prp_header header = 1; + repeated prp_ue_config ue_config = 2; +} + +message prp_lc_config_request { + optional prp_header header = 1; +} + +message prp_lc_config_reply { + optional prp_header header = 1; + repeated prp_lc_ue_config lc_ue_config = 2; +} + // // Controller command messages // From ff72fbc6bcaf916eb177e0ef40cb3630bdbbfc8e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 13:33:48 +0000 Subject: [PATCH 064/182] Integrated progRAN config messages to OAI agent and created stubs for handler and destructor functions --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 12 +++--- openair2/ENB_APP/enb_agent_common.c | 45 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 15 ++++++++ openair2/ENB_APP/enb_agent_handler.c | 16 +++++++- 4 files changed, 80 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index f1178c0f57..2bcf9bbc95 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -17,12 +17,12 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; - prp_enb_config_request enb_config_request = 8; - prp_enb_config_reply enb_config_reply = 9; - prp_ue_config_request ue_config_request = 10; - prp_ue_config_reply ue_config_reply = 11; - prp_lc_config_request lc_config_request = 12; - prp_lc_config_reply lc_config_reply = 13; + prp_enb_config_request enb_config_request_msg = 8; + prp_enb_config_reply enb_config_reply_msg = 9; + prp_ue_config_request ue_config_request_msg = 10; + prp_ue_config_reply ue_config_reply_msg = 11; + prp_lc_config_request lc_config_request_msg = 12; + prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; } } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ab9546036f..7c820bfa5c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -261,6 +261,51 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current eNB configuration */ + return 0; +} + +int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated eNB config message */ + return 0; +} + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current UE configurations */ + return 0; +} + +int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { + /*TODO: Deallocate memory for a dynamically allocated UE config message */ + return 0; +} + +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current LC configurations */ + return 0; +} + +int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated LC config message */ + return 0; +} + +int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated eNB config message */ + return 0; +} + +int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated UE config message */ + return 0; +} + +int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated LC config message */ + return 0; +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 4762637b66..afa2179ff4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -91,6 +91,21 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 4894683723..9815732088 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -48,8 +48,14 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0, 0, 0}, /*SR_INFO*/ - {0, 0, 0}, /*DL_MAC_CONFIG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ + {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ + {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ + {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ }; @@ -61,6 +67,12 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_stats_reply, enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, + enb_agent_destroy_enb_config_request, + enb_agent_destroy_enb_config_reply, + enb_agent_destroy_ue_config_request, + enb_agent_destroy_ue_config_reply, + enb_agent_destroy_lc_config_request, + enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, }; From 8aff18aed5b23c2500c3a5c7cd346cf2a06de131 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 17:53:49 +0000 Subject: [PATCH 065/182] Fixed bug with toggling the NDI for DL HARQ retransmissions --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index dd0a9942ac..4d353232a8 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -320,6 +320,7 @@ schedule_ue_spec_default( rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; } + // Keep the old NDI, do not toggle ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; tpc = 1; @@ -562,13 +563,12 @@ schedule_ue_spec_default( rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; } - ndi = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - - // Toggle NDI for next time + // Toggle NDI LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]= 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; From a663654418f6c39fac29af7492d2251ef33c280b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 10 Feb 2016 13:41:56 +0000 Subject: [PATCH 066/182] Patch to get tx_queue size from RLC for the LCs of a UE --- openair2/ENB_APP/enb_agent_common.c | 7 +++++++ openair2/ENB_APP/enb_agent_common.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 7c820bfa5c..5ddcb39868 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -393,6 +393,13 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } +int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) +{ + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t frame = (uint16_t) get_current_frame(mod_id); + mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); + return rlc_status.bytes_in_buffer; +} /* * timer primitives */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index afa2179ff4..784c86bf6a 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -148,7 +148,7 @@ 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); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index df614df60c..4a62c9dcbb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -413,9 +413,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of RLC buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { // TODO: Fill in the actual RLC buffer status reports - ue_report[i]->n_rlc_report = 1; // Set this to the number of LCs for this UE + ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * ue_report[i]->n_rlc_report); + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; @@ -427,10 +427,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_rlc_bsr__init(rlc_reports[j]); //TODO:Set logical channel id - rlc_reports[j]->lc_id = 1; + rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; //TODO:Set tx queue size in bytes - rlc_reports[j]->tx_queue_size = 10; + rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; //TODO:Set tx queue head of line delay in ms rlc_reports[j]->tx_queue_hol_delay = 100; From b64cb5b2501c8ee09c8417d66a935ca8b16722ca Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 10 Feb 2016 18:07:35 +0000 Subject: [PATCH 067/182] Added rank indication and timing advance indication support --- openair2/ENB_APP/enb_agent_common.c | 25 ++++ openair2/ENB_APP/enb_agent_common.h | 5 + openair2/ENB_APP/enb_agent_mac.c | 194 ++++++++++++++++------------ 3 files changed, 140 insertions(+), 84 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 5ddcb39868..eb08107dff 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -400,6 +400,31 @@ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); return rlc_status.bytes_in_buffer; } + +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id) +{ + if((((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ta_update) > 0) + return 1; + else + return 0; +} + +int get_active_CC(mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; +} + +int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + return eNB_UE_stats[CC_id].rank; +} + /* * timer primitives */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 784c86bf6a..37d3829354 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -150,6 +150,11 @@ 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); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4a62c9dcbb..cb5aac1a95 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -52,25 +52,25 @@ unsigned int mac_agent_registered[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ - + // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist // TODO: Must resolve conflicts among stats requests - + int i; void *buffer; int size; err_code_t err_code; xid_t xid; uint32_t usec_interval, sec_interval; - - //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 + + //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; int enb_id = mod_id; //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; //UE_list_t *eNB_UE_list= &eNB->UE_list; - + report_config_t report_config; uint32_t ue_flags = 0; @@ -96,7 +96,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; //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 = get_num_ues(mod_id); //eNB_UE_list->num_UEs report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); @@ -129,7 +129,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr stats_request_config_t request_config; request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; - request_config.period = 0; + request_config.period = 0; request_config.config = &report_config; enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ @@ -137,7 +137,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr enb_agent_timer_args_t *timer_args; timer_args = malloc(sizeof(enb_agent_timer_args_t)); memset (timer_args, 0, sizeof(enb_agent_timer_args_t)); - timer_args->mod_id = enb_id; + timer_args->mod_id = enb_id; timer_args->msg = timer_msg; /*Convert subframes to usec time*/ usec_interval = 1000*comp_req->sf; @@ -155,7 +155,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr stats_request_config_t request_config; request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; - request_config.period = 0; + request_config.period = 0; request_config.config = &report_config; enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } @@ -219,14 +219,14 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, - const stats_request_config_t *report_config, + const stats_request_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i; - + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) goto error; - + Protocol__PrpStatsRequest *stats_request_msg; stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); if(stats_request_msg == NULL) @@ -234,10 +234,10 @@ int enb_agent_mac_stats_request(mid_t mod_id, protocol__prp_stats_request__init(stats_request_msg); stats_request_msg->header = header; - + stats_request_msg->type = report_config->report_type; stats_request_msg->has_type = 1; - + switch (report_config->report_type) { case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; @@ -311,7 +311,7 @@ int enb_agent_mac_stats_request(mid_t mod_id, (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->stats_request_msg = stats_request_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -337,7 +337,7 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { free(msg->stats_request_msg); free(msg); return 0; - + error: //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -345,7 +345,7 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, - const report_config_t *report_config, + const report_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i, j, k; @@ -353,8 +353,8 @@ int enb_agent_mac_stats_reply(mid_t mod_id, int enb_id = mod_id; //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; //UE_list_t *eNB_UE_list= &eNB->UE_list; - - + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) goto error; @@ -371,7 +371,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, Protocol__PrpUeStatsReport **ue_report; Protocol__PrpCellStatsReport **cell_report; - + /* Allocate memory for list of UE reports */ if (report_config->nr_ue > 0) { ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); @@ -402,7 +402,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } ue_report[i]->bsr = elem; } - + /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI @@ -418,7 +418,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; - + // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { @@ -453,13 +453,13 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = -1; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__PRP_CE_TYPE__PRPCET_ values found in stats_common.pb-c.h. See prp_ce_type in progRAN specification */ ue_report[i]->has_pending_mac_ces = 1; } - + /* Check flag for creation of DL CQI report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { // TODO: Fill in the actual DL CQI report for the UE based on its configuration @@ -472,7 +472,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC - dl_report->n_csi_report = 1; + dl_report->n_csi_report = get_active_CC(enb_id,i); //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); @@ -484,36 +484,62 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_dl_csi__init(csi_reports[j]); //TODO: the servCellIndex for this report - csi_reports[j]->serv_cell_index = 0; + csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; //TODO: the rank indicator value for this cc - csi_reports[j]->ri = 1; + csi_reports[j]->ri = get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE //For this example we use type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and //in the progRAN specifications - csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; - csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; - Protocol__PrpCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__PrpCsiP10)); - if (csi10 == NULL) - goto error; - protocol__prp_csi_p10__init(csi10); - //TODO: set the wideband value - // NN: this is also depends on cc_id - csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; - csi10->has_wb_cqi = 1; - //Add the type of measurements to the csi report in the proper union type - csi_reports[j]->p10csi = csi10; - } + csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + csi_reports[j]->has_type = 1; + csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; + if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P10CSI){ + Protocol__PrpCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + if (csi10 == NULL) + goto error; + protocol__prp_csi_p10__init(csi10); + //TODO: set the wideband value + // NN: this is also depends on cc_id + csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->has_wb_cqi = 1; + //Add the type of measurements to the csi report in the proper union type + csi_reports[j]->p10csi = csi10; + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P11CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P20CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P21CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A12CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A22CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A20CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A30CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A31CSI){ + + } + } //Add the csi reports to the full DL CQI report dl_report->csi_report = csi_reports; //Add the DL CQI report to the stats report ue_report[i]->dl_cqi_report = dl_report; } - + /* Check flag for creation of paging buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI @@ -554,7 +580,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //Add the paging report to the UE report ue_report[i]->pbr = paging_report; } - + /* Check flag for creation of UL CQI report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { //Fill in the full UL CQI report of the UE @@ -648,7 +674,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Add list of all cell reports to the message */ stats_reply_msg->cell_report = cell_report; } - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -657,7 +683,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->stats_reply_msg = stats_reply_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -676,7 +702,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { goto error; free(msg->stats_reply_msg->header); int i, j, k; - + Protocol__PrpStatsReply *reply = msg->stats_reply_msg; Protocol__PrpDlCqiReport *dl_report; Protocol__PrpUlCqiReport *ul_report; @@ -737,8 +763,8 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(dl_report->csi_report[j]->a31csi->sb_cqi); break; - } - + } + free(dl_report->csi_report[j]); } free(dl_report->csi_report); @@ -773,11 +799,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(reply->cell_report[i]); } free(reply->cell_report); - + free(reply); free(msg); return 0; - + error: //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -796,7 +822,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes goto error; } protocol__prp_ul_sr_info__init(ul_sr_info_msg); - + ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); @@ -811,7 +837,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes for (i = 0; i < ul_sr_info_msg->n_rnti; i++) { ul_sr_info_msg->rnti[i] = 1; } - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -820,7 +846,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->ul_sr_info_msg = ul_sr_info_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -863,7 +889,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran goto error; } protocol__prp_sf_trigger__init(sf_trigger_msg); - + sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); @@ -872,7 +898,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran *transmitting UEs */ sf_trigger_msg->n_dl_info = get_num_ues(mod_id); - + Protocol__PrpDlInfo **dl_info = NULL; if (sf_trigger_msg->n_dl_info > 0) { @@ -901,14 +927,14 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->has_serv_cell_index = 1; } } - + sf_trigger_msg->dl_info = dl_info; /*TODO: Fill in the number of UL reception status related info, based on the number of currently *transmitting UEs */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); - + Protocol__PrpUlInfo **ul_info = NULL; if (sf_trigger_msg->n_ul_info > 0) { @@ -926,7 +952,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the Tx power control command for this UE (if available)*/ ul_info[i]->tpc = 1; ul_info[i]->has_tpc = 0; - /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the + /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ ul_info[i]->n_ul_reception = 11; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); @@ -941,7 +967,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->has_serv_cell_index = 1; } } - + sf_trigger_msg->ul_info = ul_info; *msg = malloc(sizeof(Protocol__ProgranMessage)); @@ -952,7 +978,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; - + error: if (header != NULL) free(header); @@ -977,7 +1003,7 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { int i; if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; - + free(msg->sf_trigger_msg->header); for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { free(msg->sf_trigger_msg->dl_info[i]->harq_status); @@ -989,7 +1015,7 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { free(msg->sf_trigger_msg->ul_info); free(msg->sf_trigger_msg); free(msg); - + return 0; error: @@ -1010,11 +1036,11 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage goto error; } protocol__prp_dl_mac_config__init(dl_mac_config_msg); - + dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -1056,7 +1082,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { free(msg->dl_mac_config_msg->dl_ue_data[i]); } free(msg->dl_mac_config_msg->dl_ue_data); - + for (i = 0; i < msg->dl_mac_config_msg->n_dl_rar; i++) { dl_dci = msg->dl_mac_config_msg->dl_rar[i]->rar_dci; free(dl_dci->tbs_size); @@ -1132,7 +1158,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { err_code_t err_code; int xid = 0; - + /*TODO: Must use a proper xid*/ err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { @@ -1161,20 +1187,20 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { int size; err_code_t err_code; int priority; - + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; } - + /*Create a fresh report with the required flags*/ err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_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 + /*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 (mac_stats_context[mod_id].prev_stats_reply != NULL) { @@ -1186,12 +1212,12 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } /*Use the current report for future comparissons*/ mac_stats_context[mod_id].prev_stats_reply = current_report; - - + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } - + if (msg != NULL){ data=enb_agent_pack_message(msg, &size); /*Send any stats updates using the MAC channel of the eNB*/ @@ -1219,7 +1245,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - + mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; @@ -1227,7 +1253,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; @@ -1236,7 +1262,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; - + return 0; } @@ -1246,7 +1272,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { ******************************************************/ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { - + /*Initialize the Mac stats update structure*/ /*Initially the continuous update is set to false*/ mac_stats_context[mod_id].cont_update = 0; @@ -1258,9 +1284,9 @@ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { goto error; if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) goto error;; - + return 0; - + error: return -1; } @@ -1272,7 +1298,7 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); - + mac_agent_registered[mod_id] = NULL; return 1; } @@ -1290,15 +1316,15 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; mac_stats_context[mod_id].prev_stats_reply = NULL; - + mac_stats_context[mod_id].cont_update = 1; mac_stats_context[mod_id].xid = xid; - + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } return 0; - + error: LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; @@ -1325,5 +1351,5 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { error: LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; - + } From cb8b6db577e8a9ab222d63c5758907610688eb3c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 19 Feb 2016 13:37:52 +0000 Subject: [PATCH 068/182] Fixed bug in periodic reporting, where ue flags were reset --- openair2/ENB_APP/enb_agent_mac.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index cb5aac1a95..c1af558414 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -130,6 +130,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_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; enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ From 258a71ffbd70bf79330c6cd1a9df4f15330d17df Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 19 Feb 2016 13:55:29 +0000 Subject: [PATCH 069/182] Fixed direction of hello message, as a reaction to controller stimulation --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index eb08107dff..41760733bc 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -123,7 +123,7 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage * protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; From 08e25bf397aad2e1db1ff655d7b185acfbed712a Mon Sep 17 00:00:00 2001 From: MKassem Date: Fri, 19 Feb 2016 14:48:50 +0000 Subject: [PATCH 070/182] Added eNB configuration message Signed-off-by: Xenofon Foukas --- openair2/ENB_APP/enb_agent_common.c | 519 +++++++++++++++++++++++++++- openair2/ENB_APP/enb_agent_common.h | 43 +++ openair2/LAYER2/MAC/extern.h | 2 + 3 files changed, 556 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 41760733bc..38f429f562 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -36,11 +36,13 @@ #include "enb_agent_common.h" +#include "PHY/extern.h" #include "log.h" void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; +void * enb_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -261,14 +263,33 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current eNB configuration */ - return 0; -} int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated eNB config message */ - return 0; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) + goto error; + free(msg->enb_config_reply_msg->header); + int i, j; + Protocol__PrpEnbConfigReply *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(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); + free(reply->cell_config[i]->si_config); + free(reply->cell_config[i]); + } + free(reply->cell_config); + free(reply); + free(msg); + + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { @@ -292,8 +313,16 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated eNB config message */ - return 0; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) + goto error; + free(msg->enb_config_request_msg->header); + free(msg->enb_config_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { @@ -316,6 +345,7 @@ void set_enb_vars(mid_t mod_id, ran_name_t 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; @@ -425,10 +455,483 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } + +/* + * ************************************ + * Get Messages for eNB Configuration Reply + * ************************************ + */ + +int get_hopping_offset(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.pusch_HoppingOffset; +} +int get_hopping_mode(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.hoppingMode; +} +int get_n_SB(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.n_SB; +} +int get_enable64QAM(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.enable64QAM; +} +int get_phich_duration(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->phich_config_common.phich_duration; +} +int get_phich_resource(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + if(frame_parms->phich_config_common.phich_resource == oneSixth) + return 0; + else if(frame_parms->phich_config_common.phich_resource == half) + return 1; + else if(frame_parms->phich_config_common.phich_resource == one) + return 2; + else if(frame_parms->phich_config_common.phich_resource == two) + return 3; + + return -1; +} +int get_n1pucch_an(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.n1PUCCH_AN; +} +int get_nRB_CQI(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.nRB_CQI; +} +int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.deltaPUCCH_Shift; +} +int get_prach_ConfigIndex(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; +} +int get_prach_FreqOffset(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; +} +int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->maxHARQ_Msg3Tx; +} +int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Ncp_UL; +} +int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Ncp; +} +int get_cell_id(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Nid_cell; +} +int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; +} +int get_srs_SubframeConfig(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; +} +int get_srs_MaxUpPts(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; +} +int get_N_RB_DL(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RB_DL; +} +int get_N_RB_UL(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RB_UL; +} +int get_subframe_assignment(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->tdd_config; +} +int get_special_subframe_assignment(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->tdd_config_S; +} +int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) +{ + Enb_properties_array_t *enb_properties; + enb_properties = enb_config_get(); + return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; +} +int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) +{ + Enb_properties_array_t *enb_properties; + enb_properties = enb_config_get(); + return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; +} +int get_duplex_mode(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + if(frame_parms->frame_type == 0) + return 1; + else if (frame_parms->frame_type == 1) + return 0; + + return -1; +} +long get_si_window_length(mid_t mod_id, int CC_id) +{ + return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; +} +int get_sib1_length(mid_t mod_id, int CC_id) +{ + return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; +} +int get_num_pdcch_symb(mid_t mod_id, int CC_id) +{ + /*TODO: add these values to some struct in MAC + LTE_UE_PDCCH *lte_ue_pdcch; + lte_ue_pdcch = mac_xface->get_lte_ue_pdcch(mod_id, CC_id, mod_id); + */ + return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); +} + /* * timer primitives */ +/* + * ************************************ + * eNB Configuration Request and Reply + * ************************************ + */ + +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { + + Protocol__PrpHeader *header; + xid_t xid = 1; + if(prp_create_header(xid,PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + goto error; + + Protocol__PrpEnbConfigRequest *enb_config_request_msg; + enb_config_request_msg = malloc(sizeof(Protocol__PrpEnbConfigRequest)); + + if(enb_config_request_msg == NULL) + goto error; + + protocol__prp_enb_config_request__init(enb_config_request_msg); + enb_config_request_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->enb_config_request_msg = enb_config_request_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_request_msg != NULL) + free(enb_config_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEnbConfigReply *enb_config_req_msg = input->enb_config_request_msg; + xid = (enb_config_req_msg->header)->xid; + + int i, j, k; + int cc_id = 0; + int enb_id = mod_id; + + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + if(enb_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(enb_config_reply_msg); + enb_config_reply_msg->header = header; + + enb_config_reply_msg->enb_id = mod_id; + + + enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; + + Protocol__PrpCellConfig **cell_conf; + if(enb_config_reply_msg->n_cell_config > 0){ + cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * 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++){ + cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); + protocol__prp_cell_config__init(cell_conf[i]); + //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = 1; + //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_cell_id = 1; + //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->has_pusch_hopping_offset = 1; + //TODO: Fill in with actual value + cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + cell_conf[i]->has_hopping_mode = 1; + //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->has_n_sb = 1; + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + cell_conf[i]->has_phich_resource = 1; + //TODO: Fill in with actual value, one of the PRPD_ values + cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + cell_conf[i]->has_phich_duration = 1; + //TODO: Fill in with actual value, See TS 36.211, section 6.9 + cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + //TODO: Fill in with actual value + Protocol__PrpSiConfig *si_config; + si_config = malloc(sizeof(Protocol__PrpSiConfig)); + if(si_config == NULL) + goto error; + protocol__prp_si_config__init(si_config); + //TODO: Fill in with actual value, Frame number to apply the SI configuration + si_config->sfn = 1; + si_config->has_sfn = 1; + //TODO: Fill in with actual value, the length of SIB1 in bytes + si_config->sib1_length = get_sib1_length(enb_id,i); + si_config->has_sib1_length = 1; + //TODO: Fill in with actual value, Scheduling window for all SIs in SF + si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); + si_config->has_si_window_length = 1; + //TODO: Fill in with actual value, the number of SI messages + si_config->n_si_message=1; + Protocol__PrpSiMessage **si_message; + si_message = malloc(sizeof(Protocol__PrpSiMessage *) * 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__PrpSiMessage)); + if(si_message[j] == NULL) + goto error; + protocol__prp_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; + + //TODO: Fill in with actual value, the DL transmission bandwidth in RBs + cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->has_dl_bandwidth = 1; + //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->has_ul_bandwidth = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_ul_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_dl_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, number of cell specific antenna ports + cell_conf[i]->antenna_ports_count = 1; + cell_conf[i]->has_antenna_ports_count = 1; + //TODO: Fill in with actual value, one of PRDM values + cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + cell_conf[i]->has_duplex_mode = 1; + //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only + cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->has_subframe_assignment = 1; + //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 + cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_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 = 5; + 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 = 5; + 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 = 5; + 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; + + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->has_prach_config_index = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->has_prach_freq_offset = 1; + //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->has_ra_response_window_size = 1; + //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->has_mac_contention_resolution_timer = 1; + //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->has_max_harq_msg3tx = 1; + //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->has_n1pucch_an = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->has_deltapucch_shift = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->has_nrb_cqi = 1; + //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->has_srs_subframe_config = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->has_srs_bw_config = 1; + //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->has_srs_mac_up_pts = 1; + //TODO: Fill in with actual value, One of the PREQ_ values + cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + cell_conf[i]->has_enable_64qam = 1; + //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; + cell_conf[i]->has_carrier_index = 1; + } + enb_config_reply_msg->cell_config=cell_conf; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->enb_config_reply_msg = enb_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_reply_msg != NULL) + free(enb_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 37d3829354..07d743ecb4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -47,6 +47,7 @@ #include "stats_common.pb-c.h" # include "enb_agent_defs.h" +#include "enb_config.h" #include "LAYER2/MAC/extern.h" #include "LAYER2/RLC/rlc.h" @@ -100,6 +101,7 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg); int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); @@ -156,6 +158,47 @@ 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); /******************* diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index ca847acf4c..2810235255 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -50,12 +50,14 @@ //#include "SIMULATION/simulation_defs.h" #endif //PHY_EMUL #include "PHY_INTERFACE/defs.h" +#include "RRC/LITE/defs.h" extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; +extern eNB_RRC_INST *eNB_rrc_inst; extern MAC_RLC_XFACE *Mac_rlc_xface; extern uint8_t Is_rrc_registered; From 93cf1b1df723f770e1e6fd094ff95db6bc26aad3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sun, 21 Feb 2016 21:39:22 +0000 Subject: [PATCH 071/182] Fixed bug in assignment of enb_config_request_message --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 38f429f562..a87a6be8e3 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -718,7 +718,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr xid_t xid; Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigReply *enb_config_req_msg = input->enb_config_request_msg; + Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; xid = (enb_config_req_msg->header)->xid; int i, j, k; From 7b1ee53a4e759890beeb83fa227247c3bb0b9d9f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 11:26:52 +0000 Subject: [PATCH 072/182] Implemented UE config message (dummy) --- openair2/ENB_APP/enb_agent_common.c | 179 +++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a87a6be8e3..768764b152 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -293,13 +293,188 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current UE configurations */ + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + xid = (ue_config_request_msg->header)->xid; + + int i; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + if(ue_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(ue_config_reply_msg); + ue_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that are currently connected + ue_config_reply_msg->n_ue_config = 1; + + Protocol__PrpUeConfig **ue_config; + if (ue_config_reply_msg->n_ue_config > 0) { + ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + if (ue_config == NULL) { + goto error; + } + for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + protocol__prp_ue_config__init(ue_config[i]); + //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = 1; + ue_config[i]->has_rnti = 1; + //TODO: Set the DRX configuration (optional) + //Not supported for now, so we do not set it + + //TODO: Set the time_alignment_timer + ue_config[i]->time_alignment_timer = 1; + ue_config[i]->has_time_alignment_timer = 1; + //TODO: Set the measurement gap configuration pattern + ue_config[i]->meas_gap_config_pattern = 1; + ue_config[i]->has_meas_gap_config_pattern = 1; + //TODO: Set the measurement gap offset if applicable + ue_config[i]->meas_gap_config_sf_offset = 1; + 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 + + //TODO: Set the transmission mode + ue_config[i]->transmission_mode = 1; + ue_config[i]->has_transmission_mode = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + ue_config[i]->ue_aggregated_max_bitrate_ul = 1; + ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + ue_config[i]->ue_aggregated_max_bitrate_dl = 1; + ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(capabilities); + //TODO: Set half duplex (FDD operation) + capabilities->has_half_duplex = 1; + capabilities->half_duplex = 1; + //TODO: Set intra-frame hopping flag + capabilities->has_intra_sf_hopping = 1; + capabilities->intra_sf_hopping = 1; + //TODO: Set support for type 2 hopping with n_sb > 1 + capabilities->has_type2_sb_1 = 1; + capabilities->type2_sb_1 = 1; + //TODO: Set ue category + capabilities->has_ue_category = 1; + capabilities->ue_category = 1; + //TODO: Set UE support for resource allocation type 1 + capabilities->has_res_alloc_type1 = 1; + capabilities->res_alloc_type1 = 1; + //Set the capabilites to the message + ue_config[i]->capabilities = capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = PROTOCOL__PRP_UE_TRANSMISSION_ANTENNA__PRUTA_OPEN_LOOP; + //TODO: Set tti bundling flag (See ts 36.321) + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = 1; + //TODO: Set the max HARQ retransmission for the UL + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = 1; + //TODO: Fill beta_offset_ack_index (TS 36.213) + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = 1; + //TODO: Fill beta_offset_ri_index (TS 36.213) + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = 1; + //TODO: Fill beta_offset_cqi_index (TS 36.213) + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = 1; + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = 1; + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = 1; + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_RM12; + //TODO: Set tdd_ack_nack_feedback + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = 1; + //TODO: Set ack_nack_repetition factor + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = 1; + //TODO: Set extended BSR size + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = 1; + //TODO: Set carrier aggregation support (boolean) + ue_config[i]->has_ca_support = 1; + ue_config[i]->ca_support = 0; + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //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 = 1; + ue_config[i]->scell_deactivation_timer = 1; + } + ue_config_reply_msg->ue_config = ue_config; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->ue_config_reply_msg = ue_config_reply_msg; return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ue_config_reply_msg != NULL) + free(ue_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { - /*TODO: Deallocate memory for a dynamically allocated UE config message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) + goto error; + free(msg->ue_config_reply_msg->header); + int i, j; + Protocol__PrpUeConfigReply *reply = msg->ue_config_reply_msg; + + for(i = 0; i < reply->n_ue_config;i++){ + free(reply->ue_config[i]->capabilities); + free(reply->ue_config[i]); + } + free(reply->ue_config); + free(reply); + free(msg); + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { From b523682af04f4a25e75c4f961c7db7d574135fe9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 11:55:46 +0000 Subject: [PATCH 073/182] Added support for UE state change message --- openair2/ENB_APP/MESSAGES/V2/config_common.proto | 6 ++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index ab6e8b8c22..f7a4b1ee07 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -172,3 +172,9 @@ enum prp_qos_bearer_type { PRQBT_GBR = 1; } +enum prp_ue_state_change_type { + PRUESC_UPDATED = 0; + PRUESC_ACTIVATED = 1; + PRUESC_DEACTIVATED = 2; + PRUESC_MOVED = 3; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index be0341f132..8e6adb1fda 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -32,5 +32,8 @@ enum prp_type { //Controller command messages PRPT_DL_MAC_CONFIG = 13; + + // UE state change messages + PRPT_UE_STATE_CHANGE = 14; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 2bcf9bbc95..44fffc7ead 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -24,6 +24,7 @@ message progran_message { prp_lc_config_request lc_config_request_msg = 12; prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; + prp_ue_state_change ue_state_change_msg = 15; } } @@ -159,6 +160,16 @@ message prp_dl_mac_config { repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC } +// +// UE state change message +// + +message prp_ue_state_change { + optional prp_header header = 1; + optional uint32 type = 2; // One of the PRUESC_* values + optional prp_ue_config config = 3; // Body of the message (based on type) +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 1caa45ad4bef2d305484257cf928b662a5fddc10 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 12:05:17 +0000 Subject: [PATCH 074/182] Integrated UE state messages to agent --- openair2/ENB_APP/enb_agent_common.c | 10 ++++++++++ openair2/ENB_APP/enb_agent_common.h | 2 ++ openair2/ENB_APP/enb_agent_handler.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 768764b152..b30b748424 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -487,6 +487,16 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return 0; } +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { + /* TODO: Create a progRAN message with the state changes requested for the UE with RNTI rnti */ + return 0; +} + +int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { + /* TODO: Dealocate memory for a dynamically allocated UE state change message */ + return 0; +} + int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 07d743ecb4..bb7b20fdb4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -108,6 +108,8 @@ int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); +int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 9815732088..2162a29314 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -56,6 +56,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ }; @@ -74,6 +75,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_lc_config_request, enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, + enb_agent_destroy_ue_state_change, }; static const char *enb_agent_direction2String[] = { From 591cb51a2dff0e728a4ca8310b229f3d00ff12fc Mon Sep 17 00:00:00 2001 From: MKassem Date: Mon, 22 Feb 2016 12:03:02 +0000 Subject: [PATCH 075/182] Added sf trigger API functions Signed-off-by: Xenofon Foukas --- openair2/ENB_APP/enb_agent_common.c | 50 +++++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 3 ++ openair2/ENB_APP/enb_agent_mac.c | 18 +++++++---- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index b30b748424..c07dcb243e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -640,6 +640,56 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } +int get_tpc(mid_t mod_id, mid_t ue_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + int32_t normalized_rx_power, target_rx_power; + int tpc = 1; + + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); + + normalized_rx_power = eNB_UE_stats->UL_rssi[0]; + + target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); + + if (normalized_rx_power>(target_rx_power+1)) { + tpc = 0; //-1 + } else if (normalized_rx_power<(target_rx_power-1)) { + tpc = 2; //+1 + } else { + tpc = 1; //0 + } + return tpc; +} + +int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status) //flag_id_status = 0 then id, else status +{ + /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in + * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add + * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ + + uint8_t *harq_pid = malloc(sizeof(uint8_t)); + uint8_t *round = malloc(sizeof(uint8_t)); + + uint16_t rnti = get_ue_crnti(mod_id,ue_id); + + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + + if(flag_id_status == 0) + return *harq_pid; + else if(flag_id_status == 1) + { + if(*round > 0) + return 1; + else + return 0; + } + return 150; +} + /* * ************************************ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index bb7b20fdb4..f45f68ef9a 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -202,6 +202,9 @@ 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(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status); /******************* * timer primitves diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index c1af558414..a780c0b6c8 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -926,16 +926,16 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ - dl_info[i]->harq_process_id = 1; + dl_info[i]->harq_process_id = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),0); dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[j]->n_harq_status; j++) { - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + dl_info[i]->harq_status[j] = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),1); } /*TODO: fill in the serving cell index for this UE */ - dl_info[i]->serv_cell_index = 0; + dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); dl_info[i]->has_serv_cell_index = 1; } } @@ -962,8 +962,14 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*TODO: fill in the Tx power control command for this UE (if available)*/ - ul_info[i]->tpc = 1; - ul_info[i]->has_tpc = 0; + if(get_tpc(mod_id,i) != 1){ + ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->has_tpc = 1; + } + else{ + ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->has_tpc = 0; + } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ ul_info[i]->n_ul_reception = 11; @@ -975,7 +981,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; ul_info[i]->has_reception_status = 1; /*TODO: fill in the serving cell index for this UE */ - ul_info[i]->serv_cell_index = 0; + ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); ul_info[i]->has_serv_cell_index = 1; } } From e6e117a567b140ea70d13dfc951fbf68056f05f4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 13:08:26 +0000 Subject: [PATCH 076/182] Implemented LC config reply message --- .../ENB_APP/MESSAGES/V2/config_common.proto | 2 +- openair2/ENB_APP/enb_agent_common.c | 142 ++++++++++++++++-- 2 files changed, 130 insertions(+), 14 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index f7a4b1ee07..cf07f423aa 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -158,7 +158,7 @@ message prp_lc_config { optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only) optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only) - optional uint64 e_RAB_guranteed_bitrate_DL = 9; // In bps (GBR only) + optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only) } enum prp_lc_direction { diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c07dcb243e..eb19052476 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -322,7 +322,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); protocol__prp_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = 1; @@ -478,13 +478,129 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current LC configurations */ + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + xid = (lc_config_request_msg->header)->xid; + + int i, j; + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + if(lc_config_reply_msg == NULL) + goto error; + protocol__prp_lc_config_reply__init(lc_config_reply_msg); + lc_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that we are going to report LC configs about + lc_config_reply_msg->n_lc_ue_config = 1; + + Protocol__PrpLcUeConfig **lc_ue_config; + if (lc_config_reply_msg->n_lc_ue_config > 0) { + lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * 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++) { + lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); + protocol__prp_lc_ue_config__init(lc_ue_config[i]); + //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; + lc_ue_config[i]->rnti = 1; + //TODO: Set the number of LC configurations that will be reported for this UE + lc_ue_config[i]->n_lc_config = 3; + Protocol__PrpLcConfig **lc_config; + if (lc_ue_config[i]->n_lc_config > 0) { + lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * 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__PrpLcConfig)); + protocol__prp_lc_config__init(lc_config[j]); + //TODO: Set the LC id + lc_config[j]->has_lcid = 1; + lc_config[j]->lcid = 1; + //TODO: Set the LCG of the channel + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = 1; + //TODO: Set the LC direction + lc_config[j]->has_direction = 1; + lc_config[j]->direction = PROTOCOL__PRP_LC_DIRECTION__PRLCD_BOTH; + //TODO: Bearer type. One of PRQBT_* values + lc_config[j]->has_qos_bearer_type = 1; + lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_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 + lc_config[j]->has_qci = 1; + lc_config[j]->qci = 1; + if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + //TODO: Set the max bitrate (UL) + lc_config[j]->has_e_rab_max_bitrate_ul = 1; + lc_config[j]->e_rab_max_bitrate_ul = 1; + //TODO: Set the max bitrate (DL) + lc_config[j]->has_e_rab_max_bitrate_dl = 1; + lc_config[j]->e_rab_max_bitrate_dl = 1; + //TODO: Set the guaranteed bitrate (UL) + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + //TODO: Set the guaranteed bitrate (DL) + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + } + } + lc_ue_config[i]->lc_config = lc_config; + } + } // end for UE + lc_config_reply_msg->lc_ue_config = lc_ue_config; + } // lc_config_reply_msg->n_lc_ue_config > 0 + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->lc_config_reply_msg = lc_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (lc_config_reply_msg != NULL) + free(lc_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated LC config message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) + goto error; + + int i, j; + free(msg->lc_config_reply_msg->header); + for (i = 0; i < msg->lc_config_reply_msg->n_lc_ue_config; i++) { + for (j = 0; j < msg->lc_config_reply_msg->lc_ue_config[i]->n_lc_config; j++) { + free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config[j]); + } + free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config); + free(msg->lc_config_reply_msg->lc_ue_config[i]); + } + free(msg->lc_config_reply_msg->lc_ue_config); + free(msg->lc_config_reply_msg); + free(msg); return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { @@ -498,16 +614,16 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) - goto error; - free(msg->enb_config_request_msg->header); - free(msg->enb_config_request_msg); - free(msg); - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) + goto error; + free(msg->enb_config_request_msg->header); + free(msg->enb_config_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { From 991e995027f42b0d2f68bc8fe7d0d6847b36b35d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 14:08:11 +0000 Subject: [PATCH 077/182] Changed get_harq function to provide both id and status at once --- openair2/ENB_APP/enb_agent_common.c | 29 ++++++++++++++--------------- openair2/ENB_APP/enb_agent_common.h | 3 ++- openair2/ENB_APP/enb_agent_mac.c | 8 ++++++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index eb19052476..51d7161b58 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -781,29 +781,28 @@ int get_tpc(mid_t mod_id, mid_t ue_id) return tpc; } -int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status) //flag_id_status = 0 then id, else status +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) //flag_id_status = 0 then id, else status { /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ - uint8_t *harq_pid = malloc(sizeof(uint8_t)); - uint8_t *round = malloc(sizeof(uint8_t)); + uint8_t harq_pid; + uint8_t round; + - uint16_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t rnti = get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); - if(flag_id_status == 0) - return *harq_pid; - else if(flag_id_status == 1) - { - if(*round > 0) - return 1; - else - return 0; - } - return 150; + *id = harq_pid; + if (round > 0) { + *status = 1; + } else { + *status = 0; + } + + return 0; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f45f68ef9a..6a31094417 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -204,7 +204,8 @@ 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(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status); +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); /******************* * timer primitves diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index a780c0b6c8..dfe29bcc3e 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -926,13 +926,17 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ - dl_info[i]->harq_process_id = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),0); + int harq_id; + int harq_status; + get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),&harq_id, &harq_status); + dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[j]->n_harq_status; j++) { - dl_info[i]->harq_status[j] = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),1); + // TODO: This should be different per TB + dl_info[i]->harq_status[j] = harq_status; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); From 465168d2af443989cfa791bd0c6c0a71dc9f3196 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 14:45:39 +0000 Subject: [PATCH 078/182] Integrated sf triggering to MAC layer and fixed bugs in creation of sf trigger message --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- openair2/LAYER2/MAC/eNB_scheduler.c | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index dfe29bcc3e..f31da89d81 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -918,7 +918,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE - for(i = 0; i++; i < sf_trigger_msg->n_dl_info) { + for(i = 0; i < sf_trigger_msg->n_dl_info; i++) { dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); if(dl_info[i] == NULL) goto error; @@ -934,7 +934,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); - for (j = 0; j < dl_info[j]->n_harq_status; j++) { + for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB dl_info[i]->harq_status[j] = harq_status; } @@ -958,7 +958,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE - for(i = 0; i++; i < sf_trigger_msg->n_ul_info) { + for(i = 0; i < sf_trigger_msg->n_ul_info; i++) { ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); if(ul_info[i] == NULL) goto error; @@ -978,7 +978,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran given logical channel*/ ul_info[i]->n_ul_reception = 11; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); - for (j = 0; j < ul_info[j]->n_ul_reception; j++) { + for (j = 0; j < ul_info[i]->n_ul_reception; j++) { ul_info[i]->ul_reception[j] = 100; } /*TODO: Fill in the reception status for each UEs data*/ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 54b31b6e64..a39b9efb54 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -71,6 +71,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 #define ENABLE_ENB_AGENT_DL_SCHEDULER +//#define DISABLE_SF_TRIGGER //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -207,7 +208,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } - + +#ifndef DISABLE_SF_TRIGGER + //Send subframe trigger to the controller + if (mac_agent_registered[module_idP]) { + agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); + } +#endif + //if (subframeP%5 == 0) //#ifdef EXMIMO PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,module_idP); From 95d51446f8a1cab7a7e14773d6ed6756020bec99 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 15:22:21 +0000 Subject: [PATCH 079/182] Added ue_state_change stub implementation --- openair2/ENB_APP/enb_agent_common.c | 73 +++++++++++++++++++++++++-- openair2/ENB_APP/enb_agent_mac.c | 2 +- openair2/ENB_APP/enb_agent_mac_defs.h | 6 +++ 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 51d7161b58..1e7efe920a 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -604,13 +604,80 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { - /* TODO: Create a progRAN message with the state changes requested for the UE with RNTI rnti */ - return 0; + int size; + Protocol__ProgranMessage *msg; + Protocol__PrpHeader *header; + void *data; + int priority; + err_code_t err_code; + + int xid = 0; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + goto error; + + Protocol__PrpUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + if(ue_state_change_msg == NULL) { + goto error; + } + protocol__prp_ue_state_change__init(ue_state_change_msg); + ue_state_change_msg->has_type = 1; + ue_state_change_msg->type = state_change; + + Protocol__PrpUeConfig *config; + config = malloc(sizeof(Protocol__PrpUeConfig)); + if (config == NULL) { + goto error; + } + protocol__prp_ue_config__init(config); + if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + // Simply set the rnti of the UE + config->has_rnti = 1; + config->rnti = rnti; + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED + || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + // TODO: Set the whole UE configuration message + + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + // TODO: Not supported for now. Leave blank + } + + ue_state_change_msg->config = config; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if (msg == NULL) { + goto error; + } + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + msg->ue_state_change_msg = ue_state_change_msg; + + data = enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + error: + LOG_D(ENB_AGENT, "Could not send UE state message\n"); } int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { - /* TODO: Dealocate memory for a dynamically allocated UE state change message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) + goto error; + free(msg->ue_state_change_msg->header); + //TODO: Free the contents of the UE config structure + free(msg->ue_state_change_msg); + free(msg); return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index f31da89d81..5c279958fe 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1266,7 +1266,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - + xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 6e960cdb69..657fc94fe4 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -62,6 +62,12 @@ typedef struct { void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + + /// Notify the controller for a state change of a particular UE, by sending the proper + /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) + void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, + uint32_t state_change); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; From 02686ce804ffad77c279d1d7a85ea54399701f34 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 15:29:10 +0000 Subject: [PATCH 080/182] Added temporary notification for the deactivation of a UE in the MAC --- openair2/LAYER2/MAC/eNB_scheduler.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index a39b9efb54..774feda961 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -135,6 +135,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti)==NULL) { mac_remove_ue(module_idP, i, frameP, subframeP); + //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future + if (mac_agent_registered[module_idP]) { + agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, + rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED); + } } i = next_i; } From 7dd05df4ea724355fa80ea620db2ccba28f8ed0f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 10:29:53 +0000 Subject: [PATCH 081/182] Added configuration support for local cache --- openair2/ENB_APP/enb_agent.c | 8 ++++++++ openair2/ENB_APP/enb_agent_defs.h | 1 + openair2/ENB_APP/enb_agent_extern.h | 2 ++ openair2/ENB_APP/enb_config.c | 7 ++++++- openair2/ENB_APP/enb_config.h | 1 + .../CONF/enb.band7.agent.oaisim.local_no_mme.conf | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c9c42a41d9..7d2029b37f 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -52,6 +52,7 @@ enb_agent_instance_t enb_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; +char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); @@ -203,6 +204,13 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * check the configuration */ + if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache)); + local_cache[sizeof(local_cache) - 1] = 0; + } else { + strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE); + } + if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); in_ip[sizeof(in_ip) - 1] = 0; // terminate string diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 020c631ff1..9d1e3f75fc 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -47,6 +47,7 @@ #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 +#define DEFAULT_ENB_AGENT_CACHE "/mnt/tmpfs" typedef enum { diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 1ef2250483..0dd7cfb90f 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,6 +44,8 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +extern char local_cache[40]; + extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index d5a70734fd..6983b8c2c6 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -174,6 +174,7 @@ #define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" #define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" #define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" +#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" @@ -325,6 +326,7 @@ static void enb_config_display(void) printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); + printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache); #endif @@ -641,6 +643,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char* enb_agent_interface_name = NULL; char* enb_agent_ipv4_address = NULL; libconfig_int enb_agent_port = 0; + char* enb_agent_cache = NULL; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2363,6 +2366,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) (const char **)&enb_agent_ipv4_address) && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, &enb_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE, + (const char **)&enb_agent_cache) ) ) { enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); @@ -2374,7 +2379,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) }*/ enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; - + enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache); } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 25b6c88479..2e873fdf52 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -224,6 +224,7 @@ typedef struct Enb_properties_s { char *enb_agent_interface_name; in_addr_t enb_agent_ipv4_address; tcp_udp_port_t enb_agent_port; + char *enb_agent_cache; /* Nb of RRH to connect to */ uint8_t nb_rrh_gw; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf index 045a2855a0..578a2e3f2c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -123,6 +123,7 @@ eNBs = ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/tmpfs"; }; log_config : From d8cc6d95e62d5b704891f73f77c67df297a8f59a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 10:47:08 +0000 Subject: [PATCH 082/182] Added support for control delegation and dynamic loading of libraries --- cmake_targets/CMakeLists.txt | 13 +++++++++---- .../ENB_APP/MESSAGES/V2/control_delegation.proto | 6 ++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 13 +++++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/control_delegation.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 49d18c80f8..85a6f35339 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -796,6 +796,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/mac_primitives.proto ${PRPT_MSG_DIR}/config_messages.proto ${PRPT_MSG_DIR}/config_common.proto + ${PRPT_MSG_DIR}/control_delegation.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -812,6 +813,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/mac_primitives.pb-c.c ${PRPT_C_DIR}/config_messages.pb-c.c ${PRPT_C_DIR}/config_common.pb-c.c + ${PRPT_C_DIR}/control_delegation.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) @@ -1109,6 +1111,9 @@ add_library(L2 ${ENB_APP_SRC} ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) +#Test for adding a shared library +add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) + # L3 Libs ########################## @@ -1604,7 +1609,7 @@ target_link_libraries (lte-softmodem 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} ${PROTOBUF_LIB}) +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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) @@ -1638,7 +1643,7 @@ target_link_libraries (lte-softmodem-nos1 -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} ${PROTOBUF_LIB}) +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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) @@ -1770,12 +1775,12 @@ 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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -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} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto new file mode 100644 index 0000000000..c5ce58d3a2 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto @@ -0,0 +1,6 @@ +//'syntax = "proto2";' +package protocol; + +enum prp_control_delegation_type { + PRCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 8e6adb1fda..6ce9959104 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -35,5 +35,8 @@ enum prp_type { // UE state change messages PRPT_UE_STATE_CHANGE = 14; + + // Control delegation messages + PRPT_DELEGATE_CONTROL = 15; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 44fffc7ead..6b7b784629 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -6,6 +6,7 @@ import "header.proto"; import "time_common.proto"; import "config_messages.proto"; import "controller_commands.proto"; +import "control_delegation.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -25,6 +26,7 @@ message progran_message { prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; prp_ue_state_change ue_state_change_msg = 15; + prp_control_delegation control_delegation_msg = 16; } } @@ -170,6 +172,17 @@ message prp_ue_state_change { optional prp_ue_config config = 3; // Body of the message (based on type) } +// +// Control delegation message +// + +message prp_control_delegation { + optional prp_header header = 1; + optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags + optional bytes payload = 3; // Byte array of shared lib containing the delegated functions + repeated string name = 4; // The delegated functions names ordered based on bitmap flags +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 25e5e3b8378aab8090e650721a0c53ef3d4a9798 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 11:08:14 +0000 Subject: [PATCH 083/182] Added script to automatically create cache for agent --- cmake_targets/tools/make_agent_cache | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 cmake_targets/tools/make_agent_cache diff --git a/cmake_targets/tools/make_agent_cache b/cmake_targets/tools/make_agent_cache new file mode 100755 index 0000000000..d2eab20fc0 --- /dev/null +++ b/cmake_targets/tools/make_agent_cache @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +CACHE_DIR=/mnt/oai_agent_cache + +if [ ! -d $CACHE_DIR ]; then + echo "Creating cache dir in $CACHE_DIR" + sudo mkdir $CACHE_DIR +fi + +if grep -qs "$CACHE_DIR" /proc/mounts; then + echo "Agent cache is already mounted" +else + echo "Agent cache was not mounted" + echo "Mounting..." + sudo mount -o size=100m -t tmpfs none "$CACHE_DIR" + if [ $? -eq 0 ]; then + echo "Mount success" + else + echo "Something went wrong with the mount" + fi +fi From 46724972062357e8323b03c40cdb13967e4a35d5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 12:56:09 +0000 Subject: [PATCH 084/182] Added support for DL UE scheduler control delegation --- openair2/ENB_APP/enb_agent_common.c | 74 +++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 3 + openair2/ENB_APP/enb_agent_defs.h | 2 +- openair2/ENB_APP/enb_agent_handler.c | 2 + .../enb.band7.agent.oaisim.local_no_mme.conf | 2 +- 5 files changed, 81 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1e7efe920a..f4f8c333d0 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -34,8 +34,12 @@ * \version 0.1 */ +#include +#include +#include #include "enb_agent_common.h" +#include "enb_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -703,6 +707,76 @@ int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { 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; +} + +// 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 enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpControlDelegation *control_delegation_msg = input->control_delegation_msg; + + uint32_t delegation_type = control_delegation_msg->delegation_type; + + void *lib; + int i; + + struct timespec vartime = timer_start(); + + //Write the payload lib into a file in the cache and load the lib + char lib_name[120]; + char target[512]; + snprintf(lib_name, sizeof(lib_name), "/delegation_lib_%d.so", control_delegation_msg->header->xid); + strcpy(target, local_cache); + strcat(target, lib_name); + + FILE *f; + f = fopen(target, "wb"); + fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f); + fclose(f); + lib = dlopen(target, RTLD_NOW); + if (lib == NULL) { + goto error; + } + + i = 0; + //Check functions that need to be delegated + + //DL UE scheduler delegation + if (delegation_type & PROTOCOL__PRP_CONTROL_DELEGATION_TYPE__PRCDT_MAC_DL_UE_SCHEDULER) { + void *loaded_scheduler = dlsym(lib, control_delegation_msg->name[i]); + i++; + if (loaded_scheduler) { + if (mac_agent_registered[mod_id]) { + agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + LOG_D(ENB_APP,"Delegated control for DL UE scheduler successfully\n"); + } + } + } + long time_elapsed_nanos = timer_end(vartime); + LOG_I(ENB_AGENT, "DID IT IN %lld\n", time_elapsed_nanos); + *msg = NULL; + return 0; + + error: + return -1; +} + +int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { + /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 6a31094417..73ce0ec788 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -111,6 +111,9 @@ int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 9d1e3f75fc..8d71aa2db3 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -47,7 +47,7 @@ #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 -#define DEFAULT_ENB_AGENT_CACHE "/mnt/tmpfs" +#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache" typedef enum { diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2162a29314..d4e5706b11 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -57,6 +57,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ + {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ }; @@ -76,6 +77,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, enb_agent_destroy_ue_state_change, + enb_agent_destroy_control_delegation, }; static const char *enb_agent_direction2String[] = { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf index 578a2e3f2c..f95cfd9389 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -123,7 +123,7 @@ eNBs = ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/tmpfs"; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : From 0ec3cfdf04ab7b63aeb7a787136b86c19499ad67 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 14:18:49 +0000 Subject: [PATCH 085/182] Added UE and LC config API function calls --- openair2/ENB_APP/enb_agent_common.c | 709 +++++++++++++++++----------- openair2/ENB_APP/enb_agent_common.h | 56 +++ openair2/LAYER2/MAC/extern.h | 2 + 3 files changed, 499 insertions(+), 268 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f4f8c333d0..4a175c244e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -47,6 +47,7 @@ void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; +void * enb_ue_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -296,170 +297,6 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; - xid = (ue_config_request_msg->header)->xid; - - int i; - - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpUeConfigReply *ue_config_reply_msg; - ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); - if(ue_config_reply_msg == NULL) - goto error; - protocol__prp_enb_config_reply__init(ue_config_reply_msg); - ue_config_reply_msg->header = header; - - //TODO: Fill in the actual number of UEs that are currently connected - ue_config_reply_msg->n_ue_config = 1; - - Protocol__PrpUeConfig **ue_config; - if (ue_config_reply_msg->n_ue_config > 0) { - ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); - if (ue_config == NULL) { - goto error; - } - for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); - protocol__prp_ue_config__init(ue_config[i]); - //TODO: Set the RNTI of the ue with id i - ue_config[i]->rnti = 1; - ue_config[i]->has_rnti = 1; - //TODO: Set the DRX configuration (optional) - //Not supported for now, so we do not set it - - //TODO: Set the time_alignment_timer - ue_config[i]->time_alignment_timer = 1; - ue_config[i]->has_time_alignment_timer = 1; - //TODO: Set the measurement gap configuration pattern - ue_config[i]->meas_gap_config_pattern = 1; - ue_config[i]->has_meas_gap_config_pattern = 1; - //TODO: Set the measurement gap offset if applicable - ue_config[i]->meas_gap_config_sf_offset = 1; - 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 - - //TODO: Set the transmission mode - ue_config[i]->transmission_mode = 1; - ue_config[i]->has_transmission_mode = 1; - - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) - ue_config[i]->ue_aggregated_max_bitrate_ul = 1; - ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) - ue_config[i]->ue_aggregated_max_bitrate_dl = 1; - ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; - - //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *capabilities; - capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(capabilities); - //TODO: Set half duplex (FDD operation) - capabilities->has_half_duplex = 1; - capabilities->half_duplex = 1; - //TODO: Set intra-frame hopping flag - capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = 1; - //TODO: Set support for type 2 hopping with n_sb > 1 - capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = 1; - //TODO: Set ue category - capabilities->has_ue_category = 1; - capabilities->ue_category = 1; - //TODO: Set UE support for resource allocation type 1 - capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = 1; - //Set the capabilites to the message - ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = PROTOCOL__PRP_UE_TRANSMISSION_ANTENNA__PRUTA_OPEN_LOOP; - //TODO: Set tti bundling flag (See ts 36.321) - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = 1; - //TODO: Set the max HARQ retransmission for the UL - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = 1; - //TODO: Fill beta_offset_ack_index (TS 36.213) - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = 1; - //TODO: Fill beta_offset_ri_index (TS 36.213) - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = 1; - //TODO: Fill beta_offset_cqi_index (TS 36.213) - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = 1; - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = 1; - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = 1; - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_RM12; - //TODO: Set tdd_ack_nack_feedback - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = 1; - //TODO: Set ack_nack_repetition factor - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = 1; - //TODO: Set extended BSR size - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = 1; - //TODO: Set carrier aggregation support (boolean) - ue_config[i]->has_ca_support = 1; - ue_config[i]->ca_support = 0; - //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 1; - ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; - //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 = 1; - ue_config[i]->scell_deactivation_timer = 1; - } - ue_config_reply_msg->ue_config = ue_config; - } - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if (*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->ue_config_reply_msg = ue_config_reply_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (ue_config_reply_msg != NULL) - free(ue_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; @@ -481,110 +318,6 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; - xid = (lc_config_request_msg->header)->xid; - - int i, j; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpLcConfigReply *lc_config_reply_msg; - lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); - if(lc_config_reply_msg == NULL) - goto error; - protocol__prp_lc_config_reply__init(lc_config_reply_msg); - lc_config_reply_msg->header = header; - - //TODO: Fill in the actual number of UEs that we are going to report LC configs about - lc_config_reply_msg->n_lc_ue_config = 1; - - Protocol__PrpLcUeConfig **lc_ue_config; - if (lc_config_reply_msg->n_lc_ue_config > 0) { - lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * 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++) { - lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); - protocol__prp_lc_ue_config__init(lc_ue_config[i]); - //TODO: Set the RNTI of the UE - lc_ue_config[i]->has_rnti = 1; - lc_ue_config[i]->rnti = 1; - //TODO: Set the number of LC configurations that will be reported for this UE - lc_ue_config[i]->n_lc_config = 3; - Protocol__PrpLcConfig **lc_config; - if (lc_ue_config[i]->n_lc_config > 0) { - lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * 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__PrpLcConfig)); - protocol__prp_lc_config__init(lc_config[j]); - //TODO: Set the LC id - lc_config[j]->has_lcid = 1; - lc_config[j]->lcid = 1; - //TODO: Set the LCG of the channel - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = 1; - //TODO: Set the LC direction - lc_config[j]->has_direction = 1; - lc_config[j]->direction = PROTOCOL__PRP_LC_DIRECTION__PRLCD_BOTH; - //TODO: Bearer type. One of PRQBT_* values - lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_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 - lc_config[j]->has_qci = 1; - lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { - //TODO: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 1; - lc_config[j]->e_rab_max_bitrate_ul = 1; - //TODO: Set the max bitrate (DL) - lc_config[j]->has_e_rab_max_bitrate_dl = 1; - lc_config[j]->e_rab_max_bitrate_dl = 1; - //TODO: Set the guaranteed bitrate (UL) - lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; - //TODO: Set the guaranteed bitrate (DL) - lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; - } - } - lc_ue_config[i]->lc_config = lc_config; - } - } // end for UE - lc_config_reply_msg->lc_ue_config = lc_ue_config; - } // lc_config_reply_msg->n_lc_ue_config > 0 - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if (*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->lc_config_reply_msg = lc_config_reply_msg; - - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (lc_config_reply_msg != NULL) - free(lc_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; @@ -788,6 +521,7 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ 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]; + enb_ue_rrc[mod_id] = (void *)&UE_rrc_inst[mod_id]; break; default : goto error; @@ -1157,10 +891,449 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } +/* + * ************************************ + * Get Messages for UE Configuration Reply + * ************************************ + */ + +int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->timeAlignmentTimerDedicated); +} + +int get_meas_gap_config(mid_t mod_id, mid_t ue_id) +{ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_NOTHING) + return 2; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_release) + return 0; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_setup) + return 1; + + return -1; +} + +int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->choice.setup.gapOffset.present); +} + +int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; +} + +int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; +} + +int get_half_duplex(mid_t ue_id) +{ + int halfduplex = 0; + int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; + for (int i =0; i < bands_to_scan; i++){ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) + halfduplex = 1; + } + return halfduplex; +} + +int get_intra_sf_hopping(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (31))); +} + +int get_type2_sb_1(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (11))); +} + +int get_ue_category(mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); +} + +int get_res_alloc_type1(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (30))); +} + +int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.transmissionMode); +} + +int get_tti_bundling(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->ttiBundling); +} + +int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->maxHARQ_Tx); +} + +int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_ACK_Index); +} + +int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_RI_Index); +} + +int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_CQI_Index); +} + +int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI); +} + +int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->sib2[mod_id]->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission); +} + +int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportModeAperiodic); +} + +int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); +} + +int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor); +} + +int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) +{ + //TODO: need to double check + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); +} + +int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) +{ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; +} + +int get_lcg(mid_t ue_id, mid_t lc_id) +{ + return &UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; +} + +int get_direction(mid_t ue_id, mid_t lc_id) +{ + /*TODO: fill with the value for the rest of LCID*/ + + if(lc_id == CCCH | lc_id == DCCH) + return 2; + else if(lc_id == DTCH) + return 1; +} + + /* * timer primitives */ +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + xid = (lc_config_request_msg->header)->xid; + + int i, j; + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + if(lc_config_reply_msg == NULL) + goto error; + protocol__prp_lc_config_reply__init(lc_config_reply_msg); + lc_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that we are going to report LC configs about + lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); + + Protocol__PrpLcUeConfig **lc_ue_config; + if (lc_config_reply_msg->n_lc_ue_config > 0) { + lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * 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++) { + lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); + protocol__prp_lc_ue_config__init(lc_ue_config[i]); + //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; + lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); + //TODO: Set the number of LC configurations that will be reported for this UE + lc_ue_config[i]->n_lc_config = 3; + Protocol__PrpLcConfig **lc_config; + if (lc_ue_config[i]->n_lc_config > 0) { + lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * 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__PrpLcConfig)); + protocol__prp_lc_config__init(lc_config[j]); + //TODO: Set the LC id + lc_config[j]->has_lcid = 1; + lc_config[j]->lcid = j+1; + //TODO: Set the LCG of the channel + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = get_lcg(i,j+1); + //TODO: Set the LC direction + lc_config[j]->has_direction = 1; + lc_config[j]->direction = get_direction(i,j+1); + //TODO: Bearer type. One of PRQBT_* values + lc_config[j]->has_qos_bearer_type = 1; + lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_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 + lc_config[j]->has_qci = 1; + lc_config[j]->qci = 1; + if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + //TODO: Set the max bitrate (UL) + lc_config[j]->has_e_rab_max_bitrate_ul = 1; + lc_config[j]->e_rab_max_bitrate_ul = 1; + //TODO: Set the max bitrate (DL) + lc_config[j]->has_e_rab_max_bitrate_dl = 1; + lc_config[j]->e_rab_max_bitrate_dl = 1; + //TODO: Set the guaranteed bitrate (UL) + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + //TODO: Set the guaranteed bitrate (DL) + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + } + } + lc_ue_config[i]->lc_config = lc_config; + } + } // end for UE + lc_config_reply_msg->lc_ue_config = lc_ue_config; + } // lc_config_reply_msg->n_lc_ue_config > 0 + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->lc_config_reply_msg = lc_config_reply_msg; + + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (lc_config_reply_msg != NULL) + free(lc_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +/* + * ************************************ + * UE Configuration Reply + * ************************************ + */ + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + xid = (ue_config_request_msg->header)->xid; + + int i; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + if(ue_config_reply_msg == NULL) + goto error; + protocol__prp_ue_config_reply__init(ue_config_reply_msg); + ue_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that are currently connected + ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); + + Protocol__PrpUeConfig **ue_config; + if (ue_config_reply_msg->n_ue_config > 0) { + ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + if (ue_config == NULL) { + goto error; + } + for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + protocol__prp_ue_config__init(ue_config[i]); + //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = get_ue_crnti(mod_id,i); + ue_config[i]->has_rnti = 1; + //TODO: Set the DRX configuration (optional) + //Not supported for now, so we do not set it + + //TODO: Set the time_alignment_timer + ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + ue_config[i]->has_time_alignment_timer = 1; + //TODO: Set the measurement gap configuration pattern + ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + ue_config[i]->has_meas_gap_config_pattern = 1; + //TODO: Set the measurement gap offset if applicable + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + 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 + + //TODO: Set the transmission mode + ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(capabilities); + //TODO: Set half duplex (FDD operation) + capabilities->has_half_duplex = 1; + capabilities->half_duplex = get_half_duplex(i); + //TODO: Set intra-frame hopping flag + capabilities->has_intra_sf_hopping = 1; + capabilities->intra_sf_hopping = get_intra_sf_hopping(i); + //TODO: Set support for type 2 hopping with n_sb > 1 + capabilities->has_type2_sb_1 = 1; + capabilities->type2_sb_1 = get_type2_sb_1(i); + //TODO: Set ue category + capabilities->has_ue_category = 1; + capabilities->ue_category = get_ue_category(i); + //TODO: Set UE support for resource allocation type 1 + capabilities->has_res_alloc_type1 = 1; + capabilities->res_alloc_type1 = get_res_alloc_type1(i); + //Set the capabilites to the message + ue_config[i]->capabilities = capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + //TODO: Set tti bundling flag (See ts 36.321) + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + //TODO: Set the max HARQ retransmission for the UL + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + //TODO: Fill beta_offset_ack_index (TS 36.213) + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + //TODO: Fill beta_offset_ri_index (TS 36.213) + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + //TODO: Fill beta_offset_cqi_index (TS 36.213) + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + //TODO: Set tdd_ack_nack_feedback + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + //TODO: Set ack_nack_repetition factor + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + //TODO: Set extended BSR size + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + //TODO: Set carrier aggregation support (boolean) + ue_config[i]->has_ca_support = 0; + ue_config[i]->ca_support = 0; + if(ue_config[i]->has_ca_support){ + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //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 = 1; + ue_config[i]->scell_deactivation_timer = 1; + } + } + ue_config_reply_msg->ue_config = ue_config; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->ue_config_reply_msg = ue_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ue_config_reply_msg != NULL) + free(ue_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + /* * ************************************ * eNB Configuration Request and Reply diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 73ce0ec788..76c68437d0 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -210,6 +210,62 @@ 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 *******************/ diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index 2810235255..c2a3c78741 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -58,6 +58,8 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; extern eNB_RRC_INST *eNB_rrc_inst; +extern UE_RRC_INST *UE_rrc_inst; +extern UE_MAC_INST *ue_mac_inst; extern MAC_RLC_XFACE *Mac_rlc_xface; extern uint8_t Is_rrc_registered; From e1d1b0baff645e2adc4c1595511127af3517ab53 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 17:53:43 +0000 Subject: [PATCH 086/182] Added event notification for connection of a new UE --- openair2/ENB_APP/enb_agent.c | 2 +- openair2/ENB_APP/enb_agent_common.c | 428 +++++++++++----------- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 + 3 files changed, 223 insertions(+), 215 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 7d2029b37f..95731d3654 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -150,7 +150,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 4a175c244e..a31020881e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1380,220 +1380,220 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Pro int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; - xid = (enb_config_req_msg->header)->xid; - - int i, j, k; - int cc_id = 0; - int enb_id = mod_id; - - - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpEnbConfigReply *enb_config_reply_msg; - enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); - if(enb_config_reply_msg == NULL) - goto error; - protocol__prp_enb_config_reply__init(enb_config_reply_msg); - enb_config_reply_msg->header = header; - - enb_config_reply_msg->enb_id = mod_id; - - - enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; - - Protocol__PrpCellConfig **cell_conf; - if(enb_config_reply_msg->n_cell_config > 0){ - cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * 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++){ - cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); - protocol__prp_cell_config__init(cell_conf[i]); - //TODO: Fill in with actual value, the PCI of this cell - cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = 1; - //TODO: Fill in with actual value, the PLMN cell id of this cell - cell_conf[i]->cell_id = get_cell_id(enb_id,i); - cell_conf[i]->has_cell_id = 1; - //TODO: Fill in with actual value, PUSCH resources in RBs for hopping - cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); - cell_conf[i]->has_pusch_hopping_offset = 1; - //TODO: Fill in with actual value - cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); - cell_conf[i]->has_hopping_mode = 1; - //TODO: Fill in with actual value, the number of subbands - cell_conf[i]->n_sb = get_n_SB(enb_id,i); - cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ - cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); - cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the PRPD_ values - cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); - cell_conf[i]->has_phich_duration = 1; - //TODO: Fill in with actual value, See TS 36.211, section 6.9 - cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; - //TODO: Fill in with actual value - Protocol__PrpSiConfig *si_config; - si_config = malloc(sizeof(Protocol__PrpSiConfig)); - if(si_config == NULL) - goto error; - protocol__prp_si_config__init(si_config); - //TODO: Fill in with actual value, Frame number to apply the SI configuration - si_config->sfn = 1; - si_config->has_sfn = 1; - //TODO: Fill in with actual value, the length of SIB1 in bytes - si_config->sib1_length = get_sib1_length(enb_id,i); - si_config->has_sib1_length = 1; - //TODO: Fill in with actual value, Scheduling window for all SIs in SF - si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); - si_config->has_si_window_length = 1; - //TODO: Fill in with actual value, the number of SI messages - si_config->n_si_message=1; - Protocol__PrpSiMessage **si_message; - si_message = malloc(sizeof(Protocol__PrpSiMessage *) * 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__PrpSiMessage)); - if(si_message[j] == NULL) - goto error; - protocol__prp_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; - - //TODO: Fill in with actual value, the DL transmission bandwidth in RBs - cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); - cell_conf[i]->has_dl_bandwidth = 1; - //TODO: Fill in with actual value, the UL transmission bandwidth in RBs - cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); - cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); - cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); - cell_conf[i]->has_dl_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, number of cell specific antenna ports - cell_conf[i]->antenna_ports_count = 1; - cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of PRDM values - cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); - cell_conf[i]->has_duplex_mode = 1; - //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only - cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); - cell_conf[i]->has_subframe_assignment = 1; - //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 - cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_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 = 5; - 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 = 5; - 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 = 5; - 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; - - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 - cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); - cell_conf[i]->has_prach_config_index = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 - cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); - cell_conf[i]->has_prach_freq_offset = 1; - //TODO: Fill in with actual value, Duration of RA response window in SF - cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); - cell_conf[i]->has_ra_response_window_size = 1; - //TODO: Fill in with actual value, Timer used for RA - cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); - cell_conf[i]->has_mac_contention_resolution_timer = 1; - //TODO: Fill in with actual value, See TS 36.321 - cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); - cell_conf[i]->has_max_harq_msg3tx = 1; - //TODO: Fill in with actual value, See TS 36.213, section 10.1 - cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); - cell_conf[i]->has_n1pucch_an = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 - cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); - cell_conf[i]->has_deltapucch_shift = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 - cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); - cell_conf[i]->has_nrb_cqi = 1; - //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 - cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); - cell_conf[i]->has_srs_subframe_config = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 - cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); - cell_conf[i]->has_srs_bw_config = 1; - //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only - cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); - cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the PREQ_ values - cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); - cell_conf[i]->has_enable_64qam = 1; - //TODO: Fill in with actual value, Carrier component index - cell_conf[i]->carrier_index = i; - cell_conf[i]->has_carrier_index = 1; - } - enb_config_reply_msg->cell_config=cell_conf; - } - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if(*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->enb_config_reply_msg = enb_config_reply_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (enb_config_reply_msg != NULL) - free(enb_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; + xid = (enb_config_req_msg->header)->xid; + + int i, j, k; + int cc_id = 0; + int enb_id = mod_id; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + if(enb_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(enb_config_reply_msg); + enb_config_reply_msg->header = header; + + enb_config_reply_msg->enb_id = mod_id; + + + enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; + + Protocol__PrpCellConfig **cell_conf; + if(enb_config_reply_msg->n_cell_config > 0){ + cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * 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++){ + cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); + protocol__prp_cell_config__init(cell_conf[i]); + //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = 1; + //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_cell_id = 1; + //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->has_pusch_hopping_offset = 1; + //TODO: Fill in with actual value + cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + cell_conf[i]->has_hopping_mode = 1; + //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->has_n_sb = 1; + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + cell_conf[i]->has_phich_resource = 1; + //TODO: Fill in with actual value, one of the PRPD_ values + cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + cell_conf[i]->has_phich_duration = 1; + //TODO: Fill in with actual value, See TS 36.211, section 6.9 + cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + //TODO: Fill in with actual value + Protocol__PrpSiConfig *si_config; + si_config = malloc(sizeof(Protocol__PrpSiConfig)); + if(si_config == NULL) + goto error; + protocol__prp_si_config__init(si_config); + //TODO: Fill in with actual value, Frame number to apply the SI configuration + si_config->sfn = 1; + si_config->has_sfn = 1; + //TODO: Fill in with actual value, the length of SIB1 in bytes + si_config->sib1_length = get_sib1_length(enb_id,i); + si_config->has_sib1_length = 1; + //TODO: Fill in with actual value, Scheduling window for all SIs in SF + si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); + si_config->has_si_window_length = 1; + //TODO: Fill in with actual value, the number of SI messages + si_config->n_si_message=1; + Protocol__PrpSiMessage **si_message; + si_message = malloc(sizeof(Protocol__PrpSiMessage *) * 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__PrpSiMessage)); + if(si_message[j] == NULL) + goto error; + protocol__prp_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; + + //TODO: Fill in with actual value, the DL transmission bandwidth in RBs + cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->has_dl_bandwidth = 1; + //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->has_ul_bandwidth = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_ul_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_dl_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, number of cell specific antenna ports + cell_conf[i]->antenna_ports_count = 1; + cell_conf[i]->has_antenna_ports_count = 1; + //TODO: Fill in with actual value, one of PRDM values + cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + cell_conf[i]->has_duplex_mode = 1; + //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only + cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->has_subframe_assignment = 1; + //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 + cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_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 = 5; + 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 = 5; + 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 = 5; + 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; + + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->has_prach_config_index = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->has_prach_freq_offset = 1; + //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->has_ra_response_window_size = 1; + //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->has_mac_contention_resolution_timer = 1; + //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->has_max_harq_msg3tx = 1; + //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->has_n1pucch_an = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->has_deltapucch_shift = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->has_nrb_cqi = 1; + //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->has_srs_subframe_config = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->has_srs_bw_config = 1; + //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->has_srs_mac_up_pts = 1; + //TODO: Fill in with actual value, One of the PREQ_ values + cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + cell_conf[i]->has_enable_64qam = 1; + //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; + cell_conf[i]->has_carrier_index = 1; + } + enb_config_reply_msg->cell_config=cell_conf; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->enb_config_reply_msg = enb_config_reply_msg; + + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_reply_msg != NULL) + free(enb_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 493ff11d33..34ac1caa86 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -56,6 +56,8 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "enb_agent_extern.h" + //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" @@ -255,6 +257,12 @@ void rx_sdu( } else LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[enb_mod_idP]) { + agent_mac_xface[enb_mod_idP]->enb_agent_notify_ue_state_change(enb_mod_idP, + eNB->common_channels[CC_idP].RA_template[ii].rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } } else { LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %d\n", enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP); From 00b158829fd7db9b2a3d3fbf999d82937968757f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 17:57:22 +0000 Subject: [PATCH 087/182] Fixed bug in UE configuration message --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a31020881e..b1633bea38 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1197,7 +1197,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); protocol__prp_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = get_ue_crnti(mod_id,i); From a637957c7c3e047bc7aa63b47348a5eea1cb07d8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 12:46:22 +0000 Subject: [PATCH 088/182] Moved UE activation notification to RRC --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 -------- openair2/RRC/LITE/rrc_eNB.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 34ac1caa86..493ff11d33 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -56,8 +56,6 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "enb_agent_extern.h" - //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" @@ -257,12 +255,6 @@ void rx_sdu( } else LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id); - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[enb_mod_idP]) { - agent_mac_xface[enb_mod_idP]->enb_agent_notify_ue_state_change(enb_mod_idP, - eNB->common_channels[CC_idP].RA_template[ii].rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); - } } else { LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %d\n", enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 1d0b5f2902..4d5d390d0d 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -99,6 +99,8 @@ #include "SIMULATION/TOOLS/defs.h" // for taus +#include "enb_agent_extern.h" + //#define XER_PRINT #ifdef PHY_EMUL @@ -4093,6 +4095,12 @@ rrc_eNB_decode_dcch( 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; + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); } From 906e90727e091bf3055d84166b1477163ce919c3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 12:47:24 +0000 Subject: [PATCH 089/182] Fixed LC config reporting based on existing LCs --- openair2/ENB_APP/enb_agent_common.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index b1633bea38..ec4f70abe9 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -43,6 +43,9 @@ #include "PHY/extern.h" #include "log.h" +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; @@ -375,7 +378,8 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { // TODO: Set the whole UE configuration message - + config->has_rnti = 1; + config->rnti = rnti; } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { // TODO: Not supported for now. Leave blank } @@ -1039,7 +1043,11 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) int get_lcg(mid_t ue_id, mid_t lc_id) { - return &UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; + if(UE_mac_inst[ue_id].logicalChannelConfig[lc_id] != NULL) { + return *UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; + } else { + return -1; + } } int get_direction(mid_t ue_id, mid_t lc_id) @@ -1093,7 +1101,16 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); //TODO: Set the number of LC configurations that will be reported for this UE - lc_ue_config[i]->n_lc_config = 3; + //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, get_ue_crnti(mod_id, i)); + 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__PrpLcConfig **lc_config; if (lc_ue_config[i]->n_lc_config > 0) { lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); From fffb682f7a92c91ecbb6de8071528dfccfbfbc42 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 14:38:44 +0000 Subject: [PATCH 090/182] Added continuous update support --- openair2/ENB_APP/enb_agent_mac.c | 52 ++++++++++++++++++----------- openair2/LAYER2/MAC/eNB_scheduler.c | 1 + 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 5c279958fe..0c68c4b80c 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -168,6 +168,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_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; enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } @@ -1204,44 +1216,46 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { void enb_agent_send_update_mac_stats(mid_t mod_id) { - Protocol__ProgranMessage *current_report, *msg; + Protocol__ProgranMessage *current_report = NULL, *msg; void *data; int size; err_code_t err_code; int priority; mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; - + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; } - /*Create a fresh report with the required flags*/ - err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); - if (err_code < 0) { - goto error; + if (mac_stats_context[mod_id].cont_update == 1) { + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_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 (mac_stats_context[mod_id].prev_stats_reply != NULL) { */ - /*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 (mac_stats_context[mod_id].prev_stats_reply != NULL) { + /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ - msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); - - /*Destroy the old stats*/ - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); - } - /*Use the current report for future comparissons*/ - mac_stats_context[mod_id].prev_stats_reply = current_report; + /* /\*Destroy the old stats*\/ */ + /* enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* } */ + /* /\*Use the current report for future comparissons*\/ */ + /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } - if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + if (current_report != NULL){ + data=enb_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 774feda961..e2423e2c10 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -219,6 +219,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); + agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); } #endif From f84568e1714edb263d982dc73a628861f4378d0c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 14:40:03 +0000 Subject: [PATCH 091/182] Bug fix when checking for the LCG of an LC --- openair2/ENB_APP/enb_agent_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ec4f70abe9..c567a78b6c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1053,8 +1053,7 @@ int get_lcg(mid_t ue_id, mid_t lc_id) int get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ - - if(lc_id == CCCH | lc_id == DCCH) + if(lc_id == DCCH | lc_id == DCCH1) return 2; else if(lc_id == DTCH) return 1; @@ -1124,8 +1123,11 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; //TODO: Set the LCG of the channel - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = get_lcg(i,j+1); + int lcg = get_lcg(i, j+1); + if (lcg >= 0 && lcg <= 3) { + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = get_lcg(i,j+1); + } //TODO: Set the LC direction lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); From 4c7d1e03819ca7331d16f35b290188c3a0fc021a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 17:31:13 +0000 Subject: [PATCH 092/182] Added support for indication of a UE state in both RRC_CONNECTED and RRC_RECONFIGURED STATES --- openair2/RRC/LITE/rrc_eNB.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 4d5d390d0d..adaf50d62e 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -4013,6 +4013,12 @@ rrc_eNB_decode_dcch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \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 (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + } } #if defined(ENABLE_USE_MME) @@ -4095,14 +4101,14 @@ rrc_eNB_decode_dcch( 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; - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, - ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); - } 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 (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } } } From a5fd6187706a65a94fd3b8a0afa231d3c7f13aaa Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 17:33:49 +0000 Subject: [PATCH 093/182] Fixed bug of wrong rnti value when finding it using the UE id --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c567a78b6c..d971b67fac 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -586,7 +586,7 @@ int get_num_ues (mid_t mod_id){ int get_ue_crnti (mid_t mod_id, mid_t ue_id){ - return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].crnti; + return UE_RNTI(mod_id, ue_id); } int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { From 9bbc22f496cdf92b4731de68ad2b57b34403a3e3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 18:28:32 +0000 Subject: [PATCH 094/182] Added UE state change message support --- openair2/ENB_APP/enb_agent_common.c | 636 +++++++++++++++++++++------- 1 file changed, 489 insertions(+), 147 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index d971b67fac..835c4664d4 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -45,12 +45,11 @@ #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]; -void * enb_ue_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -343,70 +342,6 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { - int size; - Protocol__ProgranMessage *msg; - Protocol__PrpHeader *header; - void *data; - int priority; - err_code_t err_code; - - int xid = 0; - - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) - goto error; - - Protocol__PrpUeStateChange *ue_state_change_msg; - ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); - if(ue_state_change_msg == NULL) { - goto error; - } - protocol__prp_ue_state_change__init(ue_state_change_msg); - ue_state_change_msg->has_type = 1; - ue_state_change_msg->type = state_change; - - Protocol__PrpUeConfig *config; - config = malloc(sizeof(Protocol__PrpUeConfig)); - if (config == NULL) { - goto error; - } - protocol__prp_ue_config__init(config); - if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { - // Simply set the rnti of the UE - config->has_rnti = 1; - config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED - || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { - // TODO: Set the whole UE configuration message - config->has_rnti = 1; - config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { - // TODO: Not supported for now. Leave blank - } - - ue_state_change_msg->config = config; - msg = malloc(sizeof(Protocol__ProgranMessage)); - if (msg == NULL) { - goto error; - } - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - msg->ue_state_change_msg = ue_state_change_msg; - - data = enb_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(ENB_AGENT,"sent message with size %d\n", size); - return; - error: - LOG_D(ENB_AGENT, "Could not send UE state message\n"); -} - int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) goto error; @@ -525,7 +460,6 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ 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]; - enb_ue_rrc[mod_id] = (void *)&UE_rrc_inst[mod_id]; break; default : goto error; @@ -901,26 +835,60 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) * ************************************ */ + int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->timeAlignmentTimerDedicated); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL) + return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; + } + else + return -1; } int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_NOTHING) - return 2; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_release) - return 0; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_setup) - return 1; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - return -1; + LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_NOTHING) + return 2; + else if (ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_release) + return 0; + else if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) + return 1; + } + } + else + return -1; } int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->choice.setup.gapOffset.present); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.measGapConfig != NULL){ + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present; + } + } + else + return -1; } int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) @@ -935,110 +903,250 @@ int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) int get_half_duplex(mid_t ue_id) { - int halfduplex = 0; - int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; - for (int i =0; i < bands_to_scan; i++){ - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) - halfduplex = 1; - } - return halfduplex; + //int halfduplex = 0; + //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; + //for (int i =0; i < bands_to_scan; i++){ + //if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) + // halfduplex = 1; + //} + //return halfduplex; } int get_intra_sf_hopping(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (31))); + //TODO:Get proper value + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (0 & ( 1 << (31))); } int get_type2_sb_1(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (11))); + //TODO:Get proper value + //uint8_t temp = 0; + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (temp & ( 1 << (11))); } int get_ue_category(mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); + //TODO:Get proper value + //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } int get_res_alloc_type1(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (30))); + //TODO:Get proper value + //uint8_t temp = 0; + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (temp & ( 1 << (30))); } int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.transmissionMode); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; + } + } + else + return -1; } int get_tti_bundling(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->ttiBundling); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; + } + } + else + return -1; } int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->maxHARQ_Tx); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } + } + else + return -1; } int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_ACK_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; + } + } + else + return -1; } int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_RI_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; + } + } + else + return -1; } int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_CQI_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; + } + } + else + return -1; } int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if (ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) { + return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI; + } + } + } + return -1; } int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->sib2[mod_id]->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission); + return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportModeAperiodic); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + } + } + else + return -1; } int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; + } + } + else + return -1; } int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; + } + } + else + return -1; } int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { //TODO: need to double check - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } + } + } + return -1; } int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) - return 2; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) - return 1; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; + } + } else - return 0; + return -1; } int get_lcg(mid_t ue_id, mid_t lc_id) @@ -1059,6 +1167,207 @@ int get_direction(mid_t ue_id, mid_t lc_id) return 1; } +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { + int size; + Protocol__ProgranMessage *msg; + Protocol__PrpHeader *header; + void *data; + int priority; + err_code_t err_code; + + int xid = 0; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + goto error; + + Protocol__PrpUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + if(ue_state_change_msg == NULL) { + goto error; + } + protocol__prp_ue_state_change__init(ue_state_change_msg); + ue_state_change_msg->has_type = 1; + ue_state_change_msg->type = state_change; + + Protocol__PrpUeConfig *config; + config = malloc(sizeof(Protocol__PrpUeConfig)); + if (config == NULL) { + goto error; + } + protocol__prp_ue_config__init(config); + if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + // Simply set the rnti of the UE + config->has_rnti = 1; + config->rnti = rnti; + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED + || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + int i =find_UE_id(mod_id,rnti); + config->has_rnti = 1; + config->rnti = rnti; + LOG_I(ENB_APP,"The value of i is %d\n",i); + LOG_I(ENB_APP,"The value of rnto is %d\n",rnti); + //TODO: Set the time_alignment_timer + if(get_time_alignment_timer(mod_id,i) != -1){ + config->time_alignment_timer = get_time_alignment_timer(mod_id,i); + config->has_time_alignment_timer = 1; + } + //TODO: Set the measurement gap configuration pattern + if(get_meas_gap_config(mod_id,i) != -1){ + config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + config->has_meas_gap_config_pattern = 1; + } + //TODO: Set the measurement gap offset if applicable + if(get_meas_gap_config_offset(mod_id,i) != -1){ + config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + config->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 + + //TODO: Set the transmission mode + if(get_ue_transmission_mode(mod_id,i) != -1){ + config->transmission_mode = get_ue_transmission_mode(mod_id,i); + config->has_transmission_mode = 1; + } + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + config->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + config->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *c_capabilities; + c_capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(c_capabilities); + //TODO: Set half duplex (FDD operation) + c_capabilities->has_half_duplex = 1; + c_capabilities->half_duplex = 1;//get_half_duplex(i); + //TODO: Set intra-frame hopping flag + c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); + //TODO: Set support for type 2 hopping with n_sb > 1 + c_capabilities->has_type2_sb_1 = 1; + c_capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); + //TODO: Set ue category + c_capabilities->has_ue_category = 1; + c_capabilities->ue_category = 1;//get_ue_category(i); + //TODO: Set UE support for resource allocation type 1 + c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); + //Set the capabilites to the message + config->capabilities = c_capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ + config->has_ue_transmission_antenna = 1; + config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + } + //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ + config->has_tti_bundling = 1; + config->tti_bundling = get_tti_bundling(mod_id,i); + } + //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ + config->has_max_harq_tx = 1; + config->max_harq_tx = get_maxHARQ_TX(mod_id,i); + } + //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ + config->has_beta_offset_ack_index = 1; + config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + } + //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ + config->has_beta_offset_ri_index = 1; + config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + } + //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ + config->has_beta_offset_cqi_index = 1; + config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + } + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ + config->has_ack_nack_simultaneous_trans = 1; + config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + } + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ + config->has_simultaneous_ack_nack_cqi = 1; + config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + } + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ + config->has_aperiodic_cqi_rep_mode = 1; + config->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + } + //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback != -1){ + config->has_tdd_ack_nack_feedback = 1; + config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } + //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor != -1){ + config->has_ack_nack_repetition_factor = 1; + config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } + //TODO: Set extended BSR size + if(get_extended_bsr_size != -1){ + config->has_extended_bsr_size = 1; + config->extended_bsr_size = get_extended_bsr_size(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 index of primary cell + config->has_pcell_carrier_index = 1; + config->pcell_carrier_index = 1; + //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 = 1; + config->scell_deactivation_timer = 1; + } + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + // TODO: Not supported for now. Leave blank + } + + ue_state_change_msg->config = config; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if (msg == NULL) { + goto error; + } + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + msg->ue_state_change_msg = ue_state_change_msg; + + data = enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + error: + LOG_D(ENB_AGENT, "Could not send UE state message\n"); +} /* * timer primitives @@ -1225,14 +1534,20 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //Not supported for now, so we do not set it //TODO: Set the time_alignment_timer - ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); - ue_config[i]->has_time_alignment_timer = 1; + if(get_time_alignment_timer(mod_id,i) != -1){ + ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + ue_config[i]->has_time_alignment_timer = 1; + } //TODO: Set the measurement gap configuration pattern - ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); - ue_config[i]->has_meas_gap_config_pattern = 1; + if(get_meas_gap_config(mod_id,i) != -1){ + ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + ue_config[i]->has_meas_gap_config_pattern = 1; + } //TODO: Set the measurement gap offset if applicable - ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - ue_config[i]->has_meas_gap_config_sf_offset = 1; + if(get_meas_gap_config_offset(mod_id,i) != -1){ + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + 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 @@ -1243,8 +1558,10 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //We do not set it for now //TODO: Set the transmission mode - ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); - ue_config[i]->has_transmission_mode = 1; + if(get_ue_transmission_mode(mod_id,i) != -1){ + ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + } //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); @@ -1260,57 +1577,81 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra protocol__prp_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 1; - capabilities->half_duplex = get_half_duplex(i); + capabilities->half_duplex = 1;//get_half_duplex(i); //TODO: Set intra-frame hopping flag capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = get_intra_sf_hopping(i); + capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = get_type2_sb_1(i); + capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category capabilities->has_ue_category = 1; - capabilities->ue_category = get_ue_category(i); + capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = get_res_alloc_type1(i); + capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; //TODO: Set UE transmission antenna. One of the PRUTA_* values - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + if(get_ue_transmission_antenna(mod_id,i) != -1){ + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + } //TODO: Set tti bundling flag (See ts 36.321) - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + if(get_tti_bundling(mod_id,i) != -1){ + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + } //TODO: Set the max HARQ retransmission for the UL - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + if(get_maxHARQ_TX(mod_id,i) != -1){ + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + } //TODO: Fill beta_offset_ack_index (TS 36.213) - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + if(get_beta_offset_ack_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + } //TODO: Fill beta_offset_ri_index (TS 36.213) - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + if(get_beta_offset_ri_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + } //TODO: Fill beta_offset_cqi_index (TS 36.213) - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if(get_beta_offset_cqi_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + } //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + } //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + } //TODO: Set PRACRM_* value regarding aperiodic cqi report mode - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + } //TODO: Set tdd_ack_nack_feedback - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + if(get_tdd_ack_nack_feedback != -1){ + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } //TODO: Set ack_nack_repetition factor - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + if(get_ack_nack_repetition_factor != -1){ + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } //TODO: Set extended BSR size - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + if(get_extended_bsr_size != -1){ + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; @@ -1843,3 +2184,4 @@ err_code_t enb_agent_restart_timer(uint32_t *timer_id){ } */ + From 24785b3a61e59ed7d06cbf28dd17a96b7009668a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 25 Feb 2016 01:06:04 +0000 Subject: [PATCH 095/182] Fixed bugs in API function calls for UE config --- openair2/ENB_APP/enb_agent_common.c | 232 +++++++++++++++------------- 1 file changed, 121 insertions(+), 111 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 835c4664d4..6122789d6e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -852,43 +852,46 @@ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) return -1; } -int get_meas_gap_config(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); +int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.measGapConfig != NULL){ - if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_NOTHING) - return 2; - else if (ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_release) - return 0; - else if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) - return 1; - } + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { + if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP1; + } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP2; + } else { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF; } - else - return -1; + } + } + } + return -1; } -int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.measGapConfig != NULL){ - return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present; - } - } - else - return -1; +int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { + if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; + } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; + } + } + } + } + return -1; } int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) @@ -974,20 +977,17 @@ int get_tti_bundling(mid_t mod_id, mid_t ue_id) return -1; } -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; - } - } - else - return -1; +int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return *ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } + } + return -1; } int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) @@ -1059,21 +1059,18 @@ int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; - } - } - else - return -1; +int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return *ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + } + } + return -1; } int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) @@ -1109,22 +1106,23 @@ int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) return -1; } -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) -{ - //TODO: need to double check - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); +int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { + //TODO: need to double check + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } - } + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ + long val = (*(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10)); + if (val > 0) { + return 1; } - return -1; + } + } + } + return -1; } int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) @@ -1217,9 +1215,10 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_meas_gap_config_pattern = 1; } //TODO: Set the measurement gap offset if applicable - if(get_meas_gap_config_offset(mod_id,i) != -1){ - config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - config->has_meas_gap_config_sf_offset = 1; + if(config->has_meas_gap_config_pattern == 1 && + config->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) //Not supported for noe, so we do not set it @@ -1308,20 +1307,25 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set PRACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ config->has_aperiodic_cqi_rep_mode = 1; - config->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + int mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + config->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + } else { + config->aperiodic_cqi_rep_mode = mode; + } } //TODO: Set tdd_ack_nack_feedback - if(get_tdd_ack_nack_feedback != -1){ + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ config->has_tdd_ack_nack_feedback = 1; config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } //TODO: Set ack_nack_repetition factor - if(get_ack_nack_repetition_factor != -1){ + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ config->has_ack_nack_repetition_factor = 1; config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } //TODO: Set extended BSR size - if(get_extended_bsr_size != -1){ + if(get_extended_bsr_size(mod_id, i) != -1){ config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } @@ -1544,10 +1548,11 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_meas_gap_config_pattern = 1; } //TODO: Set the measurement gap offset if applicable - if(get_meas_gap_config_offset(mod_id,i) != -1){ - ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - ue_config[i]->has_meas_gap_config_sf_offset = 1; - } + if(ue_config[i]->has_meas_gap_config_pattern == 1 && + ue_config[i]->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + 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 @@ -1635,39 +1640,44 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set PRACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + int mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + } else { + ue_config[i]->aperiodic_cqi_rep_mode = mode; } + } //TODO: Set tdd_ack_nack_feedback - if(get_tdd_ack_nack_feedback != -1){ - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); - } + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } //TODO: Set ack_nack_repetition factor - if(get_ack_nack_repetition_factor != -1){ - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); - } + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } //TODO: Set extended BSR size - if(get_extended_bsr_size != -1){ - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); - } + if(get_extended_bsr_size(mod_id, i) != -1){ + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; if(ue_config[i]->has_ca_support){ - //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 1; - ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; - //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 = 1; - ue_config[i]->scell_deactivation_timer = 1; + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //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 = 1; + ue_config[i]->scell_deactivation_timer = 1; } } ue_config_reply_msg->ue_config = ue_config; From 197726ce61c45a2f2acdaed046cf221cb4a7ee09 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 25 Feb 2016 13:55:19 +0000 Subject: [PATCH 096/182] Fixed memory leaks in sf and mac config messages --- openair2/ENB_APP/enb_agent_mac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0c68c4b80c..7be6e6ba12 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1041,10 +1041,12 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { free(msg->sf_trigger_msg->header); for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { free(msg->sf_trigger_msg->dl_info[i]->harq_status); + free(msg->sf_trigger_msg->dl_info[i]); } free(msg->sf_trigger_msg->dl_info); for (i = 0; i < msg->sf_trigger_msg->n_ul_info; i++) { - free(msg->sf_trigger_msg->ul_info[i]->reception_status); + free(msg->sf_trigger_msg->ul_info[i]->ul_reception); + free(msg->sf_trigger_msg->ul_info[i]); } free(msg->sf_trigger_msg->ul_info); free(msg->sf_trigger_msg); @@ -1143,6 +1145,8 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { free(msg->dl_mac_config_msg->ofdm_sym[i]); } free(msg->dl_mac_config_msg->ofdm_sym); + free(msg->dl_mac_config_msg); + free(msg); return 0; From f47f596a1ff3ddf4fad0c45873b1683bd4fc96be Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 26 Feb 2016 13:31:13 +0000 Subject: [PATCH 097/182] Added support for liblfds7 --- cmake_targets/CMakeLists.txt | 26 +- .../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 + 178 files changed, 22480 insertions(+), 4 deletions(-) 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/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 85a6f35339..e4b027958d 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -757,6 +757,7 @@ include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") 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/LFDS/liblfds7.0.0/liblfds700/inc") include_directories("${OPENAIR2_DIR}/UTIL/MEM") include_directories("${OPENAIR2_DIR}/UTIL/LISTS") include_directories("${OPENAIR2_DIR}/UTIL/FIFO") @@ -1475,6 +1476,23 @@ 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 @@ -1604,7 +1622,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 PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) @@ -1639,7 +1657,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 PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1775,7 +1793,7 @@ 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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) @@ -1796,7 +1814,7 @@ foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syn ${XFORMS_SOURCE} ) target_link_libraries (${myExe} - -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group + -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ) endforeach(myExe) 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 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 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + v110 + + + DynamicLibrary + true + v110 + + + StaticLibrary + true + v110 + + + DynamicLibrary + true + v110 + + + StaticLibrary + false + v110 + true + + + DynamicLibrary + false + v110 + true + + + StaticLibrary + false + v110 + true + + + DynamicLibrary + false + v110 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Console + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + + + MachineX86 + true + Console + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + + + true + Windows + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + + + true + Console + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Console + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + MachineX86 + false + Console + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + true + Windows + true + true + + + true + + + MachineX64 + + + Console + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + false + Console + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {3ac93721-1d81-49e4-9581-dbc12ace5c0c} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_queue + + + Source Files\lfds700_stack + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_misc + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + \ 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 @@ + + + + \ 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 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 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + WindowsKernelModeDriver8.0 + + + DynamicLibrary + true + WindowsKernelModeDriver8.0 + + + StaticLibrary + true + WindowsKernelModeDriver8.0 + + + DynamicLibrary + true + WindowsKernelModeDriver8.0 + + + StaticLibrary + false + WindowsKernelModeDriver8.0 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.0 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.0 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.0 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineX64 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Native + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + WDM + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineX64 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + WDM + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {8b3cbb5c-7436-429f-9b72-bae1f4721746} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + \ 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 @@ + + + + \ 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 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 @@ + + + + + Debug DLL + ARM + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + ARM + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + ARM + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + ARM + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuildToolsPath);$(MSBuildFrameworkToolsPath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_ARM); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineARM + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineX64 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Native + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + WDM + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineARM + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineX64 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + WDM + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {8b3cbb5c-7436-429f-9b72-bae1f4721746} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + \ 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 @@ + + + + \ 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 + + #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 + #include + + #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 + + #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 + + #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 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1e5d7d09-94f2-455d-ae5e-6c7f4c96bce0} + + + + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43} + Win32Proj + + + + Application + true + v110 + + + Application + true + v110 + + + Application + true + v110 + + + Application + true + v110 + + + Application + false + v110 + + + Application + false + v110 + + + Application + false + v110 + + + Application + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NoExtensions + false + false + false + true + CompileAsC + None + ..\liblfds700\inc;%(AdditionalIncludeDirectories) + true + + + MachineX86 + true + Console + true + + + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NoExtensions + false + false + false + true + CompileAsC + None + ..\liblfds700\inc;%(AdditionalIncludeDirectories) + true + + + MachineX86 + true + Console + true + + + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NotSet + false + false + false + true + CompileAsC + None + true + false + + + true + Console + true + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NotSet + false + false + false + true + CompileAsC + None + true + false + + + true + Console + true + + + kernel32.lib;%(AdditionalDependencies) + + + true + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + MachineX86 + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + MachineX86 + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + + \ 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 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ 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 @@ + + + + \ 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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 +#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 + + 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 + #include + #include + #include + + 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 ); + From a8d646b10894d99ce7d28ea55328e9824741a1e9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 26 Feb 2016 17:30:54 +0000 Subject: [PATCH 098/182] Added agent support for remote scheduler --- cmake_targets/CMakeLists.txt | 5 +- openair2/ENB_APP/enb_agent.c | 5 + openair2/ENB_APP/enb_agent_handler.c | 7 +- openair2/ENB_APP/enb_agent_mac.c | 62 ++++++++ openair2/ENB_APP/enb_agent_mac.h | 8 + openair2/ENB_APP/enb_agent_mac_defs.h | 8 +- .../MAC/eNB_agent_scheduler_dataplane.c | 2 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 14 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 142 ++++++++++++++++++ .../MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 76 ++++++++++ openair2/LAYER2/MAC/eNB_scheduler.c | 74 ++++----- openair2/LAYER2/MAC/enb_agent_mac_proto.h | 5 +- 12 files changed, 343 insertions(+), 65 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e4b027958d..18eaf0f8b6 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1099,7 +1099,8 @@ set (MAC_SRC ${MAC_DIR}/config.c ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c ${MAC_DIR}/eNB_agent_scheduler_dataplane.c - ) + ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c + ) set (ENB_APP_SRC ${OPENAIR2_DIR}/ENB_APP/enb_app.c @@ -1113,7 +1114,7 @@ add_library(L2 ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) +#add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) # L3 Libs ########################## diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 95731d3654..a21e2f8e16 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -276,6 +276,11 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ */ enb_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 diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index d4e5706b11..721b3678f8 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -55,7 +55,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ @@ -116,10 +116,9 @@ Protocol__ProgranMessage* enb_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 + protocol__progran_message__free_unpacked(decoded_message, NULL); } - - protocol__progran_message__free_unpacked(decoded_message, NULL); - return reply_message; error: diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 7be6e6ba12..fa190bbf29 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -42,6 +42,8 @@ #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "liblfds700.h" + #include "log.h" @@ -51,6 +53,13 @@ unsigned int mac_agent_registered[NUM_MAX_ENB]; /*Array containing the Agent-MAC interfaces*/ AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; +/* Ringbuffer related structs used for maintaining the dl mac config messages */ +//message_queue_t *dl_mac_config_queue; +struct lfds700_misc_prng_state ps[NUM_MAX_ENB]; +struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; +struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; + + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input @@ -1154,6 +1163,56 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { return -1; } +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg) { + + 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(&ringbuffer_state[mod_id], NULL, (void **) msg, &ls) == 0) { + *msg = NULL; + } +} + +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + struct lfds700_misc_prng_state ls; + enum lfds700_misc_flag overwrite_occurred_flag; + Protocol__ProgranMessage *overwritten_dl_config; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + lfds700_ringbuffer_write( &ringbuffer_state[mod_id], + NULL, + (void *) params, + &overwrite_occurred_flag, + NULL, + (void **)&overwritten_dl_config, + &ls); + + if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { + // Delete unmanaged dl_config + enb_agent_mac_destroy_dl_config(overwritten_dl_config); + } + *msg = NULL; + return 2; + + error: + *msg = NULL; + return -1; +} + +void enb_agent_init_mac_agent(mid_t mod_id) { + lfds700_misc_library_init_valid_on_current_logical_core(); + lfds700_misc_prng_init(&ps[mod_id]); + int num_elements = RINGBUFFER_SIZE + 1; + //Allow RINGBUFFER_SIZE messages to be stored in the ringbuffer at any time + dl_mac_config_array[mod_id] = malloc( sizeof(struct lfds700_ringbuffer_element) * num_elements); + lfds700_ringbuffer_init_valid_on_current_logical_core( &ringbuffer_state[mod_id], dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL ); +} + /*********************************************** * eNB agent - technology mac API implementation ***********************************************/ @@ -1284,6 +1343,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; mac_agent_registered[mod_id] = 1; @@ -1299,6 +1359,8 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = NULL; xface->enb_agent_send_update_mac_stats = NULL; xface->enb_agent_schedule_ue_spec = NULL; + xface->enb_agent_get_pending_dl_mac_config = NULL; + xface->enb_agent_notify_ue_state_change = NULL; mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 221d76e57f..2a8f4c3a40 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -76,6 +76,9 @@ typedef struct stats_request_config_s{ report_config_t *config; } stats_request_config_t; +/* Initialization function for the agent structures etc */ +void enb_agent_init_mac_agent(mid_t mod_id); + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); @@ -98,6 +101,8 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + /********************************** * eNB agent - technology mac API @@ -113,6 +118,9 @@ void enb_agent_send_sf_trigger(mid_t mod_id); /// based on the stats request configuration void enb_agent_send_update_mac_stats(mid_t mod_id); +/// Provide to the scheduler a pending dl_mac_config message +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg); + /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 657fc94fe4..c5a3204f0c 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -42,6 +42,8 @@ #include "progran.pb-c.h" #include "header.pb-c.h" +#define RINGBUFFER_SIZE 100 + /* ENB AGENT-MAC Interface */ typedef struct { //msg_context_t *agent_ctxt; @@ -56,11 +58,15 @@ typedef struct { /// based on the stats request configuration void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + /// Provide to the scheduler a pending dl_mac_config message + void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, + Protocol__ProgranMessage **msg); + /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that /// dl_info is already initialized as prp_dl_mac_config and fills the /// prp_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); /// Notify the controller for a state change of a particular UE, by sending the proper diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 04efcb44ad..a1bd039dff 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -69,7 +69,7 @@ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info) { + const Protocol__ProgranMessage *dl_scheduling_info) { Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 4d353232a8..5031867394 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -64,6 +64,7 @@ #include "header.pb-c.h" #include "progran.pb-c.h" +#include "enb_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -80,7 +81,7 @@ schedule_ue_spec_default( uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_info + Protocol__ProgranMessage **dl_info ) //------------------------------------------------------------------------------ { @@ -126,11 +127,12 @@ schedule_ue_spec_default( uint8_t ue_has_transmission = 0; uint32_t ndi; - + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + if (UE_list->head==-1) { return; } - + start_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); @@ -763,10 +765,10 @@ schedule_ue_spec_default( } // CC_id loop // Add all the dl_data elements to the progran message - dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; - dl_info->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + (*dl_info)->dl_mac_config_msg->n_dl_ue_data = num_ues_added; + (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); for (i = 0; i < num_ues_added; i++) { - dl_info->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; + (*dl_info)->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; } stop_meas(&eNB->schedule_dlsch); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c new file mode 100644 index 0000000000..1818a64087 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -0,0 +1,142 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue_remote.c + * \brief procedures related to remote scheduling in the DLSCH transport channel + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "eNB_agent_scheduler_dlsch_ue_remote.h" + +struct DlMacConfigHead queue_head; + +int queue_initialized = 0; + +void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + if (queue_initialized) { + TAILQ_INIT(&queue_head); + queue_initialized = 1; + } + + dl_mac_config_element_t *dl_config_elem; + + int diff; + + // First we check to see if we have a scheduling decision for this sfn_sf already in our queue + while(queue_head.tqh_first != NULL) { + dl_config_elem = queue_head.tqh_first; + diff = get_sf_difference(mod_id, dl_config_elem->dl_info->dl_mac_config_msg->sfn_sf); + // Check if this decision is for now, for a later or a previous subframe + if ( diff == 0) { // Now + TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); + *dl_info = dl_config_elem->dl_info; + free(dl_config_elem); + return; + } else if (diff < 0) { //previous subframe , delete message and free memory + TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); + enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); + free(dl_config_elem); + } else { // next subframe, nothing to do now + enb_agent_create_empty_dl_config(mod_id, dl_info); + return; + } + } + + //Done with the local cache. Now we need to check if something new arrived + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + while (*dl_info != NULL) { + + diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); + if (diff == 0) { // Got a command for this sfn_sf + return; + } else if (diff < 0) { + enb_agent_mac_destroy_dl_config(*dl_info); + } else { // Intended for future subframe. Store it in local cache + dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); + TAILQ_INSERT_TAIL(&queue_head, e, configs); + enb_agent_create_empty_dl_config(mod_id, dl_info); + // No need to look for another. Messages arrive ordered + return; + } + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + } + + // We found no pending command, so we will simply pass an empty one + enb_agent_create_empty_dl_config(mod_id, dl_info); +} + +int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { + int diff_in_subframes; + + uint16_t current_frame = get_current_system_frame_num(mod_id); + uint16_t current_subframe = get_current_subframe(mod_id); + uint16_t current_sfn_sf = get_sfn_sf(mod_id); + + if (sfn_sf == current_sfn_sf) { + return 0; + } + + uint16_t frame_mask = !((1<<4) - 1); + uint16_t frame = (sfn_sf & frame_mask) >> 4; + + uint16_t sf_mask = !(((1<<12) - 1) << 4); + uint16_t subframe = (sfn_sf & sf_mask); + + if (frame == current_frame) { + return subframe - current_subframe; + } else if (frame > current_frame) { + diff_in_subframes = 9 - current_subframe; + diff_in_subframes += subframe; + diff_in_subframes += (frame-2) * 10; + if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { + return -1; + } else { + return 1; + } + } else { //frame < current_frame + diff_in_subframes = 9 - current_subframe; + diff_in_subframes += subframe; + if (frame > 0) { + diff_in_subframes += (frame - 1) * 10; + } + diff_in_subframes += (1023 - current_frame) * 10; + if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { + return -1; + } else { + return 1; + } + } +} diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h new file mode 100644 index 0000000000..2b8ec3ec19 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -0,0 +1,76 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue_remote.h + * \brief Local stub for remote scheduler used by the controller + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ +#define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ + +#include "progran.pb-c.h" +#include "header.pb-c.h" + +#include "ENB_APP/enb_agent_defs.h" +#include "enb_agent_mac.h" + +#include + +// Maximum value of schedule ahead of time +// Required to identify if a dl_command is for the future or not +#define SCHED_AHEAD_SUBFRAMES 10 + +typedef struct dl_mac_config_element_s { + Protocol__ProgranMessage *dl_info; + TAILQ_ENTRY(dl_mac_config_element_s) configs; +} dl_mac_config_element_t; + +TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); + +/* + * Default scheduler used by the eNB agent + */ +void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + + +// Find the difference in subframes from the given subframe +// negative for older value +// 0 for equal +// positive for future value +// Based on +int get_sf_difference(mid_t mod_id, uint16_t sfn_sf); + +#endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index e2423e2c10..9a172cb377 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -281,13 +281,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -330,13 +329,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -361,13 +359,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -398,13 +395,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -427,13 +423,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -471,13 +466,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -502,13 +496,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -539,13 +532,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -567,13 +559,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -620,13 +611,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -645,13 +635,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -673,13 +662,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -707,13 +695,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -731,13 +718,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -759,13 +745,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -798,13 +783,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -826,13 +810,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -859,13 +842,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -885,13 +867,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -911,13 +892,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -937,13 +917,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -965,19 +944,18 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); + frameP, + subframeP, + mbsfn_status, + msg); enb_agent_mac_destroy_dl_config(msg); } #endif diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h index 7fcdbc29c3..f453fa2fa3 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -48,14 +48,13 @@ * Default scheduler used by the eNB agent */ void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); - + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info); + const Protocol__ProgranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler From 4a04aeb2aada32731ad5ee138efe2cbbe32e38ef Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 1 Mar 2016 13:08:29 +0000 Subject: [PATCH 099/182] Fixed bug in decoding frame and subframe number from sfn_sf field --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 1818a64087..7f4ce23f9e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -109,17 +109,17 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { return 0; } - uint16_t frame_mask = !((1<<4) - 1); - uint16_t frame = (sfn_sf & frame_mask) >> 4; + uint16_t frame_mask = ((1<<12) - 1); + uint16_t frame = (sfn_sf & (frame_mask << 4)) >> 4; - uint16_t sf_mask = !(((1<<12) - 1) << 4); + uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); if (frame == current_frame) { return subframe - current_subframe; } else if (frame > current_frame) { diff_in_subframes = 9 - current_subframe; - diff_in_subframes += subframe; + diff_in_subframes += (subframe + 1); diff_in_subframes += (frame-2) * 10; if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; @@ -128,7 +128,7 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { } } else { //frame < current_frame diff_in_subframes = 9 - current_subframe; - diff_in_subframes += subframe; + diff_in_subframes += (subframe + 1); if (frame > 0) { diff_in_subframes += (frame - 1) * 10; } From ad74bb0247033fd0293c2f7efe6937ab947c9b97 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 15:05:54 +0000 Subject: [PATCH 100/182] Fixed enums issue and update time advance API function --- openair2/ENB_APP/enb_agent_common.c | 82 +++++++++++++++++++++++++---- openair2/ENB_APP/enb_agent_common.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 7 ++- 3 files changed, 78 insertions(+), 13 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 6122789d6e..f890ba829c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -545,14 +545,43 @@ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) return rlc_status.bytes_in_buffer; } -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id) +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { - if((((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ta_update) > 0) + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + int32_t time_advance; + switch (PHY_vars_eNB_g[mod_id][CC_id]->lte_frame_parms.N_RB_DL) { + case 6: + time_advance = eNB_UE_stats->timing_advance_update; + break; + + case 15: + time_advance = eNB_UE_stats->timing_advance_update/2; + break; + + case 25: + time_advance = eNB_UE_stats->timing_advance_update/4; + break; + + case 50: + time_advance = eNB_UE_stats->timing_advance_update/8; + break; + + case 75: + time_advance = eNB_UE_stats->timing_advance_update/12; + break; + + case 100: + time_advance = eNB_UE_stats->timing_advance_update/16; + break; + } + + if(time_advance > 0) return 1; else return 0; } - int get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; @@ -1793,16 +1822,32 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; //TODO: Fill in with actual value - cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + if(get_hopping_mode(enb_id,i) == 0){ + cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTER; + }else if(get_hopping_mode(enb_id,i) == 1){ + cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTERINTRA; + } cell_conf[i]->has_hopping_mode = 1; //TODO: Fill in with actual value, the number of subbands cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ - cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + if(get_phich_resource(enb_id,i) == 0){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE_SIXTH; //0 + }else if (get_phich_resource(enb_id,i) == 1){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_HALF; //1 + }else if (get_phich_resource(enb_id,i) == 2){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE; // 2 + }else if (get_phich_resource(enb_id,i) == 3){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_TWO;//3 + } cell_conf[i]->has_phich_resource = 1; //TODO: Fill in with actual value, one of the PRPD_ values - cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + if(get_phich_duration(enb_id,i) == 0){ + cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_NORMAL; + }else if(get_phich_duration(enb_id,i) == 1){ + cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_EXTENDED; + } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); @@ -1852,16 +1897,29 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_NORMAL; + }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_EXTENDED; + } cell_conf[i]->has_ul_cyclic_prefix_length = 1; //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_NORMAL; + }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_EXTENDED; + } + cell_conf[i]->has_dl_cyclic_prefix_length = 1; //TODO: Fill in with actual value, number of cell specific antenna ports cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; //TODO: Fill in with actual value, one of PRDM values - cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + if(get_duplex_mode(enb_id,i) == 1){ + cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_FDD; + }else if(get_duplex_mode(enb_id,i) == 0){ + cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_TDD; + } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); @@ -1936,7 +1994,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; //TODO: Fill in with actual value, One of the PREQ_ values - cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + if(get_enable64QAM(enb_id,i) == 0){ + cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_16QAM; + }else if(get_enable64QAM(enb_id,i) == 1){ + cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_64QAM; + } cell_conf[i]->has_enable_64qam = 1; //TODO: Fill in with actual value, Carrier component index cell_conf[i]->carrier_index = i; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 76c68437d0..e8fbf3afb8 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -157,7 +157,7 @@ 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_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); int get_active_CC(mid_t mod_id, mid_t ue_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index fa190bbf29..0957bd94f2 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -486,7 +486,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__PRP_CE_TYPE__PRPCET_ values found in stats_common.pb-c.h. See prp_ce_type in progRAN specification */ @@ -957,7 +957,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB - dl_info[i]->harq_status[j] = harq_status; + if(harq_status == 0) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); From a576127c49fe2711e5c20697aa66bbde5b268922 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 15:17:19 +0000 Subject: [PATCH 101/182] Added temporary values in protocol for PUCCH power control --- openair2/ENB_APP/MESSAGES/V2/stats_common.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 77df92a68b..3aaa018184 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -154,6 +154,7 @@ message prp_ul_cqi { optional prp_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; + optional int32 p0_pucch_dbm = 4; } // Full UL CQI report for a specific UE @@ -172,5 +173,6 @@ message prp_noise_interference_report { optional uint32 sfn_sf = 1; optional uint32 rip = 2; optional uint32 tnp = 3; + optional int32 p0_nominal_pucch = 4; } From d153208fc09116022c898abb998ebc4b7a070be2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 17:39:10 +0000 Subject: [PATCH 102/182] Added p0_PUCCH support in the agent --- .../ENB_APP/MESSAGES/V2/stats_common.proto | 6 ++++- openair2/ENB_APP/enb_agent_common.c | 20 ++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 +++ openair2/ENB_APP/enb_agent_mac.c | 26 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 3aaa018184..50d66a620c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -154,15 +154,19 @@ message prp_ul_cqi { optional prp_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; - optional int32 p0_pucch_dbm = 4; } // Full UL CQI report for a specific UE message prp_ul_cqi_report { optional uint32 sfn_sn = 1; repeated prp_ul_cqi cqi_meas = 2; + repeated prp_pucch_dbm pucch_dbm = 3; } +message prp_pucch_dbm { + optional int32 p0_pucch_dbm = 1; + optional uint32 serv_cell_index = 2; +} // // Cell related statistics diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f890ba829c..64b51238f1 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -647,6 +647,26 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + if(eNB_UE_stats->Po_PUCCH_update == 1) + { + return eNB_UE_stats->Po_PUCCH_dBm; + } + else + return -1; +} + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id) +{ + int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); + return pucch_rx_received; +} + /* * ************************************ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index e8fbf3afb8..1c4d478aab 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -210,6 +210,10 @@ 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); +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id); + /* * ************************************ * Get Messages for UE Configuration Reply diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0957bd94f2..29347b152b 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -657,8 +657,27 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set the servCellIndex for this report ul_report[j]->serv_cell_index = 0; ul_report[j]->has_serv_cell_index = 1; + + /*if(get_p0_pucch_dbm(enb_id,i) != -1){ + ul_report[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i); + ul_report[j]->has_p0_pucch_dbm = 1; + }*/ //Set the list of UL reports of this UE to the full UL report full_ul_report->cqi_meas = ul_report; + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); + + for (j = 0; j < MAX_NUM_CCs; j++) { + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); + protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + if(get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } + } + //Add full UL CQI report to the UE report ue_report[i]->ul_cqi_report = full_ul_report; } @@ -701,6 +720,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Thermal noise power in dbm ni_report->tnp = 0; ni_report->has_tnp = 1; + + ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); + ni_report->has_p0_nominal_pucch = 1; cell_report[i]->noise_inter_report = ni_report; } } @@ -822,6 +844,10 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(ul_report->cqi_meas); } + for (j = 0; j < ul_report->n_pucch_dbm; j++) { + free(ul_report->pucch_dbm[j]); + } + free(ul_report->pucch_dbm); free(reply->ue_report[i]); } free(reply->ue_report); From d24f532396029e8bc690e42842f4b04082981f29 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 19:49:51 +0000 Subject: [PATCH 103/182] Fixed bug in de-allocation of p0_pucch report --- openair2/ENB_APP/enb_agent_mac.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 29347b152b..197144d628 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -657,13 +657,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set the servCellIndex for this report ul_report[j]->serv_cell_index = 0; ul_report[j]->has_serv_cell_index = 1; - - /*if(get_p0_pucch_dbm(enb_id,i) != -1){ - ul_report[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i); - ul_report[j]->has_p0_pucch_dbm = 1; - }*/ + //Set the list of UL reports of this UE to the full UL report full_ul_report->cqi_meas = ul_report; + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); @@ -843,11 +840,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(ul_report->cqi_meas[j]); } free(ul_report->cqi_meas); + for (j = 0; j < ul_report->n_pucch_dbm; j++) { + free(ul_report->pucch_dbm[j]); + } + free(ul_report->pucch_dbm); } - for (j = 0; j < ul_report->n_pucch_dbm; j++) { - free(ul_report->pucch_dbm[j]); - } - free(ul_report->pucch_dbm); free(reply->ue_report[i]); } free(reply->ue_report); From 47d3d7732225f8d14270d2e94d6681fdf2e25183 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:04:29 +0000 Subject: [PATCH 104/182] Added updates in the dataplane based on dl_mac_config message --- .../LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index a1bd039dff..6f84014070 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -163,6 +163,12 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, //Check if there is TA command and set the length appropriately ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; } + + if (ta_len > 0) { + // Reset the measurement + ue_sched_ctl->ta_timer = 20; + eNB_UE_stats->timing_advance_update = 0; + } n_lc = dl_data->n_rlc_pdu; num_sdus = 0; @@ -333,6 +339,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, int size_bits, size_bytes; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); @@ -346,6 +353,15 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + if (dl_dci->has_tpc == 1) { + // Check if tpc has been set and reset measurement */ + if ((dl_dci->tpc == 0) || (dl_dci->tpc == 2)) { + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + eNB_UE_stats->Po_PUCCH_update = 0; + } + } + switch (frame_parms[CC_id]->N_RB_DL) { case 6: From 06b55e3fba77b9c3bcccd2fff347c599bf04155d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:19:34 +0000 Subject: [PATCH 105/182] Fixed bug in creation of ul_cqi_report --- openair2/ENB_APP/enb_agent_mac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 197144d628..630231560f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -633,7 +633,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if(ul_report == NULL) goto error; //Fill each UL report of the UE for each of the configured report types - for(j = 0; j++; j < full_ul_report->n_cqi_meas) { + for(j = 0; j < full_ul_report->n_cqi_meas; j++) { ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); if(ul_report[j] == NULL) goto error; @@ -665,14 +665,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); for (j = 0; j < MAX_NUM_CCs; j++) { - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); - protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); - full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; - full_ul_report->pucch_dbm[j]->serv_cell_index = j; - if(get_p0_pucch_dbm(enb_id,i, j) != -1){ - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); - full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; - } + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); + protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + if(get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } } //Add full UL CQI report to the UE report From 93b7cf05e868dac0135664ac03d62914babab5c6 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:54:11 +0000 Subject: [PATCH 106/182] Fixed linking error with creation of empty dl_mac_config --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 6 +++--- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 7f4ce23f9e..4fffeea132 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -70,7 +70,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); } else { // next subframe, nothing to do now - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } } @@ -87,7 +87,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } else { // Intended for future subframe. Store it in local cache dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); TAILQ_INSERT_TAIL(&queue_head, e, configs); - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } @@ -95,7 +95,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } // We found no pending command, so we will simply pass an empty one - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); } int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index 2b8ec3ec19..e507f5d8a8 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -45,6 +45,7 @@ #include "ENB_APP/enb_agent_defs.h" #include "enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include From 26bdf501092cebe4cee227b4f51c49672c4a2f8f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 15:46:31 +0000 Subject: [PATCH 107/182] Added bugfixes for remote scheduling --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 +- openair2/ENB_APP/enb_agent_common.c | 126 +++++++++--------- openair2/ENB_APP/enb_agent_mac.c | 2 + .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 38 ++++-- 4 files changed, 94 insertions(+), 76 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 60cd0ec0f7..211c64e373 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -153,8 +153,8 @@ void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) * to be refined in case things don't work properly */ if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { - LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); - abort(); + //LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + //abort(); } DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 64b51238f1..646470d13f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -272,31 +272,33 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) - goto error; - free(msg->enb_config_reply_msg->header); - int i, j; - Protocol__PrpEnbConfigReply *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(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); - free(reply->cell_config[i]->si_config); - free(reply->cell_config[i]); - } - free(reply->cell_config); - free(reply); - free(msg); - - return 0; - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) + goto error; + free(msg->enb_config_reply_msg->header); + int i, j; + Protocol__PrpEnbConfigReply *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); + if (reply->cell_config[i]->si_config != NULL) { + for(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); + free(reply->cell_config[i]->si_config); + } + free(reply->cell_config[i]); + } + free(reply->cell_config); + free(reply); + free(msg); + + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { @@ -507,7 +509,7 @@ uint16_t get_sfn_sf (mid_t mod_id) { frame = (frame_t) get_current_system_frame_num(mod_id); subframe = (sub_frame_t) get_current_subframe(mod_id); frame_mask = ((1<<12) - 1); - sf_mask = ((1<<4) -1); + sf_mask = ((1<<4) - 1); sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); return sfn_sf; @@ -1873,42 +1875,42 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; //TODO: Fill in with actual value - Protocol__PrpSiConfig *si_config; - si_config = malloc(sizeof(Protocol__PrpSiConfig)); - if(si_config == NULL) - goto error; - protocol__prp_si_config__init(si_config); - //TODO: Fill in with actual value, Frame number to apply the SI configuration - si_config->sfn = 1; - si_config->has_sfn = 1; - //TODO: Fill in with actual value, the length of SIB1 in bytes - si_config->sib1_length = get_sib1_length(enb_id,i); - si_config->has_sib1_length = 1; - //TODO: Fill in with actual value, Scheduling window for all SIs in SF - si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); - si_config->has_si_window_length = 1; - //TODO: Fill in with actual value, the number of SI messages - si_config->n_si_message=1; - Protocol__PrpSiMessage **si_message; - si_message = malloc(sizeof(Protocol__PrpSiMessage *) * 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__PrpSiMessage)); - if(si_message[j] == NULL) - goto error; - protocol__prp_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; + /* Protocol__PrpSiConfig *si_config; */ + /* si_config = malloc(sizeof(Protocol__PrpSiConfig)); */ + /* if(si_config == NULL) */ + /* goto error; */ + /* protocol__prp_si_config__init(si_config); */ + /* //TODO: Fill in with actual value, Frame number to apply the SI configuration */ + /* si_config->sfn = 1; */ + /* si_config->has_sfn = 1; */ + /* //TODO: Fill in with actual value, the length of SIB1 in bytes */ + /* si_config->sib1_length = get_sib1_length(enb_id,i); */ + /* si_config->has_sib1_length = 1; */ + /* //TODO: Fill in with actual value, Scheduling window for all SIs in SF */ + /* si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); */ + /* si_config->has_si_window_length = 1; */ + /* //TODO: Fill in with actual value, the number of SI messages */ + /* si_config->n_si_message=1; */ + /* Protocol__PrpSiMessage **si_message; */ + /* si_message = malloc(sizeof(Protocol__PrpSiMessage *) * 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__PrpSiMessage)); */ + /* if(si_message[j] == NULL) */ + /* goto error; */ + /* protocol__prp_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; */ //TODO: Fill in with actual value, the DL transmission bandwidth in RBs cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 630231560f..f00012f158 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -41,6 +41,7 @@ #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h" #include "liblfds700.h" @@ -1369,6 +1370,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 4fffeea132..c4f40faff7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -46,7 +46,7 @@ int queue_initialized = 0; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { - if (queue_initialized) { + if (!queue_initialized) { TAILQ_INIT(&queue_head); queue_initialized = 1; } @@ -54,22 +54,26 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *dl_config_elem; int diff; - + LOG_D(MAC, "Current frame and subframe %d, %d\n", frame, subframe); // First we check to see if we have a scheduling decision for this sfn_sf already in our queue while(queue_head.tqh_first != NULL) { dl_config_elem = queue_head.tqh_first; + diff = get_sf_difference(mod_id, dl_config_elem->dl_info->dl_mac_config_msg->sfn_sf); // Check if this decision is for now, for a later or a previous subframe if ( diff == 0) { // Now + LOG_D(MAC, "Found a decision for this subframe in the queue. Let's use it!\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); *dl_info = dl_config_elem->dl_info; free(dl_config_elem); return; } else if (diff < 0) { //previous subframe , delete message and free memory + LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); } else { // next subframe, nothing to do now + LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } @@ -81,17 +85,22 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); if (diff == 0) { // Got a command for this sfn_sf + LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n"); return; } else if (diff < 0) { + LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); enb_agent_mac_destroy_dl_config(*dl_info); + *dl_info = NULL; + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); } else { // Intended for future subframe. Store it in local cache + LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n"); dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); + e->dl_info = *dl_info; TAILQ_INSERT_TAIL(&queue_head, e, configs); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); } // We found no pending command, so we will simply pass an empty one @@ -114,25 +123,30 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); + + LOG_D(MAC, "Target frame and subframe %d, %d\n", frame, subframe); if (frame == current_frame) { return subframe - current_subframe; } else if (frame > current_frame) { - diff_in_subframes = 9 - current_subframe; - diff_in_subframes += (subframe + 1); - diff_in_subframes += (frame-2) * 10; + diff_in_subframes = ((frame*10)+subframe) - ((current_frame*10)+current_subframe); + + // diff_in_subframes = 9 - current_subframe; + //diff_in_subframes += (subframe + 1); + //diff_in_subframes += (frame-2) * 10; if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; } else { return 1; } } else { //frame < current_frame - diff_in_subframes = 9 - current_subframe; - diff_in_subframes += (subframe + 1); - if (frame > 0) { - diff_in_subframes += (frame - 1) * 10; - } - diff_in_subframes += (1023 - current_frame) * 10; + //diff_in_subframes = 9 - current_subframe; + //diff_in_subframes += (subframe + 1); + //if (frame > 0) { + // diff_in_subframes += (frame - 1) * 10; + //} + //diff_in_subframes += (1023 - current_frame) * 10; + diff_in_subframes = 10240 - ((current_frame*10)+current_subframe) + ((frame*10)+subframe); if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; } else { From fc569650ce84d3aa0349ef1459d6f646125dbcb3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 10:02:40 +0000 Subject: [PATCH 108/182] Fixed problem with sfn_sf recoding in remote scheduler --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 8 ++++---- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index c4f40faff7..db90bb1754 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -54,7 +54,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *dl_config_elem; int diff; - LOG_D(MAC, "Current frame and subframe %d, %d\n", frame, subframe); + LOG_D(MAC, "[TEST] Current frame and subframe %d, %d\n", frame, subframe); // First we check to see if we have a scheduling decision for this sfn_sf already in our queue while(queue_head.tqh_first != NULL) { dl_config_elem = queue_head.tqh_first; @@ -107,12 +107,12 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, enb_agent_mac_create_empty_dl_config(mod_id, dl_info); } -int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { +int get_sf_difference(mid_t mod_id, uint32_t sfn_sf) { int diff_in_subframes; uint16_t current_frame = get_current_system_frame_num(mod_id); uint16_t current_subframe = get_current_subframe(mod_id); - uint16_t current_sfn_sf = get_sfn_sf(mod_id); + uint32_t current_sfn_sf = get_sfn_sf(mod_id); if (sfn_sf == current_sfn_sf) { return 0; @@ -124,7 +124,7 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); - LOG_D(MAC, "Target frame and subframe %d, %d\n", frame, subframe); + LOG_D(MAC, "[TEST] Target frame and subframe %d, %d\n", frame, subframe); if (frame == current_frame) { return subframe - current_subframe; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index e507f5d8a8..c636ec0d95 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -72,6 +72,6 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, // 0 for equal // positive for future value // Based on -int get_sf_difference(mid_t mod_id, uint16_t sfn_sf); +int get_sf_difference(mid_t mod_id, uint32_t sfn_sf); #endif From 0dc76931c61b38bebf8cd60a022e6076ae1beb93 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 12:37:46 +0000 Subject: [PATCH 109/182] Fixed bug in HARQ status reporting --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index f00012f158..5ba6c0b665 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -982,9 +982,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; - else if (harq_status == 1) dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1369,8 +1369,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; From 2a5a389f7d80707d886c4783ff4e3c3a016047e8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 16:27:32 +0000 Subject: [PATCH 110/182] Improved stability and eNB goodput of remote scheduling --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++-- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 211c64e373..60cd0ec0f7 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -153,8 +153,8 @@ void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) * to be refined in case things don't work properly */ if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { - //LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); - //abort(); + LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + abort(); } DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 5ba6c0b665..ff8638ca4d 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -981,10 +981,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB - if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; - else if (harq_status == 1) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + if(harq_status == 0) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index db90bb1754..90181f0e44 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -50,7 +50,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, TAILQ_INIT(&queue_head); queue_initialized = 1; } - + dl_mac_config_element_t *dl_config_elem; int diff; From ff5b5854468560c676174f5e265681fd42aee283 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 8 Mar 2016 12:58:44 +0000 Subject: [PATCH 111/182] Added check for ignoring empty mac dl config messages --- openair2/ENB_APP/enb_agent_mac.c | 4 ++-- openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index ff8638ca4d..296da7f1d2 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1369,8 +1369,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 6f84014070..dc1ab3da0e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -247,6 +247,11 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; + + // If there is nothing to schedule, just leave + if ((sdu_length_total + ta_len) < 0) { + return; + } offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus From 8b283444487ec4aa000f8d9a7c3cf2e89fd74bc6 Mon Sep 17 00:00:00 2001 From: Mohamed Kassem Date: Tue, 8 Mar 2016 18:15:52 +0000 Subject: [PATCH 112/182] Temporary fix for bug in reporting number of initial pdcch symbols of cell and band5 configuration file for agent --- openair2/ENB_APP/enb_agent_common.c | 11 +- .../enb.band5.agent.usrpb210.epc.remote.conf | 175 ++++++++++++++++++ 2 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 646470d13f..18412bc502 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -873,11 +873,9 @@ int get_sib1_length(mid_t mod_id, int CC_id) } int get_num_pdcch_symb(mid_t mod_id, int CC_id) { - /*TODO: add these values to some struct in MAC - LTE_UE_PDCCH *lte_ue_pdcch; - lte_ue_pdcch = mac_xface->get_lte_ue_pdcch(mod_id, CC_id, mod_id); - */ - return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); + /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ + return 0; + //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } /* @@ -1200,6 +1198,9 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) int get_lcg(mid_t ue_id, mid_t lc_id) { + if (UE_mac_inst == NULL) { + return -1; + } if(UE_mac_inst[ue_id].logicalChannelConfig[lc_id] != NULL) { return *UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; } else { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf new file mode 100644 index 0000000000..f8c5016de5 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -0,0 +1,175 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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; + } + ); + + + 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 = "192.168.100.103"; + ipv6="192:168:30::17"; + active="yes"; + preference="ipv4";}); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + 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 ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); From 34db5f2003120719f56c5f45626b64433fc9d184 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Mar 2016 12:19:16 +0000 Subject: [PATCH 113/182] Moved agent async interface to lock-free implementation using lock-free ringbuffer --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent.c | 36 +++--- openair2/ENB_APP/enb_agent_async.c | 6 +- openair2/UTIL/ASYNC_IF/link_manager.c | 14 ++- openair2/UTIL/ASYNC_IF/link_manager.h | 3 +- openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 143 ++++++++++++++++++++++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 60 +++++++++ 7 files changed, 237 insertions(+), 26 deletions(-) create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.c create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 18eaf0f8b6..ea0cabe88f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -832,6 +832,7 @@ if (ENB_AGENT_SB_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) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index a21e2f8e16..81d856fa97 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -135,32 +135,34 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; - goto error; - } + //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { + // err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + // goto error; + //} - LOG_D(ENB_AGENT,"received message with size %d\n", size); + while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { + + LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->enb_id, data, size); + msg=enb_agent_handle_message(d->enb_id, data, size); - free(data); + free(data); - // check if there is something to send back to the controller - if (msg != NULL){ - data=enb_agent_pack_message(msg,&size); + // check if there is something to send back to the controller + if (msg != NULL){ + data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } } - } - + return NULL; error: diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c index d6389ea65f..a626566a8d 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/enb_agent_async.c @@ -60,10 +60,10 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst /* * create a message queue */ - - channel->send_queue = new_message_queue(); + // Set size of queues statically for now + channel->send_queue = new_message_queue(500); if (channel->send_queue == NULL) goto error; - channel->receive_queue = new_message_queue(); + channel->receive_queue = new_message_queue(500); if (channel->receive_queue == NULL) goto error; /* diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 9b31fc043b..a528577fd8 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -53,11 +53,15 @@ static void *link_manager_sender_thread(void *_manager) LOG_D(MAC, "starting link manager sender thread\n"); while (manager->run) { - if (message_get(manager->send_queue, &data, &size, &priority)) - goto error; - if (link_send_packet(manager->socket_link, data, size)) - goto error; - free(data); + 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"); diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 3e24b8679a..4f0628c0ee 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -38,7 +38,8 @@ #ifndef LINK_MANAGER_H #define LINK_MANAGER_H -#include "message_queue.h" +//#include "message_queue.h" +#include "ringbuffer_queue.h" #include "socket_link.h" #include 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 . + + 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 . + + 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 */ From 3a1f3df882b5769a2239935688377b5aea4e9d7b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Mar 2016 13:13:03 +0000 Subject: [PATCH 114/182] Added OAI priority to send and receive thread of agent --- openair2/UTIL/ASYNC_IF/link_manager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index a528577fd8..0ab2ecc2b2 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -122,6 +122,16 @@ link_manager_t *create_link_manager( 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; From e88c4d97cf71f403536645f8ae961bcb8df563bf Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 10 Mar 2016 10:57:44 +0000 Subject: [PATCH 115/182] Code cleanups for control delegation and API --- openair2/ENB_APP/enb_agent_common.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 18412bc502..1b38ff9020 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -439,7 +439,6 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro } } long time_elapsed_nanos = timer_end(vartime); - LOG_I(ENB_AGENT, "DID IT IN %lld\n", time_elapsed_nanos); *msg = NULL; return 0; @@ -890,7 +889,6 @@ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1254,8 +1252,6 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int i =find_UE_id(mod_id,rnti); config->has_rnti = 1; config->rnti = rnti; - LOG_I(ENB_APP,"The value of i is %d\n",i); - LOG_I(ENB_APP,"The value of rnto is %d\n",rnti); //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ config->time_alignment_timer = get_time_alignment_timer(mod_id,i); From 3251cf792c99514c3747811e85dba3c0ac74793d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 10 Mar 2016 14:12:47 +0000 Subject: [PATCH 116/182] Added shared libs for control delegation --- cmake_targets/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ea0cabe88f..3ab5289365 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1115,7 +1115,8 @@ add_library(L2 ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -#add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) +add_library(default_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c) +add_library(remote_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c) # L3 Libs ########################## From 43b63be53ac578b34339d9d7d2f14e29dee72493 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 14 Mar 2016 11:42:04 +0000 Subject: [PATCH 117/182] Added nb_rb and oldNDI in template to be used for retransmissions --- .../MAC/eNB_agent_scheduler_dataplane.c | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index dc1ab3da0e..e74d078fda 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -300,33 +300,46 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + //nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + //Find the number of resource blocks and set them to the template for retransmissions + nb_rb = get_min_rb_unit(mod_id, CC_id); + uint16_t stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); + + while (stats_tbs < TBS) { + nb_rb += get_min_rb_unit(mod_id, CC_id); + stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); + } + + UE_list->UE_template[CC_id][UE_id].nb_rb[dl_dci->harq_process] = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS - sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); } } else { // No need to create anything apart of DCI in case of retransmission /*TODO: Must add these */ - //eNB_UE_stats->dlsch_trials[round]++; + // eNB_UE_stats->dlsch_trials[round]++; //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; } + + UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0]; + eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0]; + //Fill the proper DCI of OAI fill_oai_dci(mod_id, CC_id, rnti, dl_dci); } @@ -496,7 +509,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, /*TODO: Need to deal with unsupported DCI type*/ return; } - + add_ue_spec_dci(DCI_pdu, DLSCH_dci, rnti, From c2971d517672c635f9ca9f1c95ee59f9a55be753 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 15 Mar 2016 17:25:44 +0000 Subject: [PATCH 118/182] Added tcp_nodelay option in agent async interface --- openair2/UTIL/ASYNC_IF/socket_link.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 95a92ae3ee..f4bd248f78 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,8 @@ socket_link_t *new_link_server(int port) 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__); @@ -78,6 +80,12 @@ socket_link_t *new_link_server(int port) 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; @@ -115,6 +123,7 @@ 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) { @@ -131,6 +140,12 @@ socket_link_t *new_link_client(char *server, int port) 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) { From ef22a539aa02f602bcd016e86cbe7cf5e6737fb4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 11:48:18 +0000 Subject: [PATCH 119/182] Added more checks when applying dci decisions in the dataplane, to reduce RLC request misses --- .../MAC/eNB_agent_scheduler_dataplane.c | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index e74d078fda..59dc70cda7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -182,41 +182,56 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (rlc_size > 0) { rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - rlc_size); // transport block set size + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + 0); + + if (rlc_status.bytes_in_buffer > 0) { + + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size - sdu_lengths[i] = 0; + sdu_lengths[i] = 0; - LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - sdu_lengths[i] += mac_rlc_data_req(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)&dlsch_buffer[sdu_length_total]); - - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); - sdu_length_total += sdu_lengths[i]; - sdu_lcids[i] = lcid; - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - - if (sdu_lengths[i] < 128) { - header_len += 2; - } else { - header_len += 3; + if (rlc_status.bytes_in_buffer > 0) { + + sdu_lengths[i] += mac_rlc_data_req(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_length_total]); + + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + sdu_lcids[i] = lcid; + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (sdu_lengths[i] < 128) { + header_len += 2; + } else { + header_len += 3; + } + + num_sdus++; + } } - - num_sdus++; } } // SDU creation end @@ -249,7 +264,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; // If there is nothing to schedule, just leave - if ((sdu_length_total + ta_len) < 0) { + if ((sdu_length_total + ta_len) <= 0) { return; } From c77fb6479e537cd9f43c040fab039ed21ee9ebb4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 11:49:07 +0000 Subject: [PATCH 120/182] Changed timing of continuous MAC statistics to be reported at the end of the subframe --- openair2/LAYER2/MAC/eNB_scheduler.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 9a172cb377..06e115b392 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -72,6 +72,7 @@ #define DEBUG_eNB_SCHEDULER 1 #define ENABLE_ENB_AGENT_DL_SCHEDULER //#define DISABLE_SF_TRIGGER +//#define DISABLE_CONT_STATS //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -219,7 +220,6 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); - agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); } #endif @@ -971,6 +971,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_idenb_agent_send_update_mac_stats(module_idP); + } +#endif + LOG_D(MAC,"frameP %d, subframeP %d\n",frameP,subframeP); stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler); From 7ab320d9239c28927b41bd985a366be8b568a05b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 13:40:46 +0000 Subject: [PATCH 121/182] Prevent timing advance update to be sent without payload --- openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 59dc70cda7..4642f9be00 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -264,7 +264,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; // If there is nothing to schedule, just leave - if ((sdu_length_total + ta_len) <= 0) { + if ((sdu_length_total) <= 0) { return; } From 74819596477fbe5353463e05877e6ca31a61fe24 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 18 Mar 2016 19:38:55 +0000 Subject: [PATCH 122/182] Added agent config file for band7 usrbb210 --- .../enb.band5.agent.usrpb210.epc.remote.conf | 171 ++++++++--------- .../enb.band7.agent.usrpb210.epc.remote.conf | 174 ++++++++++++++++++ 2 files changed, 260 insertions(+), 85 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index f8c5016de5..8936b2eb24 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -3,8 +3,8 @@ Active_eNBs = ( "eNB_Eurecom_LTEBox"); Asn1_verbosity = "none"; eNBs = -( - { +( + { ////////// Identification parameters: eNB_ID = 0xe00; @@ -13,110 +13,111 @@ eNBs = eNB_name = "eNB_Eurecom_LTEBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; + tracking_area_code = "10"; mobile_country_code = "208"; mobile_network_code = "95"; ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 115; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + 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 =;*/ - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2660000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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; - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; + 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; - 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; - } - ); + } + ); srb1_parameters : { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + # 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; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf new file mode 100644 index 0000000000..4f6a3ba101 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf @@ -0,0 +1,174 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "10"; + + mobile_country_code = "208"; + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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; + } + ); + + 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 = "192.168.100.103"; + ipv6="192:168:30::17"; + active="yes"; + preference="ipv4";}); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + 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 ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); From aa50fcf02a8125ad66b25645970fd4fdd3f67c17 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 18 Mar 2016 19:42:38 +0000 Subject: [PATCH 123/182] Fixed HARQ reporting to agent and changed sf trigger to report the upcoming subframe --- openair1/SCHED/phy_procedures_lte_eNb.c | 14 +++++++++++++ openair2/ENB_APP/enb_agent.c | 7 +++++++ openair2/ENB_APP/enb_agent_common.c | 26 +++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 2 ++ openair2/ENB_APP/enb_agent_mac.c | 26 +++++++++++++++++++++---- openair2/LAYER2/MAC/eNB_scheduler.c | 14 +++++++------ 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 375c0dcd1f..d843ebbaab 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -67,6 +67,12 @@ # endif #endif + +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" + //#define DIAG_PHY #define NS_PER_SLOT 500000 @@ -1411,6 +1417,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e #endif #endif + if (abstraction_flag == 0) { start_meas(&phy_vars_eNB->dlsch_encoding_stats); @@ -1603,6 +1610,13 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB_ra->active = 0; } +#ifndef DISABLE_SF_TRIGGER + //Send subframe trigger to the controller + if (mac_agent_registered[phy_vars_eNB->Mod_id]) { + agent_mac_xface[phy_vars_eNB->Mod_id]->enb_agent_send_sf_trigger(phy_vars_eNB->Mod_id); + } +#endif + // Now scan UE specific DLSCH for (UE_id=0; UE_idnum_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 1c4d478aab..9b483ce4a0 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -145,6 +145,8 @@ unsigned int get_current_subframe(mid_t mod_id); Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); +uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); + int get_num_ues(mid_t mod_id); int get_ue_crnti (mid_t mod_id, mid_t ue_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 296da7f1d2..fb9ae7322f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -947,9 +947,27 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran } protocol__prp_sf_trigger__init(sf_trigger_msg); + frame_t frame; + sub_frame_t subframe; + + int ahead_of_time = 1; + + frame = (frame_t) get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) get_current_subframe(mod_id); + + subframe = ((subframe + ahead_of_time) % 10); + + int full_frames_ahead = ((ahead_of_time / 10) % 10); + + frame = frame + full_frames_ahead; + + if (subframe < get_current_subframe(mod_id)) { + frame++; + } + sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; - sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs @@ -973,7 +991,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; - get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),&harq_id, &harq_status); + get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ @@ -1369,8 +1387,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 06e115b392..3285b2b6dd 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -216,12 +216,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } -#ifndef DISABLE_SF_TRIGGER - //Send subframe trigger to the controller - if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); - } -#endif +/* #ifndef DISABLE_SF_TRIGGER */ +/* //Send subframe trigger to the controller */ +/* if (mac_agent_registered[module_idP]) { */ +/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */ +/* } */ +/* #endif */ //if (subframeP%5 == 0) //#ifdef EXMIMO @@ -971,6 +971,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_id Date: Wed, 6 Apr 2016 13:34:37 +0100 Subject: [PATCH 124/182] Bugfixes to improve stability --- openair2/ENB_APP/enb_agent_common.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 2be189a2cd..f06599e258 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -561,7 +561,6 @@ int get_ue_phr (mid_t mod_id, mid_t ue_id) { } int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { - return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) @@ -576,6 +575,10 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { rnti_t rnti = get_ue_crnti(mod_id,ue_id); LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } int32_t time_advance; switch (PHY_vars_eNB_g[mod_id][CC_id]->lte_frame_parms.N_RB_DL) { @@ -622,6 +625,11 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) rnti_t rnti = get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } + return eNB_UE_stats[CC_id].rank; } @@ -636,10 +644,16 @@ int get_tpc(mid_t mod_id, mid_t ue_id) eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); - normalized_rx_power = eNB_UE_stats->UL_rssi[0]; - target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); + if (eNB_UE_stats == NULL) { + normalized_rx_power = target_rx_power; + } else if (eNB_UE_stats->UL_rssi != NULL) { + normalized_rx_power = eNB_UE_stats->UL_rssi[0]; + } else { + normalized_rx_power = target_rx_power; + } + if (normalized_rx_power>(target_rx_power+1)) { tpc = 0; //-1 } else if (normalized_rx_power<(target_rx_power-1)) { @@ -680,6 +694,11 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) uint32_t rnti = get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + + if (eNB_UE_stats == NULL) { + return -1; + } + if(eNB_UE_stats->Po_PUCCH_update == 1) { return eNB_UE_stats->Po_PUCCH_dBm; From 6b15195ac58e33fb4aab6d28bc4548e59944873a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 7 Apr 2016 09:28:35 +0100 Subject: [PATCH 125/182] Added statistics for total and missed scheduling deadlines of remote scheduler --- openair2/LAYER2/MAC/defs.h | 7 +++++++ .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 14 ++++++++++++++ openair2/LAYER2/openair2_proc.c | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index cd2d593726..7c0561121d 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -462,6 +462,13 @@ typedef struct { // uint32_t total_ulsch_pdus_rx; + + /// MAC agent-related stats + /// total number of scheduling decisions + int sched_decisions; + /// missed deadlines + int missed_deadlines; + } eNB_STATS; /*! \brief eNB statistics for the connected UEs*/ typedef struct { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 90181f0e44..ad8b130584 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -39,6 +39,9 @@ #include "eNB_agent_scheduler_dlsch_ue_remote.h" +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/extern.h" + struct DlMacConfigHead queue_head; int queue_initialized = 0; @@ -46,10 +49,15 @@ int queue_initialized = 0; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + eNB_MAC_INST *eNB; + if (!queue_initialized) { TAILQ_INIT(&queue_head); queue_initialized = 1; } + + eNB = &eNB_mac_inst[mod_id]; dl_mac_config_element_t *dl_config_elem; @@ -66,12 +74,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); *dl_info = dl_config_elem->dl_info; free(dl_config_elem); + eNB->eNB_stats[mod_id].sched_decisions++; return; } else if (diff < 0) { //previous subframe , delete message and free memory LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); + eNB->eNB_stats[mod_id].sched_decisions++; + eNB->eNB_stats[mod_id].missed_deadlines++; } else { // next subframe, nothing to do now LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); @@ -86,12 +97,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); if (diff == 0) { // Got a command for this sfn_sf LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n"); + eNB->eNB_stats[mod_id].sched_decisions++; return; } else if (diff < 0) { LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); enb_agent_mac_destroy_dl_config(*dl_info); *dl_info = NULL; enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + eNB->eNB_stats[mod_id].sched_decisions++; + eNB->eNB_stats[mod_id].missed_deadlines++; } else { // Intended for future subframe. Store it in local cache LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n"); dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c index e09adaea8c..4556bafeec 100644 --- a/openair2/LAYER2/openair2_proc.c +++ b/openair2/LAYER2/openair2_proc.c @@ -122,11 +122,13 @@ int dump_eNB_l2_stats(char *buffer, int length) for (CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) { eNB->eNB_stats[CC_id].dlsch_bitrate= 0; - len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d \n", + len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d, Scheduling decisions %d, Missed Deadlines %d \n", eNB_id, CC_id, eNB->frame, eNB->eNB_stats[CC_id].num_dlactive_UEs, eNB->eNB_stats[CC_id].available_prbs, - eNB->eNB_stats[CC_id].available_ncces); + eNB->eNB_stats[CC_id].available_ncces, + eNB->eNB_stats[CC_id].sched_decisions, + eNB->eNB_stats[CC_id].missed_deadlines); len += sprintf(&buffer[len],"BCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n", eNB->eNB_stats[CC_id].total_num_bcch_pdu, From 9c9d3f45801e37bede099320330d2a619d363dff Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 12:56:13 +0100 Subject: [PATCH 126/182] Added build support for packages required for the agent-enabled eNB --- cmake_targets/CMakeLists.txt | 14 ++++++++++--- cmake_targets/tools/build_helper | 36 +++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 1224768142..2db18176b4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -911,6 +911,7 @@ if (ENB_AGENT_SB_IF) add_library(ENB_AGENT ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_common_internal.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c @@ -923,6 +924,13 @@ if (ENB_AGENT_SB_IF) set(PROTOBUF_LIB "protobuf-c") + FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h) + FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml) + + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR) + MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) + #set(PROTOBUF_LIB "protobuf") #for Cpp endif() @@ -1703,7 +1711,7 @@ target_link_libraries (lte-softmodem 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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) +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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) @@ -1737,7 +1745,7 @@ target_link_libraries (lte-softmodem-nos1 -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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) +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} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) @@ -1874,7 +1882,7 @@ target_link_libraries (oaisim_nos1 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} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 294c5006a5..498dfbe7a9 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -146,6 +146,37 @@ install_nettle_from_source() { rm -rf /tmp/nettle-2.5.tar.gz /tmp/nettle-2.5 } + +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 +} + install_gnutls_from_source(){ cd /tmp echo "Downloading gnutls archive" @@ -271,7 +302,8 @@ check_install_oai_software() { python-numpy \ sshpass \ libxslt1-dev \ - android-tools-adb + android-tools-adb \ + libyaml-dev $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so if [ `lsb_release -rs` = '12.04' ] ; then @@ -285,6 +317,8 @@ check_install_oai_software() { install_asn1c_from_source $SUDO rm -fr /opt/ssh $SUDO git clone https://gist.github.com/2190472.git /opt/ssh + install_protobuf_from_source + install_protobuf_c_from_source } install_asn1c_from_source(){ From dd2e208361bd0d2a7280567ec0b1d7629d7da0d3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 12:56:55 +0100 Subject: [PATCH 127/182] Added protocol support for agent policy reconfiguration --- openair2/ENB_APP/MESSAGES/V2/header.proto | 1 + openair2/ENB_APP/MESSAGES/V2/progran.proto | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 6ce9959104..44ad93e16b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -38,5 +38,6 @@ enum prp_type { // Control delegation messages PRPT_DELEGATE_CONTROL = 15; + PRPT_RECONFIGURE_AGENT = 16; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 6b7b784629..235aba4363 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -27,6 +27,7 @@ message progran_message { prp_dl_mac_config dl_mac_config_msg = 14; prp_ue_state_change ue_state_change_msg = 15; prp_control_delegation control_delegation_msg = 16; + prp_agent_reconfiguration agent_reconfiguration_msg = 17; } } @@ -180,7 +181,16 @@ message prp_control_delegation { optional prp_header header = 1; optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags optional bytes payload = 3; // Byte array of shared lib containing the delegated functions - repeated string name = 4; // The delegated functions names ordered based on bitmap flags + optional string name = 4; // The delegated functions names ordered based on bitmap flags +} + +// +// Agent reconfiguration message +// + +message prp_agent_reconfiguration { + optional prp_header header = 1; + optional string policy = 2; // The policy changes using YAML syntax in string format } // Extensions of the echo request and reply From a47f3654f8c347838b46de3e01d5a4dad9d46af5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 13:00:20 +0100 Subject: [PATCH 128/182] Added basic support for policy reconfiguration using yaml parser --- openair2/ENB_APP/enb_agent_common.c | 37 +- openair2/ENB_APP/enb_agent_common.h | 3 + openair2/ENB_APP/enb_agent_common_internal.c | 400 ++++++++++++++++++ openair2/ENB_APP/enb_agent_common_internal.h | 64 +++ openair2/ENB_APP/enb_agent_handler.c | 3 +- openair2/ENB_APP/enb_agent_mac.c | 4 + openair2/ENB_APP/enb_agent_mac_defs.h | 2 + openair2/ENB_APP/enb_agent_mac_internal.c | 235 ++++++++++ openair2/ENB_APP/enb_agent_mac_internal.h | 15 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 18 + 10 files changed, 758 insertions(+), 23 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_common_internal.c create mode 100644 openair2/ENB_APP/enb_agent_common_internal.h diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f06599e258..e21c180cec 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -35,10 +35,10 @@ */ #include -#include #include #include "enb_agent_common.h" +#include "enb_agent_common_internal.h" #include "enb_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -403,7 +403,6 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro uint32_t delegation_type = control_delegation_msg->delegation_type; - void *lib; int i; struct timespec vartime = timer_start(); @@ -411,7 +410,7 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro //Write the payload lib into a file in the cache and load the lib char lib_name[120]; char target[512]; - snprintf(lib_name, sizeof(lib_name), "/delegation_lib_%d.so", control_delegation_msg->header->xid); + snprintf(lib_name, sizeof(lib_name), "/%s.so", control_delegation_msg->name); strcpy(target, local_cache); strcat(target, lib_name); @@ -419,25 +418,7 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro f = fopen(target, "wb"); fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f); fclose(f); - lib = dlopen(target, RTLD_NOW); - if (lib == NULL) { - goto error; - } - i = 0; - //Check functions that need to be delegated - - //DL UE scheduler delegation - if (delegation_type & PROTOCOL__PRP_CONTROL_DELEGATION_TYPE__PRCDT_MAC_DL_UE_SCHEDULER) { - void *loaded_scheduler = dlsym(lib, control_delegation_msg->name[i]); - i++; - if (loaded_scheduler) { - if (mac_agent_registered[mod_id]) { - agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; - LOG_D(ENB_APP,"Delegated control for DL UE scheduler successfully\n"); - } - } - } long time_elapsed_nanos = timer_end(vartime); *msg = NULL; return 0; @@ -450,6 +431,20 @@ int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; + + apply_reconfiguration_policy(mod_id, agent_reconfiguration_msg->policy, strlen(agent_reconfiguration_msg->policy)); + + *msg = NULL; + return 0; +} + +int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg) { + /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 9b483ce4a0..18c9129989 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -114,6 +114,9 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); diff --git a/openair2/ENB_APP/enb_agent_common_internal.c b/openair2/ENB_APP/enb_agent_common_internal.c new file mode 100644 index 0000000000..ca61a96609 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common_internal.c @@ -0,0 +1,400 @@ +/******************************************************************************* + 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 . + + 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_internal.c + * \brief internal functions for common message primitves and utilities + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include +#include + +#include "enb_agent_common_internal.h" +#include "enb_agent_mac_internal.h" + +int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { + + yaml_parser_t parser; + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + LOG_I(ENB_APP, "Time to apply a new policy \n"); + + yaml_parser_initialize(&parser); + + yaml_parser_set_input_string(&parser, policy, strlen(policy)); + + while (!done) { + if (!yaml_parser_parse(&parser, &event)) + goto error; + + switch (event.type) { + case YAML_STREAM_START_EVENT: + case YAML_STREAM_END_EVENT: + case YAML_DOCUMENT_START_EVENT: + case YAML_DOCUMENT_END_EVENT: + break; + case YAML_MAPPING_START_EVENT: + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + // Check the system name and call the proper handler + if (strcmp(event.data.scalar.value, "mac") == 0) { + LOG_D(ENB_APP, "This is intended for the mac system\n"); + // Call the mac handler + if (parse_mac_config(mod_id, &parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "rlc") == 0) { + // Call the RLC handler + LOG_D(ENB_APP, "This is intended for the rlc system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "pdcp") == 0) { + // Call the PDCP handler + LOG_D(ENB_APP, "This is intended for the pdcp system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "rrc") == 0) { + // Call the RRC handler + LOG_D(ENB_APP, "This is intended for the rrc system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else { + goto error; + } + break; + default: + // We are not expecting to find any other type of event at this level + // of the hierarchy + yaml_event_delete(&event); + goto error; + } + + done = (event.type == YAML_STREAM_END_EVENT); + + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_parser_delete(&parser); + return -1; + +} + +int skip_system_section(yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + + int sequence_started = 0; + int mapping_started = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + + case YAML_SEQUENCE_START_EVENT: + LOG_D(ENB_APP, "A sequence just started as expected\n"); + sequence_started = 1; + break; + case YAML_SEQUENCE_END_EVENT: + LOG_D(ENB_APP, "A sequence ended\n"); + sequence_started = 0; + break; + case YAML_MAPPING_START_EVENT: + if (!sequence_started) { + goto error; + } + LOG_D(ENB_APP, "A mapping started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + if (!mapping_started) { + goto error; + } + LOG_D(ENB_APP, "A mapping ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Entered a subsystem section. Let's skip it + if (skip_subsystem_section(parser) == -1) { + goto error; + } + } + + done = (event.type == YAML_SEQUENCE_END_EVENT); + + yaml_event_delete(&event); + + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int skip_subsystem_section(yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (strcmp(event.data.scalar.value, "behavior") == 0) { + LOG_D(ENB_APP, "Skipping the behavior attribute\n"); + yaml_event_delete(&event); + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + if (event.type == YAML_SCALAR_EVENT) { + break; + } else { + goto error; + } + } else if (strcmp(event.data.scalar.value, "parameters") == 0) { + LOG_D(ENB_APP, "Skipping the parameters for this subsystem\n"); + if (skip_subsystem_parameters_config(parser) == -1) { + goto error; + } + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int skip_subsystem_parameters_config(yaml_parser_t *parser) { + yaml_event_t event; + + void *param; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping of parameters + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + LOG_D(ENB_APP, "Skipping parameter %s\n", event.data.scalar.value); + if (skip_parameter_modification(parser) == -1 ) { + goto error; + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + + +int skip_parameter_modification(yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + int is_array = 0; + int i = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + + // Expecting either a scalar or a sequence + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + is_array = 1; + break; + case YAML_SCALAR_EVENT: + if ((strcmp(event.data.scalar.tag, YAML_INT_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_FLOAT_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_STR_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_BOOL_TAG) == 0)) { + // Do nothing + } else { + // No other type is supported at the moment, so it should be considered an error + // if we reach here + goto error; + } + if (is_array) { + i++; + } else { + done = 1; + } + break; + case YAML_SEQUENCE_END_EVENT: + done = 1; + break; + default: + goto error; + } + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int apply_parameter_modification(void *parameter, yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + int is_array = 0; + int i = 0; + + char *endptr; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + + // Expecting either a scalar or a sequence + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + is_array = 1; + break; + case YAML_SCALAR_EVENT: + if (strcmp(event.data.scalar.tag, YAML_INT_TAG) == 0) { + ((int *) parameter)[i] = strtol(event.data.scalar.value, &endptr, 10); + } else if (strcmp(event.data.scalar.tag, YAML_FLOAT_TAG) == 0) { + ((float *) parameter)[i] = strtof(event.data.scalar.value, &endptr); + } else if (strcmp(event.data.scalar.tag, YAML_STR_TAG) == 0) { + strncpy(&((char *) parameter)[i], event.data.scalar.value, event.data.scalar.length); + } else if (strcmp(event.data.scalar.tag, YAML_BOOL_TAG) == 0) { + if (strcmp(event.data.scalar.value, "true") == 0) { + ((int *) parameter)[i] = 1; + } else { + ((int *) parameter)[i] = 0; + } + } else { + // No other type is supported at the moment, so it should be considered an error + // if we reach here + goto error; + } + if (is_array) { + i++; + } else { + done = 1; + } + break; + case YAML_SEQUENCE_END_EVENT: + done = 1; + break; + default: + goto error; + } + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_common_internal.h b/openair2/ENB_APP/enb_agent_common_internal.h new file mode 100644 index 0000000000..30fd51c5c8 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common_internal.h @@ -0,0 +1,64 @@ +/******************************************************************************* + 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 . + + 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_internal.h + * \brief internal agent functions for common message primitves and utilities + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_COMMON_INTERNAL_H_ +#define ENB_AGENT_COMMON_INTERNAL_H_ + +#include + +#include "enb_agent_defs.h" + +int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length); + +int apply_parameter_modification(void *parameter, yaml_parser_t *parser); + +// This can be used when parsing for a specific system that is not yet implmeneted +// in order to skip its configuration, without affecting the rest +int skip_system_section(yaml_parser_t *parser); + +// This can be used when parsing for a specific subsystem that is not yet implmeneted +// in order to skip its configuration, without affecting the rest +int skip_subsystem_section(yaml_parser_t *parser); + +// This can be used when parsing for the parameters of a specific subsystem +//that is not yet implmeneted in order to skip its configuration, without affecting the rest +int skip_subsystem_parameters_config(yaml_parser_t *parser); + +// This can be used when configuring the parameters of a specific subsystem +//that is not yet implmeneted in order to skip its configuration, without affecting the rest +int skip_parameter_modification(yaml_parser_t *parser); + +#endif diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 721b3678f8..da53343818 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -58,7 +58,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - + {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; enb_agent_message_destruction_callback message_destruction_callback[] = { @@ -78,6 +78,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_dl_config, enb_agent_destroy_ue_state_change, enb_agent_destroy_control_delegation, + enb_agent_destroy_agent_reconfiguration, }; static const char *enb_agent_direction2String[] = { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index fb9ae7322f..744768135e 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1391,6 +1391,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; + + xface->dl_scheduler_loaded_lib = NULL; mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; @@ -1408,6 +1410,8 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_get_pending_dl_mac_config = NULL; xface->enb_agent_notify_ue_state_change = NULL; + xface->dl_scheduler_loaded_lib = NULL; + mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index c5a3204f0c..1511ee7262 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -74,6 +74,8 @@ typedef struct { void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, uint32_t state_change); + + void *dl_scheduler_loaded_lib; /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index c3cc584bcd..aa7482bd90 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -34,6 +34,9 @@ * \version 0.1 */ +#include +#include + #include "enb_agent_mac_internal.h" Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, @@ -558,3 +561,235 @@ Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNois error: return NULL; } + + +int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + + int sequence_started = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + LOG_I(ENB_APP, "A sequence just started as expected\n"); + sequence_started = 1; + break; + case YAML_SEQUENCE_END_EVENT: + LOG_I(ENB_APP, "A sequence ended\n"); + sequence_started = 0; + break; + case YAML_MAPPING_START_EVENT: + if (!sequence_started) { + goto error; + } + LOG_I(ENB_APP, "A mapping started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + if (!mapping_started) { + goto error; + } + LOG_I(ENB_APP, "A mapping ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check the types of subsystems offered and handle their values accordingly + if (strcmp(event.data.scalar.value, "dl_scheduler") == 0) { + LOG_I(ENB_APP, "This is for the dl_scheduler subsystem\n"); + // Call the proper handler + if (parse_dl_scheduler_config(mod_id, parser) == -1) { + LOG_I(ENB_APP, "An error occured\n"); + goto error; + } + } else if (strcmp(event.data.scalar.value, "ul_scheduler") == 0) { + // Call the proper handler + LOG_I(ENB_APP, "This is for the ul_scheduler subsystem\n"); + goto error; + // TODO + } else if (strcmp(event.data.scalar.value, "ra_scheduler") == 0) { + // Call the proper handler + // TODO + } else if (strcmp(event.data.scalar.value, "page_scheduler") == 0) { + // Call the proper handler + // TODO + } else { + // Unknown subsystem + goto error; + } + break; + default: // We expect nothing else at this level of the hierarchy + goto error; + } + + done = (event.type == YAML_SEQUENCE_END_EVENT); + + yaml_event_delete(&event); + + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; + +} + +int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping (behavior and parameters) + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (strcmp(event.data.scalar.value, "behavior") == 0) { + LOG_D(ENB_APP, "Time to set the behavior attribute\n"); + yaml_event_delete(&event); + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + if (event.type == YAML_SCALAR_EVENT) { + if (load_dl_scheduler_function(mod_id, event.data.scalar.value) == -1) { + goto error; + } + } else { + goto error; + } + } else if (strcmp(event.data.scalar.value, "parameters") == 0) { + LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n"); + if (parse_dl_scheduler_parameters(mod_id, parser) == -1) { + goto error; + } + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { + yaml_event_t event; + + void *param; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping of parameters + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (mac_agent_registered[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, + event.data.scalar.value); + if (param == NULL) { + goto error; + } + apply_parameter_modification(param, parser); + } else { + goto error; + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { + void *lib; + + char lib_name[120]; + char target[512]; + sprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); + strcpy(target, local_cache); + strcat(target, lib_name); + + lib = dlopen(target, RTLD_NOW); + if (lib == NULL) { + goto error; + } + + void *loaded_scheduler = dlsym(lib, function_name); + if (loaded_scheduler) { + if (mac_agent_registered[mod_id]) { + agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; + LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); + } + } + + return 0; + + error: + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 394d3e7730..4a76f0ed38 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -39,9 +39,11 @@ #include +#include + #include "enb_agent_mac.h" #include "enb_agent_common.h" - +#include "enb_agent_defs.h" /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe @@ -98,4 +100,15 @@ int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, Protocol__PrpCellStatsReport *rep2); + +/* Functions for parsing the MAC agent policy reconfiguration command */ + +int parse_mac_config(mid_t mod_id, yaml_parser_t *parser); + +int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser); + +int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); + +int load_dl_scheduler_function(mid_t mod_id, const char *function_name); + #endif /*ENB_AGENT_MAC_INTERNAL_H_*/ diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index ad8b130584..d8d2373332 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -37,6 +37,8 @@ */ +#include "enb_agent_common_internal.h" + #include "eNB_agent_scheduler_dlsch_ue_remote.h" #include "LAYER2/MAC/defs.h" @@ -46,9 +48,25 @@ struct DlMacConfigHead queue_head; int queue_initialized = 0; +//uint32_t skip_subframe = 1; +//uint32_t period = 10; +//uint32_t sched [] = {1, 2, 3}; + void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + //if ((subframe == skip_subframe) && (frame % period == 0)) { + // LOG_I(MAC, "Will skip subframe %d %d\n", subframe, frame); + // for (int i = 0; i < 3; i++) { + // LOG_I(MAC, "%d\n", sched[i]); + // } + //} + + /* if (frame == 500 && subframe == 1) { */ + /* char policy[] = "rrc: \n - ul_scheduler: \n behavior : tester_function\n parameters:\n period: !!int 3\nmac: \n - dl_scheduler: \n parameters: \n period : !!int 40\n skip_subframe : !!int 3\n sched : [!!int 4, !!int 5, !!int 6]"; */ + /* apply_reconfiguration_policy(mod_id, policy, strlen(policy)); */ + /* } */ eNB_MAC_INST *eNB; From 345a9382f282cda9dd68a4e2d2a865f4e60ad15f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 14:50:22 +0100 Subject: [PATCH 129/182] Fixed bug of local agent scheduler that did not allow the retransmission in HARQ processes --- openair2/LAYER2/MAC/defs.h | 6 ++++ .../MAC/eNB_agent_scheduler_dataplane.c | 2 -- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 33 ++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 7c0561121d..60c095fa14 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -609,6 +609,12 @@ typedef struct { /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) boolean_t configured; + /// MCS from last scheduling + uint8_t mcs[8]; + + /// TPC from last scheduling + uint8_t oldTPC[8]; + // PHY interface info /// DCI format for DLSCH diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 4642f9be00..b2a66bfe2d 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -324,8 +324,6 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, nb_rb += get_min_rb_unit(mod_id, CC_id); stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); } - - UE_list->UE_template[CC_id][UE_id].nb_rb[dl_dci->harq_process] = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 5031867394..79716af854 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -137,7 +137,7 @@ schedule_ue_spec_default( VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); //weight = get_ue_weight(module_idP,UE_id); - aggregation = 1; // set to the maximum aggregation level + aggregation = 2; // set to the maximum aggregation level for (CC_id=0; CC_idN_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; + rballoc_sub[j] = 0; } LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", @@ -269,13 +270,6 @@ schedule_ue_spec_default( if (round > 0) { - mcs = UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1; - - // get freq_allocation - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - - dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); - if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); @@ -283,6 +277,13 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } + mcs = UE_list->UE_template[CC_id][UE_id].mcs[harq_pid]; + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); + if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -296,6 +297,7 @@ schedule_ue_spec_default( while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + if((j == frame_parms[CC_id]->N_RBG-1) && ((frame_parms[CC_id]->N_RB_DL == 25)|| (frame_parms[CC_id]->N_RB_DL == 50))) { @@ -316,21 +318,20 @@ schedule_ue_spec_default( for(j=0; jN_RBG; j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } - for(i=0; ilte_frame_parms.N_RBG; i++) { - rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; - } - // Keep the old NDI, do not toggle ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - tpc = 1; - + tpc = UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid]; + UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs; + ue_has_transmission = 1; num_ues_added++; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); + ue_has_transmission = 0; } //End of retransmission } else { /* This is a potentially new SDU opportunity */ @@ -516,7 +517,6 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); @@ -572,6 +572,9 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]= 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs; + UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid] = tpc; + // Increase the pointer for the number of scheduled UEs num_ues_added++; ue_has_transmission = 1; From d4fd08785de065bada51f123b379bb2ccd7ba1a7 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 14:51:00 +0100 Subject: [PATCH 130/182] Modified eNB conf file for USRP to use 50 rbs --- .../CONF/enb.band5.agent.usrpb210.epc.remote.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index 8936b2eb24..59aec03872 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -30,7 +30,7 @@ eNBs = downlink_frequency = 879000000L; uplink_frequency_offset = -45000000; Nid_cell = 0; - N_RB_DL = 25; + N_RB_DL = 50; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; nb_antennas_rx = 1; @@ -131,24 +131,24 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.103"; + mme_ip_address = ( {ipv4 = "192.168.100.102"; ipv6="192:168:30::17"; active="yes"; preference="ipv4";}); NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; ENB_AGENT_PORT = 2210; ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; From 673ef5fa7a8748bc2553834f2b1ed3c1bc41c3b2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 15:13:15 +0100 Subject: [PATCH 131/182] Modified active harq reporting mechanism to support long schedule ahead of time values --- openair1/SCHED/defs.h | 5 + openair1/SCHED/phy_procedures_lte_eNb.c | 109 +++++++++++++++------- openair2/ENB_APP/enb_agent_common.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/MAC/pre_processor.c | 4 +- 6 files changed, 84 insertions(+), 41 deletions(-) diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index 8692a31f12..72830f35cb 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -81,6 +81,11 @@ enum openair_SYNCH_STATUS { openair_SCHED_EXIT }; +enum openair_HARQ_TYPE { + openair_harq_DL = 0, + openair_harq_UL, + openair_harq_RA +}; #define DAQ_AGC_ON 1 #define DAQ_AGC_OFF 0 diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 15cd98881d..ba180e781f 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -29,11 +29,11 @@ /*! \file phy_procedures_lte_eNB.c * \brief Implementation of eNB procedures from 36.213 LTE specifications - * \author R. Knopp, F. Kaltenberger, N. Nikaein + * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas * \date 2011 * \version 0.1 * \company Eurecom - * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk * \note * \warning */ @@ -141,26 +141,23 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_su void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) { - DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->tail_freelist] = harq_pid; - DLSCH_ptr->tail_freelist = (DLSCH_ptr->tail_freelist + 1) % 10; + if (harq_pid >=0 && harq_pid < 8) { + DLSCH_ptr->harq_pid_freelist[harq_pid] = 1; + } else { + LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + abort(); + } } void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) { - if (DLSCH_ptr->head_freelist == DLSCH_ptr->tail_freelist) { - LOG_E(PHY, "%s:%d: you cannot read this!\n", __FILE__, __LINE__); - abort(); - } - /* basic check, in case several threads deal with the free list at the same time - * in normal situations it should not happen, that's also why we don't use any - * locking mechanism to protect the free list - * to be refined in case things don't work properly - */ - if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { + + if (harq_pid >=0 && harq_pid < 8) { + DLSCH_ptr->harq_pid_freelist[harq_pid] = 0; + } else { LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); abort(); } - DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB) @@ -257,12 +254,17 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB) return(-1); } -int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag) +int prev_frame = -1; +int prev_subframe = -1; +int prev_harq_pid = 0; +int prev_harq_round = 0; + +int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t harq_flag) { LTE_eNB_DLSCH_t *DLSCH_ptr; LTE_eNB_ULSCH_t *ULSCH_ptr; uint8_t ulsch_subframe,ulsch_frame; - uint8_t i; + uint8_t i, j; int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]); int sf1=(10*frame)+subframe,sf2,sfdiff,sfdiff_max=7; @@ -272,39 +274,74 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 return(-1); } - if (ul_flag == 0) {// this is a DL request + if ((harq_flag == openair_harq_DL) || (harq_flag == openair_harq_RA)) {// this is a DL request + DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][0]; + if (harq_flag == openair_harq_RA) { + if (DLSCH_ptr->harq_processes[0] != NULL) { + *harq_pid = 0; + *round = DLSCH_ptr->harq_processes[0]->round; + return 0; + } else { + return -1; + } + } + + if (prev_frame == frame && prev_subframe == subframe) { + *harq_pid = prev_harq_pid; + *round = prev_harq_round; + return (0); + } + // set to no available process first *harq_pid = -1; - for (i=0; iMdlharq; i++) { - if (DLSCH_ptr->harq_processes[i]!=NULL) { - if (DLSCH_ptr->harq_processes[i]->status == ACTIVE) { - sf2 = (DLSCH_ptr->harq_processes[i]->frame*10) + DLSCH_ptr->harq_processes[i]->subframe; - if (sf2<=sf1) - sfdiff = sf1-sf2; - else // this happens when wrapping around 1024 frame barrier - sfdiff = 10240 + sf1-sf2; - LOG_D(PHY,"process %d is active, round %d (waiting %d)\n",i,DLSCH_ptr->harq_processes[i]->round,sfdiff); + j = prev_harq_pid; - if (sfdiff>sfdiff_max) { // this is an active process that is waiting longer than the others (and longer than 7 ms) - sfdiff_max = sfdiff; - *harq_pid = i; - *round = DLSCH_ptr->harq_processes[i]->round; + for (i = 0; i < 8; i++) { + j = (j + 1) % 8; + if (DLSCH_ptr->harq_processes[j] != NULL) { + if (DLSCH_ptr->harq_processes[j]->status == ACTIVE) { + sf2 = (DLSCH_ptr->harq_processes[j]->frame*10) + DLSCH_ptr->harq_processes[j]->subframe; + if (sf2<=sf1) { + sfdiff = sf1-sf2; + } else { // this happens when wrapping around 1024 frame barrier + sfdiff = 10240 + sf1-sf2; + } + LOG_D(PHY,"process %d is active, round %d (waiting %d)\n",i,DLSCH_ptr->harq_processes[j]->round,sfdiff); + if (sfdiff > sfdiff_max) { + prev_harq_pid = j; + prev_harq_round = DLSCH_ptr->harq_processes[j]->round; + prev_frame = frame; + prev_subframe = subframe; + *harq_pid = j; + *round = DLSCH_ptr->harq_processes[j]->round; + LOG_D(PHY,"process %d, %d is the allocated process\n", *harq_pid, *round); + return 0; + } + } else { // Send from the freelist + if (DLSCH_ptr->harq_pid_freelist[j] == 1) { + *harq_pid = j; + *round = 0; + prev_harq_pid = *harq_pid; + prev_harq_round = *round; + prev_frame = frame; + prev_subframe = subframe; + LOG_D(PHY,"process %d is first free process\n", *harq_pid); + return 0; } } - } else { // a process is not defined + } else { LOG_E(PHY,"[eNB %d] DLSCH process %d for rnti %x (UE_id %d) not allocated\n",Mod_id,i,rnti,UE_id); return(-1); } } - /* if no active harq pid, get the oldest in the freelist, if any */ - if (*harq_pid == 255 && DLSCH_ptr->head_freelist != DLSCH_ptr->tail_freelist) { - *harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; + if (*harq_pid == 255) { *round = 0; - LOG_D(PHY,"process %d is first free process\n", *harq_pid); + LOG_I(PHY, "TEST, no process found\n"); + return -1; } LOG_D(PHY,"get_ue_active_harq_pid DL => Frame %d, Subframe %d : harq_pid %d\n", diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index e21c180cec..e3c2bcfcb5 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -43,6 +43,7 @@ #include "PHY/extern.h" #include "log.h" +#include "SCHED/defs.h" #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" @@ -671,7 +672,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i uint16_t rnti = get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); *id = harq_pid; if (round > 0) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 8cb6b91301..a4b7339677 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -661,7 +661,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 was acknowledged: \n", module_idP,CC_id,frameP,subframeP); // Get candidate harq_pid from PHY - mac_xface->get_ue_active_harq_pid(module_idP,CC_id,RA_template->rnti,frameP,subframeP,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(module_idP,CC_id,RA_template->rnti,frameP,subframeP,&harq_pid,&round,openair_harq_RA); if (round>0) { //RA_template->wait_ack_Msg4++; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index e6033d5057..17a8cec5db 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -753,7 +753,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; UE_template = &UE_list->UE_template[CC_id][UE_id]; - if (mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1) == -1 ) { + if (mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL) == -1 ) { LOG_W(MAC,"[eNB %d] Scheduler Frame %d, subframeP %d: candidate harq_pid from PHY for UE %d CC %d RNTI %x\n", module_idP,frameP,subframeP, UE_id, CC_id, rnti); // NN --> RK: Don't schedule UE if we cannot get harq pid diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index c744d1d90a..64ae2d9453 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -760,7 +760,7 @@ void dlsch_scheduler_pre_processor_reset (int module_idP, frameP,subframeP, &ue_sched_ctl->harq_pid[CC_id], &ue_sched_ctl->round[CC_id], - 0); + openair_harq_DL); if (ue_sched_ctl->ta_timer == 0) { // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ... @@ -1020,7 +1020,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, // This is the actual CC_id in the list CC_id = UE_list->ordered_ULCCids[n][UE_id]; - mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1); + mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL); if(round>0) { nb_allocated_rbs[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb_ul[harq_pid]; From bad4b7940a3ee92c281c9e87951ab17c3e4da1c1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Apr 2016 12:17:36 +0100 Subject: [PATCH 132/182] Fixed bug when delegating control when delegated lib was previously NULL --- openair2/ENB_APP/enb_agent_mac_internal.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index aa7482bd90..4d5ba34610 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -579,25 +579,25 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { switch (event.type) { case YAML_SEQUENCE_START_EVENT: - LOG_I(ENB_APP, "A sequence just started as expected\n"); + LOG_D(ENB_APP, "A sequence just started as expected\n"); sequence_started = 1; break; case YAML_SEQUENCE_END_EVENT: - LOG_I(ENB_APP, "A sequence ended\n"); + LOG_D(ENB_APP, "A sequence ended\n"); sequence_started = 0; break; case YAML_MAPPING_START_EVENT: if (!sequence_started) { goto error; } - LOG_I(ENB_APP, "A mapping started\n"); + LOG_D(ENB_APP, "A mapping started\n"); mapping_started = 1; break; case YAML_MAPPING_END_EVENT: if (!mapping_started) { goto error; } - LOG_I(ENB_APP, "A mapping ended\n"); + LOG_D(ENB_APP, "A mapping ended\n"); mapping_started = 0; break; case YAML_SCALAR_EVENT: @@ -606,15 +606,15 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { } // Check the types of subsystems offered and handle their values accordingly if (strcmp(event.data.scalar.value, "dl_scheduler") == 0) { - LOG_I(ENB_APP, "This is for the dl_scheduler subsystem\n"); + LOG_D(ENB_APP, "This is for the dl_scheduler subsystem\n"); // Call the proper handler if (parse_dl_scheduler_config(mod_id, parser) == -1) { - LOG_I(ENB_APP, "An error occured\n"); + LOG_D(ENB_APP, "An error occured\n"); goto error; } } else if (strcmp(event.data.scalar.value, "ul_scheduler") == 0) { // Call the proper handler - LOG_I(ENB_APP, "This is for the ul_scheduler subsystem\n"); + LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n"); goto error; // TODO } else if (strcmp(event.data.scalar.value, "ra_scheduler") == 0) { @@ -674,7 +674,7 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { } // Check what key needs to be set if (strcmp(event.data.scalar.value, "behavior") == 0) { - LOG_D(ENB_APP, "Time to set the behavior attribute\n"); + LOG_I(ENB_APP, "Time to set the behavior attribute\n"); yaml_event_delete(&event); if (!yaml_parser_parse(parser, &event)) { goto error; @@ -682,7 +682,7 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { if (event.type == YAML_SCALAR_EVENT) { if (load_dl_scheduler_function(mod_id, event.data.scalar.value) == -1) { goto error; - } + } } else { goto error; } @@ -768,7 +768,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { char lib_name[120]; char target[512]; - sprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); + snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); strcpy(target, local_cache); strcat(target, lib_name); @@ -781,7 +781,9 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { if (loaded_scheduler) { if (mac_agent_registered[mod_id]) { agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; - dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { + dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + } agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); } From bcea7d591761b476ec7ceff829486bf0cfbc2c00 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 18 Apr 2016 13:05:36 +0100 Subject: [PATCH 133/182] Fixed local scheduler bug when scheduling multiple UEs --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 79716af854..655c60cc70 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -213,6 +213,8 @@ schedule_ue_spec_default( set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } + channels_added = 0; + // After this point all the UEs will be scheduled dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); protocol__prp_dl_data__init(dl_data[num_ues_added]); From 59ba6f9e7bc7725c502e6808a021d89742ec9704 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 20 Apr 2016 13:41:49 +0100 Subject: [PATCH 134/182] Made config changes for remote scheduler and eNB --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 2 +- .../CONF/enb.band5.agent.usrpb210.epc.remote.conf | 2 +- .../CONF/enb.band7.agent.usrpb210.epc.remote.conf | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index c636ec0d95..7d2c2cbc6f 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -51,7 +51,7 @@ // Maximum value of schedule ahead of time // Required to identify if a dl_command is for the future or not -#define SCHED_AHEAD_SUBFRAMES 10 +#define SCHED_AHEAD_SUBFRAMES 20 typedef struct dl_mac_config_element_s { Protocol__ProgranMessage *dl_info; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index 59aec03872..e8bb16f2c8 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -30,7 +30,7 @@ eNBs = downlink_frequency = 879000000L; uplink_frequency_offset = -45000000; Nid_cell = 0; - N_RB_DL = 50; + N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; nb_antennas_rx = 1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf index 4f6a3ba101..6e4764be2d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf @@ -129,24 +129,24 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.103"; + mme_ip_address = ( {ipv4 = "192.168.100.102"; ipv6="192:168:30::17"; active="yes"; preference="ipv4";}); NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; ENB_AGENT_PORT = 2210; ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; From 104ed9ade1634286bb981810dd38599b72b14d64 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 25 Apr 2016 17:09:53 +0100 Subject: [PATCH 135/182] Added fixes for multiple eNBs and simulation mode --- openair2/ENB_APP/enb_agent_common.c | 17 ++++----- openair2/RRC/LITE/rrc_eNB.c | 15 +++++--- openair2/UTIL/OTG/otg_tx.c | 5 ++- targets/SIMU/USER/oaisim.c | 5 +-- targets/SIMU/USER/oaisim_functions.c | 55 ++++++++++++++-------------- 5 files changed, 50 insertions(+), 47 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index e3c2bcfcb5..1e477c6c3c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1418,6 +1418,9 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } + //TODO: Set index of primary cell + 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; @@ -1425,9 +1428,6 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set cross carrier scheduling support (boolean) config->has_cross_carrier_sched_support = 1; config->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - config->has_pcell_carrier_index = 1; - config->pcell_carrier_index = 1; //TODO: Set secondary cells configuration // We do not set it for now. No carrier aggregation support @@ -1754,16 +1754,15 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; + //TODO: Set index of primary cell + 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 = 1; ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; //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 = 1; ue_config[i]->scell_deactivation_timer = 1; @@ -1874,9 +1873,9 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr protocol__prp_cell_config__init(cell_conf[i]); //TODO: Fill in with actual value, the PCI of this cell cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); //TODO: Fill in with actual value, the PLMN cell id of this cell - cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; //TODO: Fill in with actual value, PUSCH resources in RBs for hopping cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index ed8d4cd850..4c0bb3f5c8 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -644,6 +644,9 @@ void rrc_eNB_emulation_notify_ue_module_id( // find enb_module_id for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { + if(enb_module_id>1){ /*FIX LATER*/ + return; + } for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1 != NULL) { if ( @@ -652,7 +655,6 @@ void rrc_eNB_emulation_notify_ue_module_id( (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) ) { - oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; ue_context_p = rrc_eNB_get_ue_context( &eNB_rrc_inst[enb_module_id], rntiP @@ -662,10 +664,11 @@ void rrc_eNB_emulation_notify_ue_module_id( oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; } - return; + //return; } } } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; } AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, @@ -4026,8 +4029,8 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \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 (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); } @@ -4116,8 +4119,8 @@ rrc_eNB_decode_dcch( 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 (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); } diff --git a/openair2/UTIL/OTG/otg_tx.c b/openair2/UTIL/OTG/otg_tx.c index e70bccbc73..ea5fad63dc 100644 --- a/openair2/UTIL/OTG/otg_tx.c +++ b/openair2/UTIL/OTG/otg_tx.c @@ -270,13 +270,14 @@ unsigned char *packet_gen( char *header=NULL; int header_size = 0; - + //LOG_I(OTG,"Src: %d - Dest: %d - before exit\n",src_instance,dst_instance); // check if the app is configured if (app >= g_otg->application_idx[src_instance][dst_instance]) { + //LOG_I(OTG,"Src: %d - Dest: %d - no packet to generate - no application\n",src_instance,dst_instance); return NULL; } - LOG_T(OTG,"[src %d] [dst %d ][APP %d] current time %d\n",src_instance, dst_instance, app, ctime); + //LOG_I(OTG,"[src %d] [dst %d ][APP %d] current time %d\n",src_instance, dst_instance, app, ctime); *pkt_size=0; init_packet_gen(src_instance, dst_instance,ctime); diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 995516b6e8..c574527f62 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -498,7 +498,6 @@ l2l1_task (void *args_p) xargv[0] = xname; fl_initialize (&xargc, xargv, NULL, 0, 0); eNB_inst = 0; - for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) { for (CC_id=0;CC_id>1, 0); pdcp_run (&ctxt); #endif @@ -857,7 +856,7 @@ l2l1_task (void *args_p) CC_id++) { phy_procedures_UE_lte ( PHY_vars_UE_g[UE_inst][CC_id], - 0, abstraction_flag, + 0, abstraction_flag, normal_txrx, no_relay, NULL); } diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 72153c3ee7..9a072ea2c4 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1326,13 +1326,11 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) // generate traffic if the ue is rrc reconfigured state //if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 /*RRC_CONNECTED*/ ) { if (mac_eNB_get_rrc_status(enb_module_idP, oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_idP][dst_id]) > 2 ){ - if_times += 1; for (app_id=0; app_idotg_pkt).sdu_buffer = (uint8_t*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { @@ -1459,6 +1457,7 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime) { #if defined(USER_MODE) && defined(OAI_EMU) + int app_id; if (oai_emulation.info.otg_enabled ==1 ) { module_id_t dst_id, src_id; //dst_id = eNB_index module_id_t module_id = ue_mod_idP+NB_eNB_INST; @@ -1468,31 +1467,33 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime) for (dst_id=0; dst_id 2 /*RRC_CONNECTED*/) { - Packet_otg_elt_t *otg_pkt = malloc (sizeof(Packet_otg_elt_t)); - - if (otg_pkt!=NULL) - memset(otg_pkt,0,sizeof(Packet_otg_elt_t)); - else { - LOG_E(OTG,"not enough memory\n"); - exit(-1); - }// Manage to add this packet to the tail of your list - - (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, 0, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); - - if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { - (otg_pkt->otg_pkt).rb_id = DTCH-2; - (otg_pkt->otg_pkt).module_id = module_id; - (otg_pkt->otg_pkt).dst_id = dst_id; - (otg_pkt->otg_pkt).is_ue = 1; - //Adding the packet to the OTG-PDCP buffer - (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA; - pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id])); - LOG_I(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n", - (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); - } else { - free(otg_pkt); - otg_pkt=NULL; - } + for (app_id=0; app_idotg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); + + if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { + (otg_pkt->otg_pkt).rb_id = DTCH-2; + (otg_pkt->otg_pkt).module_id = module_id; + (otg_pkt->otg_pkt).dst_id = dst_id; + (otg_pkt->otg_pkt).is_ue = 1; + //Adding the packet to the OTG-PDCP buffer + (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA; + pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id])); + LOG_I(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n", + (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); + } else { + free(otg_pkt); + otg_pkt=NULL; + } + } } } } From 07d30b2288fdb6e296231e77c2acdf61135a81f5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 23 Apr 2016 10:21:42 +0100 Subject: [PATCH 136/182] Fixed bug in the number of eNBs for the simulations --- openair2/ENB_APP/enb_app.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 63f071c743..dc21448aef 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -294,7 +294,7 @@ void *eNB_app_task(void *args_p) itti_mark_task_ready (TASK_ENB_APP); -# if defined(ENABLE_USE_MME) + # if defined(ENABLE_ITTI) # if defined(OAI_EMU) enb_nb = oai_emulation.info.nb_enb_local; enb_id_start = oai_emulation.info.first_enb_local; @@ -304,7 +304,7 @@ void *eNB_app_task(void *args_p) "Last eNB index is greater or equal to maximum eNB index (%d/%d)!", enb_id_end, NUMBER_OF_eNB_MAX); # endif -# endif + # endif enb_properties_p = enb_config_get(); From b9c92931440fd8c13c597c056b2eadbaefa92af6 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 23 Apr 2016 01:32:03 +0100 Subject: [PATCH 137/182] Added support for multiple eNBs --- openair2/ENB_APP/enb_agent.c | 28 +- openair2/ENB_APP/enb_agent_common.c | 7 +- .../CONF/enb.band7.agent.oaisim.2.enb.conf | 302 ++++++++++++++++++ 3 files changed, 325 insertions(+), 12 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 675272a2f4..6a9bcad878 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -59,13 +59,15 @@ void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); Protocol__ProgranMessage *enb_agent_timeout(void* args); + +int agent_task_created = 0; /* * 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 *enb_agent_task(void *args){ - enb_agent_instance_t *d = (enb_agent_instance_t *) args; + //enb_agent_instance_t *d = (enb_agent_instance_t *) args; Protocol__ProgranMessage *msg; void *data; int size; @@ -76,7 +78,7 @@ void *enb_agent_task(void *args){ const char *msg_name = NULL; instance_t instance; int result; - + struct enb_agent_timer_element_s * elem = NULL; itti_mark_task_ready(TASK_ENB_AGENT); @@ -100,7 +102,8 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); + if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } @@ -203,6 +206,7 @@ pthread_t new_thread(void *(*f)(void *), void *b) { return t; } +int channel_container_init = 0; int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; @@ -240,8 +244,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * Initialize the channel container */ - enb_agent_init_channel_container(); - + if (!channel_container_init) { + enb_agent_init_channel_container(); + channel_container_init = 1; + } /*Create the async channel info*/ enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); @@ -294,12 +300,14 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * start the enb agent task for tx and interaction with the underlying network function */ + if (!agent_task_created) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { + LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + agent_task_created = 1; + } - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { - LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); - return -1; - } - LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1e477c6c3c..1f4508f750 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -2090,11 +2090,14 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; +int agent_timer_init = 0; err_code_t enb_agent_init_timer(void){ LOG_I(ENB_AGENT, "init RB tree\n"); - - RB_INIT(&timer_instance.enb_agent_head); + if (!agent_timer_init) { + RB_INIT(&timer_instance.enb_agent_head); + agent_timer_init = 1; + } /* struct enb_agent_timer_element_s e; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf new file mode 100644 index 0000000000..c792961a18 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf @@ -0,0 +1,302 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox1", "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0x00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + 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 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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 = 2; + rach_preambleInitialReceivedTargetPower = -100; + 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; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.102"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + }, + + { + ////////// Identification parameters: + eNB_ID = 0x01; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox1"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 10; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + 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 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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 = 2; + rach_preambleInitialReceivedTargetPower = -100; + 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; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.102"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:2"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.104/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth2:2"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.104/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From 71c047d1aefbcea25f6a33b749da7573bc8db239 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 29 Jun 2016 12:32:19 +0300 Subject: [PATCH 138/182] Revert to single eNodeB for simulation --- openair2/RRC/LITE/rrc_eNB.c | 4619 +++++++++++++++++++++++++++++++++++ 1 file changed, 4619 insertions(+) create mode 100644 openair2/RRC/LITE/rrc_eNB.c diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c new file mode 100644 index 0000000000..804bc8aa21 --- /dev/null +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -0,0 +1,4619 @@ +/******************************************************************************* + 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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file rrc_eNB.c + * \brief rrc procedures for eNB + * \author Navid Nikaein and Raymond Knopp + * \date 2011 - 2014 + * \version 1.0 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr + */ +#define RRC_ENB +#define RRC_ENB_C + +#include "defs.h" +#include "extern.h" +#include "assertions.h" +#include "asn1_conversions.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "LAYER2/RLC/rlc.h" +#include "LAYER2/MAC/proto.h" +#include "UTIL/LOG/log.h" +#include "COMMON/mac_rrc_primitives.h" +#include "RRC/LITE/MESSAGES/asn1_msg.h" +#include "RRCConnectionRequest.h" +#include "RRCConnectionReestablishmentRequest.h" +//#include "ReestablishmentCause.h" +#include "UL-CCCH-Message.h" +#include "DL-CCCH-Message.h" +#include "UL-DCCH-Message.h" +#include "DL-DCCH-Message.h" +#include "TDD-Config.h" +#include "HandoverCommand.h" +#include "rlc.h" +#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "rrc_eNB_UE_context.h" +#include "platform_types.h" +#include "msc.h" + +#include "T.h" + +//#ifdef Rel10 +#include "MeasResults.h" +//#endif + +#ifdef USER_MODE +# include "RRC/NAS/nas_config.h" +# include "RRC/NAS/rb_config.h" +# include "OCG.h" +# include "OCG_extern.h" +#endif + +#if defined(ENABLE_SECURITY) +# include "UTIL/OSA/osa_defs.h" +#endif + +#if defined(ENABLE_USE_MME) +# include "rrc_eNB_S1AP.h" +# include "rrc_eNB_GTPV1U.h" +# if defined(ENABLE_ITTI) +# else +# include "../../S1AP/s1ap_eNB.h" +# endif +#endif + +#include "pdcp.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#if ENABLE_RAL +# include "rrc_eNB_ral.h" +#endif + +#include "SIMULATION/TOOLS/defs.h" // for taus + +#include "enb_agent_extern.h" + +//#define XER_PRINT + +#ifdef PHY_EMUL +extern EMULATION_VARS *Emul_vars; +#endif +extern eNB_MAC_INST *eNB_mac_inst; +extern UE_MAC_INST *UE_mac_inst; +#ifdef BIGPHYSAREA +extern void* bigphys_malloc(int); +#endif + +extern uint16_t two_tier_hexagonal_cellIds[7]; + +/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ +static const uint8_t RRC_TRANSACTION_IDENTIFIER_NUMBER = 4; + +mui_t rrc_eNB_mui = 0; + +//----------------------------------------------------------------------------- +static void +init_SI( + const protocol_ctxt_t* const ctxt_pP, + const int CC_id +#if defined(ENABLE_ITTI) + , + RrcConfigurationReq * configuration +#endif +) +//----------------------------------------------------------------------------- +{ + uint8_t SIwindowsize = 1; + uint16_t SIperiod = 8; +#ifdef Rel10 + int i; +#endif + /* + uint32_t mib=0; + int i; + int N_RB_DL,phich_resource; + + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,0x321,&mib); + + for (i=0;i<1024;i+=4) + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,i,&mib); + + N_RB_DL=6; + while (N_RB_DL != 0) { + phich_resource = 1; + while (phich_resource != 0) { + for (i=0;i<2;i++) { + mac_xface->lte_frame_parms->N_RB_DL = N_RB_DL; + mac_xface->lte_frame_parms->phich_config_common.phich_duration=i; + mac_xface->lte_frame_parms->phich_config_common.phich_resource = phich_resource; + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,0,&mib); + } + if (phich_resource == 1) + phich_resource = 3; + else if (phich_resource == 3) + phich_resource = 6; + else if (phich_resource == 6) + phich_resource = 12; + else if (phich_resource == 12) + phich_resource = 0; + } + if (N_RB_DL == 6) + N_RB_DL = 15; + else if (N_RB_DL == 15) + N_RB_DL = 25; + else if (N_RB_DL == 25) + N_RB_DL = 50; + else if (N_RB_DL == 50) + N_RB_DL = 75; + else if (N_RB_DL == 75) + N_RB_DL = 100; + else if (N_RB_DL == 100) + N_RB_DL = 0; + } + exit(-1); + */ + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = 0; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 = 0; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); + + /* + printf ("before SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("before SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1) + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = do_SIB1( + ctxt_pP->module_id, + CC_id, + mac_xface->lte_frame_parms, + (uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].siblock1, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib1 +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + mac_xface->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB1 allocated"); + } + + /* + printf ("after SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("after SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 == 255) { + mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); + } + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23) { + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 = do_SIB23( + ctxt_pP->module_id, + CC_id, + mac_xface->lte_frame_parms, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].systemInformation, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib3 +#ifdef Rel10 + , &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag +#endif +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + + /* + eNB_rrc_inst[ctxt_pP->module_id].sizeof_SIB23 = do_SIB2_AT4(ctxt_pP->module_id, + eNB_rrc_inst[ctxt_pP->module_id].SIB23, + &eNB_rrc_inst[ctxt_pP->module_id].systemInformation, + &eNB_rrc_inst[ctxt_pP->module_id].sib2, + #if defined(ENABLE_ITTI) + , configuration + #endif + ); + */ + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 == 255) { + mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst[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), + eNB_rrc_inst[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), + eNB_rrc_inst[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), + eNB_rrc_inst[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)eNB_rrc_inst[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)eNB_rrc_inst[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), + eNB_rrc_inst[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)eNB_rrc_inst[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), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); + +#ifdef Rel10 + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag > 0) { + for (i = 0; i < eNB_rrc_inst[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, eNB_rrc_inst[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, + eNB_rrc_inst[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", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[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", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[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", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + } + + // SIB13 + for (i = 0; i < eNB_rrc_inst[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/2 (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %d (just index number, not real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[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: %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + } + } + +#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)); + rrc_mac_config_req(ctxt_pP->module_id, CC_id, ENB_FLAG_YES, 0, 0, + (RadioResourceConfigCommonSIB_t *) & + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon, + (struct PhysicalConfigDedicated *)NULL, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib1->tdd_Config, + NULL, + &SIwindowsize, &SIperiod, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.ul_CarrierFreq, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.ul_Bandwidth, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList +#ifdef Rel10 + , + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag, + (MBSFN_AreaInfoList_r9_t*) & eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, //eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, + 0 //eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB2/3 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + mac_xface->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB2/3 allocated"); + } +} + +#ifdef Rel10 +/*------------------------------------------------------------------------------*/ +static void +init_MCCH( + module_id_t enb_mod_idP, + int CC_id +) +//----------------------------------------------------------------------------- +{ + + int sync_area = 0; + // initialize RRC_eNB_INST MCCH entry + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE = + malloc(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); + + for (sync_area = 0; sync_area < eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area; sync_area++) { + + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area] == NULL) { + LOG_E(RRC, "[eNB %d][MAIN] init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); + mac_xface->macphy_exit("[RRC][init_MCCH] not enough memory\n"); + } else { + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, + mac_xface->lte_frame_parms, + sync_area, + (uint8_t *)eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area], + &eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch, + &eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message); + + LOG_I(RRC, "mcch message pointer %p for sync area %d \n", + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area], + sync_area); + LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); + LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %d\n", enb_mod_idP, + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); + LOG_D(RRC, + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + enb_mod_idP, eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); + LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", + enb_mod_idP, + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. + choice.oneFrame.buf[0]); + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255) { + mac_xface->macphy_exit("[RRC][init_MCCH] eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); + } else { + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESS[sync_area].Active = 1; + } + } + } + + //Set the eNB_rrc_inst[enb_mod_idP].MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) + + // ??Configure MCCH logical channel + // call mac_config_req with appropriate structure from ASN.1 description + + // LOG_I(RRC, "DUY: serviceID is %d\n",eNB_rrc_inst[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",eNB_rrc_inst[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_mod_idP, CC_id, ENB_FLAG_YES, 0, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + (struct PhysicalConfigDedicated *)NULL, +#ifdef Rel10 + (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, + NULL, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +# ifdef Rel10 + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif +# ifdef CBA + , 0, 0 +# endif + ); + + //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",eNB_rrc_inst[enb_mod_idP].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); + +} + +//----------------------------------------------------------------------------- +static void init_MBMS( + module_id_t enb_mod_idP, + int CC_id, + frame_t frameP +) +//----------------------------------------------------------------------------- +{ + // init the configuration for MTCH + protocol_ctxt_t ctxt; + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MBMS_flag > 0) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); + + LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid + // Configuring PDCP and RLC for MBMS Radio Bearer + + rrc_pdcp_config_asn1_req(&ctxt, + (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList + (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList + (DRB_ToReleaseList_t *)NULL, + 0, // security mode + NULL, // key rrc encryption + NULL, // key rrc integrity + NULL // key encryption +# ifdef Rel10 + , &(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif + ); + + rrc_rlc_config_asn1_req(&ctxt, + NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + NULL, // DRB_ToReleaseList + &(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9)); + + //rrc_mac_config_req(); + } +} +#endif + +//----------------------------------------------------------------------------- +uint8_t +rrc_eNB_get_next_transaction_identifier( + module_id_t enb_mod_idP +) +//----------------------------------------------------------------------------- +{ + static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX]; + rrc_transaction_identifier[enb_mod_idP] = (rrc_transaction_identifier[enb_mod_idP] + 1) % RRC_TRANSACTION_IDENTIFIER_NUMBER; + return rrc_transaction_identifier[enb_mod_idP]; +} +/*------------------------------------------------------------------------------*/ +/* Functions to handle UE index in eNB UE list */ + + +////----------------------------------------------------------------------------- +//static module_id_t +//rrc_eNB_get_UE_index( +// module_id_t enb_mod_idP, +// uint64_t UE_identity +//) +////----------------------------------------------------------------------------- +//{ +// +// boolean_t reg = FALSE; +// module_id_t i; +// +// AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); +// +// for (i = 0; i < NUMBER_OF_UE_MAX; i++) { +// if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) { +// // UE_identity already registered +// reg = TRUE; +// break; +// } +// } +// +// if (reg == FALSE) { +// return (UE_MODULE_INVALID); +// } else +// return (i); +//} + + +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with ue_identityP, NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_random_exist( + const protocol_ctxt_t* const ctxt_pP, + const uint64_t ue_identityP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) + return ue_context_p; + } + return NULL; +} +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_stmsi_exist( + const protocol_ctxt_t* const ctxt_pP, + const mme_code_t mme_codeP, + const m_tmsi_t m_tmsiP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", + m_tmsiP, mme_codeP, ue_context_p, + ue_context_p->ue_context.rnti); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + printf("S-TMSI %x, MME %x\n", + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) + return ue_context_p; + } + else + printf("\n"); + + } + return NULL; +} + +//----------------------------------------------------------------------------- +// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection +static 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 +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p == NULL) { + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) { + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%x, uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_identityP, + ue_context_p->local_uid); + return NULL; + } + } + ue_context_p = rrc_eNB_allocate_new_UE_context(&eNB_rrc_inst[ctxt_pP->module_id]); + + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } + + ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else + ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed + ue_context_p->ue_context.random_ue_identity = ue_identityP; + RB_INSERT(rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head, ue_context_p); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Created new UE context uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->local_uid); + return ue_context_p; + + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } +} + +#if !defined(ENABLE_USE_MME) +void rrc_eNB_emulation_notify_ue_module_id( + const module_id_t ue_module_idP, + const rnti_t rntiP, + const uint8_t cell_identity_byte0P, + const uint8_t cell_identity_byte1P, + const uint8_t cell_identity_byte2P, + const uint8_t cell_identity_byte3P) +{ + module_id_t enb_module_id; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + int CC_id; + + // find enb_module_id + for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { + if(enb_module_id>0){ /*FIX LATER*/ + return; + } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + if (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1 != NULL) { + if ( + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) + ) { + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[enb_module_id], + rntiP + ); + + if (NULL != ue_context_p) { + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; + } + + //return; + } + } + } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; + } + + AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, + "Cell identity not found for ue module id %u rnti %x", + ue_module_idP, rntiP); +} +#endif + +//----------------------------------------------------------------------------- +void +rrc_eNB_free_mem_UE_context( + const protocol_ctxt_t* const ctxt_pP, + struct rrc_eNB_ue_context_s* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + int i; + LOG_T(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%x (free internal structs)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_pP); +#ifdef Rel10 + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); +#endif + + if (ue_context_pP->ue_context.SRB_configList) { + ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); + ue_context_pP->ue_context.SRB_configList = NULL; + } + + if (ue_context_pP->ue_context.DRB_configList) { + ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); + ue_context_pP->ue_context.DRB_configList = NULL; + } + + memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); + + if (ue_context_pP->ue_context.physicalConfigDedicated) { + ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); + ue_context_pP->ue_context.physicalConfigDedicated = NULL; + } + + if (ue_context_pP->ue_context.sps_Config) { + ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config); + ue_context_pP->ue_context.sps_Config = NULL; + } + + for (i=0; i < MAX_MEAS_OBJ; i++) { + if (ue_context_pP->ue_context.MeasObj[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); + ue_context_pP->ue_context.MeasObj[i] = NULL; + } + } + + for (i=0; i < MAX_MEAS_CONFIG; i++) { + if (ue_context_pP->ue_context.ReportConfig[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); + ue_context_pP->ue_context.ReportConfig[i] = NULL; + } + } + + if (ue_context_pP->ue_context.QuantityConfig) { + ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); + ue_context_pP->ue_context.QuantityConfig = NULL; + } + + if (ue_context_pP->ue_context.mac_MainConfig) { + ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); + ue_context_pP->ue_context.mac_MainConfig = NULL; + } + + if (ue_context_pP->ue_context.measGapConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); + ue_context_pP->ue_context.measGapConfig = NULL; + } + + //SRB_INFO SI; + //SRB_INFO Srb0; + //SRB_INFO_TABLE_ENTRY Srb1; + //SRB_INFO_TABLE_ENTRY Srb2; + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + //HANDOVER_INFO *handover_info; +#if defined(ENABLE_SECURITY) + //uint8_t kenb[32]; +#endif + //e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm; + //e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + //uint8_t Status; + //rnti_t rnti; + //uint64_t random_ue_identity; +#if defined(ENABLE_ITTI) + //UE_S_TMSI Initialue_identity_s_TMSI; + //EstablishmentCause_t establishment_cause; + //ReestablishmentCause_t reestablishment_cause; + //uint16_t ue_initial_id; + //uint32_t eNB_ue_s1ap_id :24; + //security_capabilities_t security_capabilities; + //uint8_t nb_of_e_rabs; + //e_rab_param_t e_rab[S1AP_MAX_E_RAB]; + //uint32_t enb_gtp_teid[S1AP_MAX_E_RAB]; + //transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB]; + //rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB]; +#endif +} + +//----------------------------------------------------------------------------- +// should be called when UE is lost by eNB +void +rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) +//----------------------------------------------------------------------------- +{ + + + protocol_ctxt_t ctxt; +#if !defined(ENABLE_USE_MME) + module_id_t ue_module_id; + /* avoid gcc warnings */ + (void)ue_module_id; +#endif + rnti_t rnti = ue_context_pP->ue_context.rnti; + + + AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); + /* ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[enb_mod_idP], + rntiP + ); + */ + if (NULL != ue_context_pP) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); + LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); + +#if defined(ENABLE_USE_MME) + 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 + /* 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 + * in order to allow the UE to perform the NAS recovery + * procedure, see TS 23.401 [17]. + */ +#else +#if defined(OAI_EMU) + AssertFatal(ue_context_pP->local_uid < NUMBER_OF_UE_MAX, "local_uid invalid (%d<%d) for UE %x!", ue_context_pP->local_uid, NUMBER_OF_UE_MAX, rnti); + ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid]; + AssertFatal(ue_module_id < NUMBER_OF_UE_MAX, "ue_module_id invalid (%d<%d) for UE %x!", ue_module_id, NUMBER_OF_UE_MAX, rnti); + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid] = -1; + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI; +#endif +#endif + + rrc_mac_remove_ue(enb_mod_idP,rnti); + rrc_rlc_remove_ue(&ctxt); + pdcp_remove_UE(&ctxt); + + rrc_eNB_remove_ue_context( + &ctxt, + &eNB_rrc_inst[enb_mod_idP], + (struct rrc_eNB_ue_context_s*) ue_context_pP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionSetupComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete +) +//----------------------------------------------------------------------------- +{ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + // Forward message to S1AP layer + rrc_eNB_send_S1AP_NAS_FIRST_REQ( + ctxt_pP, + ue_context_pP, + rrcConnectionSetupComplete); + } else +#endif + { + // RRC loop back (no S1AP), send SecurityModeCommand to UE + rrc_eNB_generate_SecurityModeCommand( + ctxt_pP, + ue_context_pP); + // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_SecurityModeCommand( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_SecurityModeCommand( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.integrity_algorithm); + +#ifdef RRC_MSG_PRINT + uint16_t i=0; + LOG_F(RRC,"[MSG] RRC Security Mode Command\n"); + + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_UECapabilityEnquiry( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_UECapabilityEnquiry( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + + 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)); + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReject(ctxt_pP->module_id, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReject\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReestablishmentReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + + 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)); + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionRelease( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + + T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + // set release timer + ue_context_pP->ue_context.ue_release_timer=1; + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_defaultRRCConnectionReconfiguration( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state +) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + //eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + //struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t *SRB_configList2 = NULL; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; + + MAC_MainConfig_t *mac_MainConfig = NULL; + MeasObjectToAddModList_t *MeasObj_list = NULL; + MeasObjectToAddMod_t *MeasObj = NULL; + ReportConfigToAddModList_t *ReportConfig_list = NULL; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list = NULL; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if Rel10 + long *sr_ProhibitTimer_r9 = NULL; + // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + //uint8_t sCellIndexToAdd = 0; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + RSRP_Range_t *rsrp = NULL; + struct MeasConfig__speedStatePars *Sparams = NULL; + QuantityConfig_t *quantityConfig = NULL; + CellsToAddMod_t *CellToAdd = NULL; + CellsToAddModList_t *CellsToAddModList = NULL; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + C_RNTI_t *cba_RNTI = NULL; +#ifdef CBA + //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; + uint8_t *cba_RNTI_buf; + cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); + cba_RNTI->buf = cba_RNTI_buf; + cba_RNTI->size = 2; + cba_RNTI->bits_unused = 0; + + // associate UEs to the CBa groups as a function of their UE id + if (rrc_inst->num_active_cba_groups) { + cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D(RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + enb_mod_idP, frameP, + rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], + ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); + } else { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); + } + +#endif + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + // Configure SRB2 + /// SRB2 + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); + memset(SRB_configList2, 0, sizeof(*SRB_configList2)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); + + // Configure DRB + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 + // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + +#ifdef RRC_DEFAULT_RAB_IS_AM + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; +#else + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; +#ifdef CBA + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; +#else + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; +#endif +#endif + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + DRB_pdcp_config->rlc_AM = NULL; + DRB_pdcp_config->rlc_UM = NULL; + + /* avoid gcc warnings */ + (void)PDCP_rlc_AM; + (void)PDCP_rlc_UM; + +#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; +#else + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; +#endif + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#ifdef Rel10 + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz + //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + if (ho_state == 1 /*HO_MEASURMENT */ ) { + LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", + ctxt_pP->module_id, ctxt_pP->frame); + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = + TimeToTrigger_ms40; + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + + rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + *rsrp = 20; + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + LOG_I(RRC, + "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", + ctxt_pP->module_id, ctxt_pP->frame); + // store the information in an intermediate structure for Hanodver management + //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); + ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = SRB_configList2; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = + CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = + CALLOC(1, sizeof(PhysicalConfigDedicated_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); + + } + +#if defined(ENABLE_ITTI) + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + /* Add all NAS PDUs to the list */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + } + + /* TODO parameters yet to process ... */ + { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + } + + /* TODO should test if e RAB are Ok before! */ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + } + +#endif + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + (SRB_ToAddModList_t*)NULL, /// NN: do not reconfig srb1: SRB_configList2, + (DRB_ToAddModList_t*)*DRB_configList, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, +#ifdef EXMIMO_IOT + NULL, NULL, NULL, NULL,NULL, +#else + (struct PhysicalConfigDedicated*)*physicalConfigDedicated, + (MeasObjectToAddModList_t*)MeasObj_list, + (ReportConfigToAddModList_t*)ReportConfig_list, + (QuantityConfig_t*)quantityConfig, + (MeasIdToAddModList_t*)MeasId_list, +#endif + (MAC_MainConfig_t*)mac_MainConfig, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)Sparams, + (RSRP_Range_t*)rsrp, + (C_RNTI_t*)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#ifdef Rel10 + , (SCellToAddMod_r10_t*)NULL +#endif + ); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } + +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + + + +//----------------------------------------------------------------------------- +int +rrc_eNB_generate_RRCConnectionReconfiguration_SCell( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint32_t dl_CarrierFreq_r10 +) +//----------------------------------------------------------------------------- +{ + + uint8_t size; + uint8_t buffer[100]; + +#ifdef Rel10 + uint8_t sCellIndexToAdd = 0; //one SCell so far + + // uint8_t sCellIndexToAdd; + // sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + // if (eNB_rrc_inst[enb_mod_idP].sCell_config[ue_mod_idP][sCellIndexToAdd] ) { + if (ue_context_pP->ue_context.sCell_config != NULL) { + ue_context_pP->ue_context.sCell_config[sCellIndexToAdd].cellIdentification_r10->dl_CarrierFreq_r10 = dl_CarrierFreq_r10; + } else { + LOG_E(RRC,"Scell not configured!\n"); + return(-1); + } + +#endif + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, + (struct SPS_Config*)NULL, + (struct PhysicalConfigDedicated*)NULL, + (MeasObjectToAddModList_t*)NULL, + (ReportConfigToAddModList_t*)NULL, + (QuantityConfig_t*)NULL, + (MeasIdToAddModList_t*)NULL, + (MAC_MainConfig_t*)NULL, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)NULL, + (RSRP_Range_t*)NULL, + (C_RNTI_t*)NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL + +#ifdef Rel10 + , ue_context_pP->ue_context.sCell_config +#endif + ); + LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + return(0); +} + + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_MeasurementReport( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const MeasResults_t* const measResults2 +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n", + ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId); + + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { + LOG_I(RRC, "Physical Cell Id %d\n", + (int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + LOG_I(RRC, "RSRP of Target %d\n", + (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> + measResult.rsrpResult)); + LOG_I(RRC, "RSRQ of Target %d\n", + (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> + measResult.rsrqResult)); + } + +#ifdef Rel10 + LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultPCell.rsrpResult); + LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultPCell.rsrqResult); +#else + LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); + LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); +#endif + + if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { + rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, + ue_context_pP, + measResults2->measResultNeighCells->choice. + measResultListEUTRA.list.array[0]->physCellId); + } else { + LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, + ctxt_pP->rnti); + } + + //Look for IP address of the target eNB + //Send Handover Request -> target eNB + //Wait for Handover Acknowledgement <- target eNB + //Send Handover Command + + //x2delay(); + // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + + // uint8_t buffer[100]; + // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); + // + // send_check_message((char*)buffer,size); + //send_handover_command(); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_HandoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + PhysCellId_t targetPhyId +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; + //uint8_t UE_id_target = -1; + uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); + HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); + /* + uint8_t buffer[100]; + uint8_t size; + struct PhysicalConfigDedicated **physicalConfigDedicated = &eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP]; + RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); + */ + + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value + handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! + + memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); + memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, + (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); + + // FIXME handoverInfo not used... + free( handoverInfo ); + handoverInfo = 0; + + //to be configured + memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, + 0, sizeof(SecurityAlgorithmConfig_t)); + + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = + CALLOC(1, sizeof(ReestablishmentInfo_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = + eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.physCellId; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL; // Check values later + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.size = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.bits_unused = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->additionalReestabInfoList = NULL; + ue_context_pP->ue_context.handover_info->ho_prepare = 0xFF; //0xF0; + ue_context_pP->ue_context.handover_info->ho_complete = 0; + + if (mod_id_target != 0xFF) { + //UE_id_target = rrc_find_free_ue_index(modid_target); + ue_context_target_p = + rrc_eNB_get_ue_context( + &eNB_rrc_inst[mod_id_target], + ue_context_pP->ue_context.rnti); + + /*UE_id_target = rrc_eNB_get_next_free_UE_index( + mod_id_target, + eNB_rrc_inst[ctxt_pP->module_id].Info.UE_list[ue_mod_idP]); //this should return a new index*/ + + if (ue_context_target_p == NULL) { // if not already in target cell + ue_context_target_p = rrc_eNB_allocate_new_UE_context(&eNB_rrc_inst[ctxt_pP->module_id]); + ue_context_target_p->ue_id_rnti = ue_context_pP->ue_context.rnti; // LG: should not be the same + ue_context_target_p->ue_context.rnti = ue_context_target_p->ue_id_rnti; // idem + LOG_N(RRC, + "[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %d: source UE_id %x target UE_id %x source_modId: %d target_modId: %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.physCellId, + targetPhyId, + ue_context_pP->ue_context.rnti, + ue_context_target_p->ue_id_rnti, + ctxt_pP->module_id, + mod_id_target); + ue_context_target_p->ue_context.handover_info = + CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, + (void*)&ue_context_pP->ue_context.handover_info->as_context, + sizeof(AS_Context_t)); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, + (void*)&ue_context_pP->ue_context.handover_info->as_config, + sizeof(AS_Config_t)); + ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; + ue_context_target_p->ue_context.handover_info->ho_complete = 0; + ue_context_pP->ue_context.handover_info->modid_t = mod_id_target; + ue_context_pP->ue_context.handover_info->ueid_s = ue_context_pP->ue_context.rnti; + ue_context_pP->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; + ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; + + } else { + LOG_E(RRC, "\nError in obtaining free UE id in target eNB %l for handover \n", targetPhyId); + } + + } else { + LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_handoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", + ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); + rrc_eNB_generate_RRCConnectionReconfiguration_handover( + ctxt_pP, + ue_context_pP, + NULL, + 0); +} + + +//----------------------------------------------------------------------------- +void +check_handovers( + protocol_ctxt_t* const ctxt_pP +) +//----------------------------------------------------------------------------- +{ + int result; + struct rrc_eNB_ue_context_s* ue_context_p; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head) { + ctxt_pP->rnti = ue_context_p->ue_id_rnti; + + if (ue_context_p->ue_context.handover_info != NULL) { + if (ue_context_p->ue_context.handover_info->ho_prepare == 0xFF) { + LOG_D(RRC, + "[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + // source eNB generates rrcconnectionreconfiguration to prepare the HO + rrc_eNB_process_handoverPreparationInformation( + ctxt_pP, + ue_context_p); + ue_context_p->ue_context.handover_info->ho_prepare = 0xF1; + } + + if (ue_context_p->ue_context.handover_info->ho_complete == 0xF1) { + LOG_D(RRC, + "[eNB %d] Frame %d: handover Command received for new UE_id %x current eNB %d target eNB: %d \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i); + result = pdcp_data_req(ctxt_pP, + SRB_FLAG_YES, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + ue_context_p->ue_context.handover_info->size, + ue_context_p->ue_context.handover_info->buf, + PDCP_TRANSMISSION_MODE_CONTROL); + AssertFatal(result == TRUE, "PDCP data request failed!\n"); + ue_context_p->ue_context.handover_info->ho_complete = 0xF2; + } + } + } +} + +// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReconfiguration_handover( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint8_t* const nas_pdu, + const uint32_t nas_length +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + uint8_t rv[2]; + uint16_t Idx; + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; + LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed + SRB_ToAddModList_t *SRB_configList2; + + struct DRB_ToAddMod *DRB_config; + struct RLC_Config *DRB_rlc_config; + struct PDCP_Config *DRB_pdcp_config; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM; + struct LogicalChannelConfig *DRB_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; + DRB_ToAddModList_t *DRB_configList2; + + MAC_MainConfig_t *mac_MainConfig; + MeasObjectToAddModList_t *MeasObj_list; + MeasObjectToAddMod_t *MeasObj; + ReportConfigToAddModList_t *ReportConfig_list; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + QuantityConfig_t *quantityConfig; + MobilityControlInfo_t *mobilityInfo; + // HandoverCommand_t handoverCommand; + //uint8_t sourceModId = + // get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId); +#if Rel10 + long *sr_ProhibitTimer_r9; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + // RSRP_Range_t *rsrp; + struct MeasConfig__speedStatePars *Sparams; + CellsToAddMod_t *CellToAdd; + CellsToAddModList_t *CellsToAddModList; + // srb 1: for HO + struct SRB_ToAddMod *SRB1_config; + struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; + // phy config dedicated + PhysicalConfigDedicated_t *physicalConfigDedicated2; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; + protocol_ctxt_t ctxt; + + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", + ctxt_pP->module_id, ctxt_pP->frame); + + for (i = 0; i < 2; i++) { + rv[i] = taus() & 0xff; + LOG_D(RRC, " %x.", rv[i]); + } + + LOG_D(RRC, "[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n", + ctxt_pP->module_id, ctxt_pP->frame); + // 1st: reconfigure SRB + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList)); + SRB1_config = CALLOC(1, sizeof(*SRB1_config)); + SRB1_config->srb_Identity = 1; + SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); + SRB1_config->rlc_Config = SRB1_rlc_config; + + SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); + SRB1_config->logicalChannelConfig = SRB1_lchan_config; + + SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); + + SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; + + SRB1_ul_SpecificParameters->priority = 1; + + //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); + SRB1_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + + //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); + SRB1_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); + + //2nd: now reconfigure phy config dedicated + physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); + *physicalConfigDedicated = physicalConfigDedicated2; + + physicalConfigDedicated2->pdsch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->uplinkPowerControlDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->cqi_ReportConfig = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->schedulingRequestConfig = + CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + // PDSCH + //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, + // PDSCH_ConfigDedicated__p_a_dB0); + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; + + // PUCCH + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = + PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + + // Pusch_config_dedicated + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 + + // UplinkPowerControlDedicated + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB + //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, + // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); + physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled = + UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); + // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB + + // TPC-PDCCH-Config + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; + + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; + + // CQI ReportConfig + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); + assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic, + CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI + physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ + + //soundingRS-UL-ConfigDedicated + /* + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0); + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); + */ + + //AntennaInfoDedicated + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, + // AntennaInfoDedicated__transmissionMode_tm2); + /* + switch (transmission_mode){ + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + break; + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + break; + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + } + */ + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = + AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; + + // SchedulingRequestConfig + physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; + + if (mac_xface->lte_frame_parms->frame_type == 0) { // FDD + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid % + 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) + } else { + switch (mac_xface->lte_frame_parms->tdd_config) { + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( + ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; + + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % + 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & + 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; + } + } + + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, + //SchedulingRequestConfig__setup__dsr_TransMax_n4); + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = + SchedulingRequestConfig__setup__dsr_TransMax_n4; + + 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( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t*) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (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, + (uint8_t*) NULL, + (uint16_t*) NULL, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + + // Configure target eNB SRB2 + /// SRB2 + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); + memset(SRB_configList2, 0, sizeof(*SRB_configList2)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); + + // Configure target eNB DRB + DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = NULL; + DRB_pdcp_config->rlc_AM = NULL; + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; + + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#ifdef Rel10 + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = + 10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + /* mobilityinfo */ + + mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); + memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); + mobilityInfo->targetPhysCellId = + (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %d mod_id: %d ue: %x \n", + ctxt_pP->module_id, + ctxt_pP->frame, + mobilityInfo->targetPhysCellId, + ctxt_pP->module_id, + ue_context_pP->ue_context.rnti); + + mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); + *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! + + mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here + + // New UE Identity (C-RNTI) to identify an UE uniquely in a cell + mobilityInfo->newUE_Identity.size = 2; + mobilityInfo->newUE_Identity.bits_unused = 0; + mobilityInfo->newUE_Identity.buf = rv; + mobilityInfo->newUE_Identity.buf[0] = rv[0]; + mobilityInfo->newUE_Identity.buf[1] = rv[1]; + + //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); + //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); + + // Configuring radioResourceConfigCommon + mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + sizeof(PRACH_ConfigInfo_t)); + + mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = + rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; + mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t)); + memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.phich_Config = NULL; + mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + sizeof(SoundingRS_UL_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon, + sizeof(UplinkPowerControlCommon_t)); + mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL; + mobilityInfo->radioResourceConfigCommon.p_Max = NULL; // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t)); + mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(TDD_Config_t)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t)); + mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = + 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 = 36090; + mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; + + mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( + *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 + mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; + mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; + mobilityInfo->rach_ConfigDedicated = NULL; + + // store the srb and drb list for ho management, mainly in case of failure + + memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, + (void*)SRB_configList2, + sizeof(SRB_ToAddModList_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, + (void*)DRB_configList2, + sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void*)mac_MainConfig, + sizeof(MAC_MainConfig_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, + sizeof(PhysicalConfigDedicated_t)); + /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, + (void *)rrc_inst->sps_Config[ue_mod_idP], + sizeof(SPS_Config_t)); + */ + LOG_I(RRC, "[eNB %d] Frame %d: adding new UE\n"); + //Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + // SRB2 + ue_context_pP->ue_context.Srb2.Active = 1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", + ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); + + // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); + // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); + + rrc_pdcp_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + rrc_rlc_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + /* Initialize NAS list */ + dedicatedInfoNASList = NULL; + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + SRB_configList2, + DRB_configList2, + NULL, // DRB2_list, + NULL, //*sps_Config, + ue_context_pP->ue_context.physicalConfigDedicated, + MeasObj_list, + ReportConfig_list, + NULL, //quantityConfig, + MeasId_list, + mac_MainConfig, + NULL, + mobilityInfo, + Sparams, + NULL, + NULL, + dedicatedInfoNASList +#ifdef Rel10 + , NULL // SCellToAddMod_r10_t +#endif + ); + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + // to be updated if needed + /*if (eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig) { + if (eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue; + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + */ + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + //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( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (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, + (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + + /* + handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; + handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; + */ +//#warning "COMPILATION PROBLEM" +#ifdef PROBLEM_COMPILATION_RESOLVED + + if (sourceModId != 0xFF) { + memcpy(eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->buf, + (void *)buffer, size); + eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->size = size; + eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->ho_complete = + 0xF1; + //eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ho_complete = 0xFF; + LOG_D(RRC, "[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n", + ctxt_pP->module_id, + ctxt_pP->frame, + sourceModId, + eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s, + ctxt_pP->module_id, + ue_mod_idP); + } else + LOG_W(RRC, + "[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n", + ctxt_pP->module_id, ctxt_pP->frame); + +#endif +} + +/* + void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP, + RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + uint8_t CH_index) { + + if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) { + rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index, + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); + + } + + // check other fields for + } + } +*/ + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionReconfigurationComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + RRCConnectionReconfigurationComplete_r8_IEs_t* rrcConnectionReconfigurationComplete +) +//----------------------------------------------------------------------------- +{ + int i; +#ifdef PDCP_USE_NETLINK + int oip_ifup = 0; + int dest_ip_offset = 0; + module_id_t ue_module_id = -1; + /* avoid gcc warnings */ + (void)oip_ifup; + (void)dest_ip_offset; + (void)ue_module_id; +#endif + + uint8_t *kRRCenc = NULL; + uint8_t *kRRCint = NULL; + uint8_t *kUPenc = NULL; + + DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; + //SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_SECURITY) + + /* Derive the keys from kenb */ + if (DRB_configList != NULL) { + derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kenb, &kUPenc); + } + + 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, + ue_context_pP->ue_context.kenb, &kRRCint); + +#endif +#if ENABLE_RAL + { + MessageDef *message_ral_p = NULL; + rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind; + int i; + + message_ral_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_RAL_CONNECTION_RECONFIGURATION_IND); + memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t)); + connection_reconfiguration_ind.ue_id = ctxt_pP->rnti; + + if (DRB_configList != NULL) { + connection_reconfiguration_ind.num_drb = DRB_configList->list.count; + + for (i = 0; (i < DRB_configList->list.count) && (i < maxDRB); i++) { + connection_reconfiguration_ind.drb_id[i] = DRB_configList->list.array[i]->drb_Identity; + } + } else { + connection_reconfiguration_ind.num_drb = 0; + } + + if (SRB_configList != NULL) { + connection_reconfiguration_ind.num_srb = SRB_configList->list.count; + } else { + connection_reconfiguration_ind.num_srb = 0; + } + + memcpy(&message_ral_p->ittiMsg, (void *)&connection_reconfiguration_ind, + sizeof(rrc_ral_connection_reconfiguration_ind_t)); + LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to RAL\n"); + itti_send_msg_to_task(TASK_RAL_ENB, ctxt_pP->instance, message_ral_p); + } +#endif + // Refresh SRBs/DRBs + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti); + + rrc_pdcp_config_asn1_req( + ctxt_pP, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, (DRB_ToReleaseList_t *) NULL, + /*eNB_rrc_inst[ctxt_pP->module_id].ciphering_algorithm[ue_mod_idP] | + (eNB_rrc_inst[ctxt_pP->module_id].integrity_algorithm[ue_mod_idP] << 4), + */ + 0xff, // already configured during the securitymodecommand + kRRCenc, + kRRCint, + kUPenc +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + // Refresh SRBs/DRBs + rrc_rlc_config_asn1_req( + ctxt_pP, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + (DRB_ToReleaseList_t *) NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + // Loop through DRBs and establish if necessary + + 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]) { + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + // for pre-ci tests + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_pP->ue_context.DRB_active[i] == 0) { + /* + rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(ctxt_pP->module_id,frameP,1,CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + (int)*eNB_rrc_inst[ctxt_pP->module_id].DRB_config[ue_mod_idP][i]->logicalChannelIdentity, + RADIO_ACCESS_BEARER,Rlc_info_um); + */ + ue_context_pP->ue_context.DRB_active[i] = 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); +#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U) + // can mean also IPV6 since ether -> ipv6 autoconf +# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) + LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n", + ctxt_pP->module_id, + ctxt_pP->module_id); + oip_ifup = nas_config( + ctxt_pP->module_id, // interface index + ctxt_pP->module_id + 1, // thrid octet + ctxt_pP->module_id + 1); // fourth octet + + if (oip_ifup == 0) { // interface is up --> send a config the DRB +# ifdef OAI_EMU + oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; + dest_ip_offset = NB_eNB_INST; +# else + dest_ip_offset = 8; +# endif + LOG_I(OIP, + "[eNB %d] Config the oai%d to send/receive pkt on DRB %d to/from the protocol stack\n", + ctxt_pP->module_id, ctxt_pP->module_id, + (ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity); + ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + rb_conf_ipv4(0, //add + ue_module_id, //cx + ctxt_pP->module_id, //inst + (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB + 0, //dscp + ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr + ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr + LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n", + ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id); + } + +# else +# ifdef OAI_EMU + oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; +# endif +# endif +#endif + + 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 (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + + rrc_mac_config_req( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (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, + (uint8_t *) NULL, + (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + + } else { // remove LCHAN from MAC/PHY + + if (ue_context_pP->ue_context.DRB_active[i] == 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); + } + + ue_context_pP->ue_context.DRB_active[i] = 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(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (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, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + } + } + } + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionSetup( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_ToAddModList_t **SRB_configList; + SRB_ToAddMod_t *SRB1_config; + int cnt; + + 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; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionSetup(ctxt_pP, + ue_context_pP, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload, + (mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + mac_xface->lte_frame_parms, + SRB_configList, + &ue_context_pP->ue_context.physicalConfigDedicated); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Setup\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); + ////////////////////////////////// +#endif + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + + 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]; + + 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; + } + + 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( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (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, + (uint8_t *) NULL, + (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + break; + } + } + } + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].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), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); + +} + +#if defined(ENABLE_ITTI) +char +//----------------------------------------------------------------------------- +openair_rrc_eNB_init( + const module_id_t enb_mod_idP +) +//----------------------------------------------------------------------------- +{ + /* Dummy function, initialization will be done through ITTI messaging */ + return 0; +} +#endif + +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +char +openair_rrc_eNB_configuration( + const module_id_t enb_mod_idP, + RrcConfigurationReq* configuration +) +#else +char +openair_rrc_eNB_init( + const module_id_t enb_mod_idP +) +#endif +//----------------------------------------------------------------------------- +{ + protocol_ctxt_t ctxt; + int CC_id; + + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Init...\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + + AssertFatal(eNB_rrc_inst != NULL, "eNB_rrc_inst not initialized!"); + AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); + + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) + // eNB_rrc_inst[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; + // + //#if defined(ENABLE_USE_MME) + // // Connect eNB to MME + // if (EPC_MODE_ENABLED <= 0) + //#endif + // { + // /* Init security parameters */ + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + // eNB_rrc_inst[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0; + // eNB_rrc_inst[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; + // rrc_eNB_init_security(enb_mod_idP, j); + // } + // } + eNB_rrc_inst[ctxt.module_id].Nb_ue = 0; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].Srb0.Active = 0; + } + + uid_linear_allocator_init(&eNB_rrc_inst[ctxt.module_id].uid_allocator); + RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_ue_head); + // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { + // eNB_rrc_inst[enb_mod_idP].Srb2[j].Active = 0; + // } + + + eNB_rrc_inst[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + eNB_rrc_inst[ctxt.module_id].s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + + + /// System Information INIT + + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#ifdef Rel10 + + // This has to come from some top-level configuration + // only CC_id 0 is logged + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + eNB_rrc_inst[ctxt.module_id].carrier[0].MBMS_flag); + +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#endif +#ifdef CBA + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (j = 0; j < NUM_MAX_CBA_GROUP; j++) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; + } + + if (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + enb_mod_idP, eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[0], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[1], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[2], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[3], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups); + } + +#endif + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + init_SI(&ctxt, + CC_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + } + +#ifdef Rel10 + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + switch (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].MBMS_flag) { + case 1: + case 2: + case 3: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 1; + break; + + case 4: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 2; + break; + + default: + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 0; + break; + } + + // if we are here the eNB_rrc_inst[enb_mod_idP].MBMS_flag > 0, + /// MCCH INIT + if (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].MBMS_flag > 0) { + init_MCCH(ctxt.module_id, CC_id); + /// MTCH data bearer init + init_MBMS(ctxt.module_id, CC_id, 0); + } + } + +#endif + +#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH + openair_rrc_on(&ctxt); +#else + eNB_rrc_inst[ctxt.module_id].Last_scan_req = 0; + send_msg(&S_rrc, msg_rrc_phy_synch_to_MR_ind(ctxt.module_id, eNB_rrc_inst[ctxt.module_id].Mac_id)); +#endif + + return 0; + +} + +/*------------------------------------------------------------------------------*/ +int +rrc_eNB_decode_ccch( + protocol_ctxt_t* const ctxt_pP, + const SRB_INFO* const Srb_info, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + module_id_t Idx; + asn_dec_rval_t dec_rval; + UL_CCCH_Message_t *ul_ccch_msg = NULL; + RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; + RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; + int i, rval; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint64_t random_value = 0; + int stmsi_received = 0; + + T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); + + LOG_D(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); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_CCCH_Message, + (void**)&ul_ccch_msg, + (uint8_t*) Srb_info->Rx_buffer.Payload, + 100, + 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]); + } + + if (dec_rval.consumed == 0) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return -1; + } + + if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { + + switch (ul_ccch_msg->message.choice.c1.present) { + + case UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + 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)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishement Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrcConnectionReestablishmentRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ + uint64_t c_rnti = 0; + + memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, + rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); + ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); + } + + if ((eNB_rrc_inst[enb_mod_idP].phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && + (ue_mod_id != UE_INDEX_INVALID)){ + rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); + }else { + rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); + } + */ + /* reject all reestablishment attempts for the moment */ + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, + rrc_eNB_get_ue_context(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + 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), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p != NULL) { + // erase content + rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); + + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed); + } else { + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + { + if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { + AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, + "wrong InitialUE-Identity randomValue size, expected 5, provided %d", + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + memcpy(((uint8_t*) & random_value) + 3, + rrcConnectionRequest->ue_Identity.choice.randomValue.buf, + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + /* if there is already a registered UE (with another RNTI) with this random_value, + * the current one must be removed from MAC/PHY (zombie UE) + */ + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { +//#warning "TODO: random_exist: remove UE from MAC/PHY (how?)" + // AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)"); + ue_context_p = NULL; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } + } 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; + mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); + m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); + 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))) { + + //#warning "TODO: stmsi_exist: remove UE from MAC/PHY (how?)" + LOG_I(RRC," S-TMSI exists, ue_context_p %p\n",ue_context_p); + stmsi_received=1; + ue_context_p->ue_context.rnti = ctxt_pP->rnti; + // AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)"); + // ue_context_p = NULL; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); + ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; + } + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + 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), + ue_context_p->ue_context.rnti, + dec_rval.consumed, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.random_ue_identity); + } else { + LOG_E(RRC, + 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(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + } + + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %X\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + + if (ue_context_p != NULL) { + + +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; + if (stmsi_received==0) + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity); +#endif + if (stmsi_received == 0) + eNB_rrc_inst[ctxt_pP->module_id].Nb_ue++; + + } else { + // no context available + 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); + return -1; + } + } + +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + + ue_context_p->ue_context.primaryCC_id = CC_id; + + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + // SRB2 + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t*) NULL, + 0xff, + NULL, + NULL, + NULL +# ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +# endif + ); + + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL +# ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +# endif + ); +#endif //NO_RRM + + break; + + default: + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + break; + } + + rval = 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + } + + return rval; +} + +//----------------------------------------------------------------------------- +int +rrc_eNB_decode_dcch( + const protocol_ctxt_t* const ctxt_pP, + const rb_id_t Srb_id, + const uint8_t* const Rx_sdu, + const sdu_size_t sdu_sizeP +) +//----------------------------------------------------------------------------- +{ + + asn_dec_rval_t dec_rval; + //UL_DCCH_Message_t uldcchmsg; + UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; + UE_EUTRA_Capability_t *UE_EUTRA_Capability = NULL; + int i; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + + T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + if ((Srb_id != 1) && (Srb_id != 2)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Srb_id); + } + + //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_DCCH_Message, + (void**)&ul_dcch_msg, + Rx_sdu, + sdu_sizeP, + 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_DCCH_MESSAGE); + memcpy(&message_p->ittiMsg, (void *)ul_dcch_msg, sizeof(RrcUlDcchMessage)); + + 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_DCCH_Message, (void *)ul_dcch_msg)) >= 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + + { + for (i = 0; i < sdu_sizeP; i++) { + LOG_T(RRC, "%x.", Rx_sdu[i]); + } + + LOG_T(RRC, "\n"); + } + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%d bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + return -1; + } + + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + 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: + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " + "%d bytes (measurementReport) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + rrc_eNB_process_MeasurementReport( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.measurementReport. + criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. + present == + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { + rrc_eNB_process_RRCConnectionReconfigurationComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice. + rrcConnectionReconfigurationComplete. + criticalExtensions.choice. + rrcConnectionReconfigurationComplete_r8); + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \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 (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + } + } + +#if defined(ENABLE_USE_MME) +# if defined(ENABLE_ITTI) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( + ctxt_pP, + ue_context_p); + } + +# endif +#endif + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == + RRCConnectionSetupComplete__criticalExtensions_PR_c1) { + 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", + 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 (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } + } + } + + break; + + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry( + ctxt_pP, + ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_W(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeFailure) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // cancel the security mode in PDCP + + // followup with the remaining procedure +//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" + rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + dec_rval = uper_decode(NULL, + &asn_DEF_UE_EUTRA_Capability, + (void **)&UE_EUTRA_Capability, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, 0); + //#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability); + //#endif + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#endif + + rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, + ue_context_p, + eNB_rrc_inst[ctxt_pP->module_id].HO_flag); + break; + + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#endif + break; + + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + +#ifdef Rel10 + + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; +#endif + + default: + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + + return 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + +} + +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +void* +rrc_enb_task( + void* args_p +) +//----------------------------------------------------------------------------- +{ + MessageDef *msg_p; + const char *msg_name_p; + instance_t instance; + int result; + SRB_INFO *srb_info_p; + int CC_id; + + protocol_ctxt_t ctxt; + itti_mark_task_ready(TASK_RRC_ENB); + + while (1) { + // Wait for a message + itti_receive_msg(TASK_RRC_ENB, &msg_p); + + msg_name_p = 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(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + break; + + /* Messages from MAC */ + case RRC_MAC_CCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + msg_name_p); + + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; + srb_info_p = &eNB_rrc_inst[instance].carrier[CC_id].Srb0; + + memcpy(srb_info_p->Rx_buffer.Payload, + 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; + rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); + break; + + /* Messages from PDCP */ + case RRC_DCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_DCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + RRC_DCCH_DATA_IND(msg_p).dcch_index, + msg_name_p); + rrc_eNB_decode_dcch(&ctxt, + RRC_DCCH_DATA_IND(msg_p).dcch_index, + RRC_DCCH_DATA_IND(msg_p).sdu_p, + RRC_DCCH_DATA_IND(msg_p).sdu_size); + + // Message buffer has been processed, free it now. + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; + +# if defined(ENABLE_USE_MME) + + /* Messages from S1AP */ + case S1AP_DOWNLINK_NAS: + rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); + break; + + case S1AP_INITIAL_CONTEXT_SETUP_REQ: + rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CTXT_MODIFICATION_REQ: + rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_PAGING_IND: + LOG_E(RRC, "[eNB %d] Received not yet implemented message %s\n", instance, msg_name_p); + break; + + case S1AP_UE_CONTEXT_RELEASE_REQ: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CONTEXT_RELEASE_COMMAND: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; + + case GTPV1U_ENB_DELETE_TUNNEL_RESP: + /* Nothing to do. Apparently everything is done in S1AP processing */ + //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", + //instance, msg_name_p); + break; + +# endif + + /* Messages from eNB app */ + case RRC_CONFIGURATION_REQ: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + break; + +# if ENABLE_RAL + + case RRC_RAL_CONFIGURE_THRESHOLD_REQ: + rrc_enb_ral_handle_configure_threshold_request(instance, msg_p); + break; + + //SPECTRA: Add the RRC connection reconfiguration with Second cell configuration + case RRC_RAL_CONNECTION_RECONFIGURATION_REQ: + // ue_mod_id = 0; /* TODO force ue_mod_id to first UE, NAS UE not virtualized yet */ +//#warning "TODO GET RIGHT RNTI" + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + NOT_A_RNTI, // TO DO GET RIGHT RNTI + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, "[eNB %d] Send RRC_RAL_CONNECTION_RECONFIGURATION_REQ to UE %s\n", instance, msg_name_p); + //Method RRC connection reconfiguration command with Second cell configuration + //rrc_eNB_generate_RRCConnectionReconfiguration_SCell(instance, 0/* TODO put frameP number ! */, /*ue_mod_id force ue_mod_id to first UE*/0, 36126); + //rrc_eNB_generate_defaultRRCConnectionReconfiguration(instance, 0/* TODO put frameP number ! */, /*ue_mod_id force ue_mod_id to first UE*/0, + // eNB_rrc_inst[instance].HO_flag); + break; +# endif + + default: + LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + break; + } + + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + msg_p = NULL; + } +} +#endif + +#ifndef USER_MODE +EXPORT_SYMBOL(Rlc_info_am_config); +#endif From e29524a5fe5a50f78a3153965c5da894a953b153 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 5 Sep 2016 11:15:26 +0300 Subject: [PATCH 139/182] Fixed bug when using DCCH2 --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 7 +- .../CONF/enb.band5.agent.usrpb210.conf | 180 ++++++++++++++++++ 2 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 655c60cc70..5f1e0dbbf2 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -364,8 +364,9 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader + // TODO : Need to prioritize DRBs // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) - for (j = 1; j < 4; j++) { + for (j = 1; j < NB_RB_MAX; j++) { header_len+=3; // Need to see if we have space for data from this channel @@ -389,8 +390,8 @@ schedule_ue_spec_default( if (data_to_request < 128) { //The header will be one byte less header_len--; } - if (j == 1) { - data_to_request++; //It is not correct but fixes some RLC bug for DCCH + if (j == 1 || j == 2) { + data_to_request++; //It is not correct but fixes some RLC bug for DCCH } LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf new file mode 100644 index 0000000000..caf54b5541 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf @@ -0,0 +1,180 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -29; + 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + 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; + } + ); + + 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 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + + 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"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); From 9ed966cfe6d849f721eab5035a6a2c7a1106d1fe Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 19 Oct 2016 15:16:58 +0300 Subject: [PATCH 140/182] Added conf file for flexran oaisim --- ...enb.band7.flexran.oaisim.local_no_mme.conf | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf new file mode 100644 index 0000000000..ca36fab455 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf @@ -0,0 +1,160 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + 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 = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 2; + nb_antennas_tx = 2; + nb_antennas_rx = 2; + tx_gain = 25; + rx_gain = 20; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + 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 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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 = 2; + rach_preambleInitialReceivedTargetPower = -100; + 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 = 2; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "0.0.0.0"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "none"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "none"; + ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From b218128862d507fb0408945f8630b3651297436b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 20 Oct 2016 16:36:43 +0300 Subject: [PATCH 141/182] Moved agent and protocol to flexran naming convention --- cmake_targets/CMakeLists.txt | 88 ++-- .../ENB_APP/MESSAGES/V2/config_common.proto | 142 +++--- .../ENB_APP/MESSAGES/V2/config_messages.proto | 44 +- .../MESSAGES/V2/control_delegation.proto | 4 +- .../MESSAGES/V2/controller_commands.proto | 26 +- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 210 +++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 38 +- .../ENB_APP/MESSAGES/V2/mac_primitives.proto | 48 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 210 --------- .../ENB_APP/MESSAGES/V2/stats_common.proto | 112 ++--- .../ENB_APP/MESSAGES/V2/stats_messages.proto | 60 +-- .../ENB_APP/MESSAGES/V2/time_common.proto | 20 +- openair2/ENB_APP/enb_agent.c | 16 +- openair2/ENB_APP/enb_agent_common.c | 406 ++++++++--------- openair2/ENB_APP/enb_agent_common.h | 76 ++-- openair2/ENB_APP/enb_agent_handler.c | 64 +-- openair2/ENB_APP/enb_agent_mac.c | 418 +++++++++--------- openair2/ENB_APP/enb_agent_mac.h | 34 +- openair2/ENB_APP/enb_agent_mac_defs.h | 12 +- openair2/ENB_APP/enb_agent_mac_internal.c | 166 +++---- openair2/ENB_APP/enb_agent_mac_internal.h | 32 +- openair2/ENB_APP/enb_agent_task_manager.c | 2 +- openair2/ENB_APP/enb_agent_task_manager.h | 8 +- .../MAC/eNB_agent_scheduler_dataplane.c | 84 ++-- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 64 +-- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 2 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 6 +- openair2/LAYER2/MAC/eNB_scheduler.c | 4 +- openair2/LAYER2/MAC/enb_agent_mac_proto.h | 10 +- ...onversions.h => flexran_dci_conversions.h} | 40 +- openair2/RRC/LITE/rrc_eNB.c | 4 +- 31 files changed, 1225 insertions(+), 1225 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/flexran.proto delete mode 100644 openair2/ENB_APP/MESSAGES/V2/progran.proto rename openair2/LAYER2/MAC/{progran_dci_conversions.h => flexran_dci_conversions.h} (58%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c93d7077fc..196baf166b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -840,55 +840,55 @@ include_directories("${OPENAIR_DIR}") ################ if (ENB_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet - add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) - if (${PRPT_VERSION} STREQUAL "V2") - set (PRPTDIR V2) - elseif (${PRPT_VERSION} STREQUAL "V3") - set (PRPTDIR V3) - endif(${PRPT_VERSION} STREQUAL "V2") + if (${FLPT_VERSION} STREQUAL "V2") + set (FLPTDIR V2) + elseif (${FLPT_VERSION} STREQUAL "V3") + set (FLPTDIR V3) + endif(${FLPT_VERSION} STREQUAL "V2") - set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} ) - set(PRPT_MSG_FILES - ${PRPT_MSG_DIR}/header.proto - ${PRPT_MSG_DIR}/progran.proto - ${PRPT_MSG_DIR}/stats_common.proto - ${PRPT_MSG_DIR}/stats_messages.proto - ${PRPT_MSG_DIR}/time_common.proto - ${PRPT_MSG_DIR}/controller_commands.proto - ${PRPT_MSG_DIR}/mac_primitives.proto - ${PRPT_MSG_DIR}/config_messages.proto - ${PRPT_MSG_DIR}/config_common.proto - ${PRPT_MSG_DIR}/control_delegation.proto + set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} ) + set(FLPT_MSG_FILES + ${FLPT_MSG_DIR}/header.proto + ${FLPT_MSG_DIR}/flexran.proto + ${FLPT_MSG_DIR}/stats_common.proto + ${FLPT_MSG_DIR}/stats_messages.proto + ${FLPT_MSG_DIR}/time_common.proto + ${FLPT_MSG_DIR}/controller_commands.proto + ${FLPT_MSG_DIR}/mac_primitives.proto + ${FLPT_MSG_DIR}/config_messages.proto + ${FLPT_MSG_DIR}/config_common.proto + ${FLPT_MSG_DIR}/control_delegation.proto ) - set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) - #message("calling protoc_call=${protoc_call} PRPT_C_DIR=${PRPT_C_DIR} PRPT_MSG_FILES=${PRPT_MSG_FILES}") - execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_DIR} ${PRPT_MSG_FILES}) - file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) - set(PRPT_OAI_generated - ${PRPT_C_DIR}/header.pb-c.c - ${PRPT_C_DIR}/progran.pb-c.c - ${PRPT_C_DIR}/stats_common.pb-c.c - ${PRPT_C_DIR}/stats_messages.pb-c.c - ${PRPT_C_DIR}/time_common.pb-c.c - ${PRPT_C_DIR}/controller_commands.pb-c.c - ${PRPT_C_DIR}/mac_primitives.pb-c.c - ${PRPT_C_DIR}/config_messages.pb-c.c - ${PRPT_C_DIR}/config_common.pb-c.c - ${PRPT_C_DIR}/control_delegation.pb-c.c + 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}") + 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 + ${FLPT_C_DIR}/header.pb-c.c + ${FLPT_C_DIR}/flexran.pb-c.c + ${FLPT_C_DIR}/stats_common.pb-c.c + ${FLPT_C_DIR}/stats_messages.pb-c.c + ${FLPT_C_DIR}/time_common.pb-c.c + ${FLPT_C_DIR}/controller_commands.pb-c.c + ${FLPT_C_DIR}/mac_primitives.pb-c.c + ${FLPT_C_DIR}/config_messages.pb-c.c + ${FLPT_C_DIR}/config_common.pb-c.c + ${FLPT_C_DIR}/control_delegation.pb-c.c ) - file(GLOB prpt_h ${PRPT_C_DIR}/*.h) - set(prpt_h ${prpt_h} ) + file(GLOB flpt_h ${FLPT_C_DIR}/*.h) + set(flpt_h ${flpt_h} ) - add_library(PRPT_MSG - ${PRPT_OAI_generated} - ${PRPT_source} + add_library(FLPT_MSG + ${FLPT_OAI_generated} + ${FLPT_source} ) - set(PRPT_MSG_LIB PRPT_MSG) - #message("prpt c dir is : ${PRPT_C_DIR}") - include_directories (${PRPT_C_DIR}) + set(FLPT_MSG_LIB FLPT_MSG) + #message("prpt c dir is : ${FLPT_C_DIR}") + include_directories (${FLPT_C_DIR}) add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c @@ -1757,7 +1757,7 @@ 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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + 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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) @@ -1791,7 +1791,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 PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1936,7 +1936,7 @@ 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} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index cf07f423aa..51ae711277 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -5,64 +5,64 @@ package protocol; // Cell config related structures and enums // -message prp_si_config { +message flex_si_config { optional uint32 sfn = 1; optional uint32 sib1_length = 2; // The length of SIB1 in bytes optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF - repeated prp_si_message si_message = 4; // List of SI messages to be sent. + repeated flex_si_message si_message = 4; // List of SI messages to be sent. // The index identifies the type of an SI message // 0 - SIB1 // 1..31 - SIx // 32..63 - PCCH } -message prp_si_message { +message flex_si_message { optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames optional uint32 length = 2; // The length of the SI message in bytes } -enum prp_hopping_mode { - PRHM_INTER = 0; - PRHM_INTERINTRA = 1; +enum flex_hopping_mode { + FLHM_INTER = 0; + FLHM_INTERINTRA = 1; } -enum prp_phich_resource { - PRPR_ONE_SIXTH = 0; - PRPR_HALF = 1; - PRPR_ONE = 2; - PRPR_TWO = 3; +enum flex_phich_resource { + FLPR_ONE_SIXTH = 0; + FLPR_HALF = 1; + FLPR_ONE = 2; + FLPR_TWO = 3; } -enum prp_phich_duration { - PRPD_NORMAL = 0; - PRPD_EXTENDED = 1; +enum flex_phich_duration { + FLPD_NORMAL = 0; + FLPD_EXTENDED = 1; } -enum prp_ul_cyclic_prefix_length { - PRUCPL_NORMAL = 0; - PRUCPL_EXTENDED = 1; +enum flex_ul_cyclic_prefix_length { + FLUCPL_NORMAL = 0; + FLUCPL_EXTENDED = 1; } -enum prp_dl_cyclic_prefix_length { - PRDCPL_NORMAL = 0; - PRDCPL_EXTENDED = 1; +enum flex_dl_cyclic_prefix_length { + FLDCPL_NORMAL = 0; + FLDCPL_EXTENDED = 1; } -enum prp_duplex_mode { - PRDM_TDD = 0; - PRDM_FDD = 1; +enum flex_duplex_mode { + FLDM_TDD = 0; + FLDM_FDD = 1; } -enum prp_qam { - PREQ_MOD_16QAM = 0; - PREQ_MOD_64QAM = 1; +enum flex_qam { + FLEQ_MOD_16QAM = 0; + FLEQ_MOD_64QAM = 1; } // // UE config related structures and enums // -message prp_drx_config { +message flex_drx_config { optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321 optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321 optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321 @@ -72,30 +72,30 @@ message prp_drx_config { optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321 } -message prp_sps_config { +message flex_sps_config { optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321 repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used - // as part of PRPT_SET_UE_CONFIG + // as part of FLPT_SET_UE_CONFIG optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS } -message prp_sr_config { +message flex_sr_config { optional uint32 sr_action = 1; // Indicates if SR config should be changed or released - // One of the PRSRA_* enum values + // One of the FLSRA_* enum values optional uint32 sched_interval = 2; // SR scheduling interval in SF optional uint32 dsr_trans_max = 3; // See TS 36.213 } -message prp_cqi_config { +message flex_cqi_config { optional uint32 cqi_action = 1; // Indicats if CQI changed or released. - // One of the PRSRA_* enum values + // One of the FLSRA_* enum values optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF } -message prp_ue_capabilities { +message flex_ue_capabilities { optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1 @@ -103,7 +103,7 @@ message prp_ue_capabilities { optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1 } -message prp_scell_config { +message flex_scell_config { optional uint32 carrier_index = 1; // Id of the carrier component optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex) optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling @@ -113,46 +113,46 @@ message prp_scell_config { optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell } -enum prp_meas_gap_config_pattern { - PRMGCP_GP1 = 0; - PRMGCP_GP2 = 1; - PRMGCP_OFF = 2; +enum flex_meas_gap_config_pattern { + FLMGCP_GP1 = 0; + FLMGCP_GP2 = 1; + FLMGCP_OFF = 2; } -enum prp_setup_release_action { - PRSRA_SETUP = 0; - PRSRA_RELEASE = 1; +enum flex_setup_release_action { + FLSRA_SETUP = 0; + FLSRA_RELEASE = 1; } -enum prp_ue_transmission_antenna { - PRUTA_NONE = 0; - PRUTA_OPEN_LOOP = 1; - PRUTA_CLOSED_LOOP = 2; +enum flex_ue_transmission_antenna { + FLUTA_NONE = 0; + FLUTA_OPEN_LOOP = 1; + FLUTA_CLOSED_LOOP = 2; } -enum prp_aperiodic_cqi_report_mode { - PRACRM_RM12 = 0; - PRACRM_RM20 = 1; - PRACRM_RM22 = 2; - PRACRM_RM30 = 3; - PRACRM_RM31 = 4; - PRACRM_NONE = 5; +enum flex_aperiodic_cqi_report_mode { + FLACRM_RM12 = 0; + FLACRM_RM20 = 1; + FLACRM_RM22 = 2; + FLACRM_RM30 = 3; + FLACRM_RM31 = 4; + FLACRM_NONE = 5; } -enum prp_tdd_ack_nack_feedback_mode { - PRTANFM_BUNDLING = 0; - PRTANFM_MULTIPLEXING = 1; +enum flex_tdd_ack_nack_feedback_mode { + FLTANFM_BUNDLING = 0; + FLTANFM_MULTIPLEXING = 1; } // // Logical channel config related structures and enums // -message prp_lc_config { +message flex_lc_config { optional uint32 lcid = 1; // The logical channel id optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to - optional uint32 direction = 3; // The LC direction. One of the PRLCD_* enum values - optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the PRQBT_* enum values + optional uint32 direction = 3; // The LC direction. One of the FLLCD_* enum values + optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the FLQBT_* enum values optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413 // One less than the actual QCI value optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) @@ -161,20 +161,20 @@ message prp_lc_config { optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only) } -enum prp_lc_direction { - PRLCD_UL = 0; - PRLCD_DL = 1; - PRLCD_BOTH = 2; +enum flex_lc_direction { + FLLCD_UL = 0; + FLLCD_DL = 1; + FLLCD_BOTH = 2; } -enum prp_qos_bearer_type { - PRQBT_NON_GBR = 0; - PRQBT_GBR = 1; +enum flex_qos_bearer_type { + FLQBT_NON_GBR = 0; + FLQBT_GBR = 1; } -enum prp_ue_state_change_type { - PRUESC_UPDATED = 0; - PRUESC_ACTIVATED = 1; - PRUESC_DEACTIVATED = 2; - PRUESC_MOVED = 3; +enum flex_ue_state_change_type { + FLUESC_UPDATED = 0; + FLUESC_ACTIVATED = 1; + FLUESC_DEACTIVATED = 2; + FLUESC_MOVED = 3; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto index 4e1151a7e8..441e193569 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -3,23 +3,23 @@ package protocol; import "config_common.proto"; -message prp_cell_config { +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 PRHM_* enum values + optional uint32 hopping_mode = 4; // One of the FLHM_* enum values optional uint32 n_sb = 5; // The number of subbands optional uint32 phich_resource = 6; // The number of REGs used for PHICH - // One of the PRPR_* enum values - optional uint32 phich_duration = 7; // One of the PRPD_* enum values + // One of the FLPR_* enum values + optional uint32 phich_duration = 7; // One of the FLPD_* enum values optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9 - optional prp_si_config si_config = 9; // The SI configuration + optional flex_si_config si_config = 9; // The SI configuration optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs - optional uint32 ul_cyclic_prefix_length = 13; // One of the PRUCPL_* enum values - optional uint32 dl_cyclic_prefix_length = 14; // One of the PRDCPL_* enum values + optional uint32 ul_cyclic_prefix_length = 13; // One of the FLUCPL_* enum values + optional uint32 dl_cyclic_prefix_length = 14; // One of the FLDCPL_* enum values optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports - optional uint32 duplex_mode = 16; // One of the PRDM_* enum values + optional uint32 duplex_mode = 16; // One of the FLDM_* enum values optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1 repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional) @@ -36,30 +36,30 @@ message prp_cell_config { optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2 optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2 optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only - optional uint32 enable_64QAM = 33; // One of the PREQ_* enum values + optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values optional uint32 carrier_index = 34; // Carrier component index } -message prp_ue_config { +message flex_ue_config { optional uint32 rnti = 1; - optional prp_drx_config drx_config = 2; // The DRX configuration (Optional) + optional flex_drx_config drx_config = 2; // The DRX configuration (Optional) optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization // status of the UE, not the actual advance procedure // See TS 36.321 optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration. - // One of the PRMGCP_* enum values + // One of the FLMGCP_* enum values // See TS 36.133 optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable - optional prp_sps_config sps_config = 6; // The SPS configuration (Optional) - optional prp_sr_config sr_config = 7; // The SR configuration (Optional) - optional prp_cqi_config cqi_config = 8; // The CQI configuration (Optional) + optional flex_sps_config sps_config = 6; // The SPS configuration (Optional) + optional flex_sr_config sr_config = 7; // The SR configuration (Optional) + optional flex_cqi_config cqi_config = 8; // The CQI configuration (Optional) optional uint32 transmission_mode = 9; // The UE transmission mode optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer // per UE. See TS 36.413 optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer // per UE. See TS 36.413 - optional prp_ue_capabilities capabilities = 12; - optional uint32 ue_transmission_antenna = 13; // One of the PRUTA_* enum values + optional flex_ue_capabilities capabilities = 12; + optional uint32 ue_transmission_antenna = 13; // One of the FLUTA_* enum values optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321 optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL optional uint32 beta_offset_ACK_index = 16; // See TS 36.213 @@ -67,20 +67,20 @@ message prp_ue_config { optional uint32 beta_offset_CQI_index = 18; // See TS 36.213 optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213 optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213 - optional uint32 aperiodic_cqi_rep_mode = 21; // One of the PRACRM_* enum values - optional uint32 tdd_ack_nack_feedback = 22; // One of the PRTANFM_* enum values + optional uint32 aperiodic_cqi_rep_mode = 21; // One of the FLACRM_* enum values + optional uint32 tdd_ack_nack_feedback = 22; // One of the FLTANFM_* enum values optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1 optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation optional uint32 cross_carrier_sched_support = 26; // Boolean value optional uint32 pcell_carrier_index = 27; // Index of primary cell - repeated prp_scell_config scell_config = 28; // Secondary cells configuration + repeated flex_scell_config scell_config = 28; // Secondary cells configuration optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell } -message prp_lc_ue_config { +message flex_lc_ue_config { optional uint32 rnti = 1; - repeated prp_lc_config lc_config = 2; // A list of LC configurations for the given UE + repeated flex_lc_config lc_config = 2; // A list of LC configurations for the given UE } diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto index c5ce58d3a2..3a5efaf7d4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto +++ b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto @@ -1,6 +1,6 @@ //'syntax = "proto2";' package protocol; -enum prp_control_delegation_type { - PRCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation +enum flex_control_delegation_type { + FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto index 4ef8c0a370..cbec332b30 100644 --- a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto +++ b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto @@ -6,11 +6,11 @@ import "mac_primitives.proto"; // Body of UE DL MAC scheduling configuration info // -message prp_dl_data { +message flex_dl_data { optional uint32 rnti = 1; - optional prp_dl_dci dl_dci = 2; + optional flex_dl_dci dl_dci = 2; repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB - repeated prp_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid + repeated flex_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid optional uint32 serv_cell_index = 5; optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA } @@ -18,10 +18,10 @@ message prp_dl_data { // // Body of the RAR scheduler configuration // -message prp_dl_rar { +message flex_dl_rar { optional uint32 rnti = 1; optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2 - optional prp_dl_dci rar_dci = 3; + optional flex_dl_dci rar_dci = 3; optional uint32 carrier_index = 4; // The carrier index for the RAR } @@ -29,13 +29,13 @@ message prp_dl_rar { // Body of the paging/broadcast configuration message // -message prp_dl_broadcast { - optional uint32 type = 1; // The PRBT_* values +message flex_dl_broadcast { + optional uint32 type = 1; // The FLBT_* values optional uint32 index = 2; // Index of the broadcast message: // 0 - SIB1, // 1..31 - Six, - // 32..63 - PCCH (PCCH index obtained from prp_paging_info) - optional prp_dl_dci broad_dci = 3; + // 32..63 - PCCH (PCCH index obtained from flex_paging_info) + optional flex_dl_dci broad_dci = 3; optional uint32 carrier_index = 4; // Index of the carrier for broadcast } @@ -43,7 +43,7 @@ message prp_dl_broadcast { // Body of the OFDM symbol count message // -message prp_pdcch_ofdm_sym_count { +message flex_pdcch_ofdm_sym_count { optional uint32 carrier_index = 1; optional uint32 num_pdcch_ofdm_symbols = 2; } @@ -52,7 +52,7 @@ message prp_pdcch_ofdm_sym_count { // Types of commands related enums // -enum prp_broadcast_type { - PRBT_BCCH = 0; - PRBT_PCCH = 1; +enum flex_broadcast_type { + FLBT_BCCH = 0; + FLBT_PCCH = 1; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto new file mode 100644 index 0000000000..3a1d40bca6 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -0,0 +1,210 @@ +//'syntax = "proto2";' +package protocol; + +import "stats_messages.proto"; +import "header.proto"; +import "time_common.proto"; +import "config_messages.proto"; +import "controller_commands.proto"; +import "control_delegation.proto"; + +message flexran_message { + optional flexran_direction msg_dir = 100; + oneof msg { + flex_hello hello_msg = 1; + flex_echo_request echo_request_msg = 2; + flex_echo_reply echo_reply_msg = 3; + flex_stats_request stats_request_msg = 4; + flex_stats_reply stats_reply_msg = 5; + flex_sf_trigger sf_trigger_msg = 6; + flex_ul_sr_info ul_sr_info_msg = 7; + flex_enb_config_request enb_config_request_msg = 8; + flex_enb_config_reply enb_config_reply_msg = 9; + flex_ue_config_request ue_config_request_msg = 10; + flex_ue_config_reply ue_config_reply_msg = 11; + flex_lc_config_request lc_config_request_msg = 12; + flex_lc_config_reply lc_config_reply_msg = 13; + flex_dl_mac_config dl_mac_config_msg = 14; + flex_ue_state_change ue_state_change_msg = 15; + flex_control_delegation control_delegation_msg = 16; + flex_agent_reconfiguration agent_reconfiguration_msg = 17; + } +} + +enum flexran_direction { + //option allow_alias = true; + NOT_SET = 0; + INITIATING_MESSAGE = 1; + SUCCESSFUL_OUTCOME=2; + UNSUCCESSFUL_OUTCOME=3; +} + +enum flexran_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 flex_hello { + optional flex_header header = 1; +} + +message flex_echo_request { + optional flex_header header = 1; + extensions 100 to 199; +} + + +message flex_echo_reply { + optional flex_header header = 1; + extensions 100 to 199; +} + + +// +// Statistics request and reply message +// + +message flex_stats_request { + optional flex_header header = 1; + optional flex_stats_type type = 2; + oneof body { + flex_complete_stats_request complete_stats_request = 3; + flex_cell_stats_request cell_stats_request = 4; + flex_ue_stats_request ue_stats_request = 5; + } +} + +message flex_stats_reply { + optional flex_header header = 1; + repeated flex_ue_stats_report ue_report = 2; + repeated flex_cell_stats_report cell_report = 3; +} + +// +// Time indication messages +// + +message flex_sf_trigger { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated flex_dl_info dl_info = 3; + repeated flex_ul_info ul_info = 4; +} + +// +// Asynchronous messages +// + +message flex_ul_sr_info { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated uint32 rnti = 3; +} + +// +// eNB configuration messages +// +message flex_enb_config_request { + optional flex_header header = 1; +} + +message flex_enb_config_reply { + optional flex_header header = 1; + optional uint32 eNB_id = 2; // Unique id to distinguish the eNB + repeated flex_cell_config cell_config = 3; +} + +message flex_ue_config_request { + optional flex_header header = 1; +} + +message flex_ue_config_reply { + optional flex_header header = 1; + repeated flex_ue_config ue_config = 2; +} + +message flex_lc_config_request { + optional flex_header header = 1; +} + +message flex_lc_config_reply { + optional flex_header header = 1; + repeated flex_lc_ue_config lc_ue_config = 2; +} + +// +// Controller command messages +// + +message flex_dl_mac_config { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated flex_dl_data dl_ue_data = 3; + repeated flex_dl_rar dl_rar = 4; + repeated flex_dl_broadcast dl_broadcast = 5; + repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC +} + +// +// UE state change message +// + +message flex_ue_state_change { + optional flex_header header = 1; + optional uint32 type = 2; // One of the FLUESC_* values + optional flex_ue_config config = 3; // Body of the message (based on type) +} + +// +// Control delegation message +// + +message flex_control_delegation { + optional flex_header header = 1; + optional uint32 delegation_type = 2; // Bitmap of FLCDT_* flags + optional bytes payload = 3; // Byte array of shared lib containing the delegated functions + optional string name = 4; // The delegated functions names ordered based on bitmap flags +} + +// +// Agent reconfiguration message +// + +message flex_agent_reconfiguration { + optional flex_header header = 1; + optional string policy = 2; // The policy changes using YAML syntax in string format +} + +// Extensions of the echo request and reply +// messages for carrying a latency value in ms +message flex_echo_request_latency { + extend flex_echo_request { + optional uint32 latency = 100; + } +} + +message flex_echo_reply_latency { + extend flex_echo_reply { + optional uint32 latency = 100; + } +} + + diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 44ad93e16b..dfd5ea6c99 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -1,43 +1,43 @@ package protocol; -message prp_header { +message flex_header { optional uint32 version = 1; optional uint32 type = 2; optional uint32 xid = 4; } -enum prp_type { +enum flex_type { // Discovery and maintenance messages - PRPT_HELLO = 0; - PRPT_ECHO_REQUEST = 1; - PRPT_ECHO_REPLY = 2; + FLPT_HELLO = 0; + FLPT_ECHO_REQUEST = 1; + FLPT_ECHO_REPLY = 2; // Statistics and measurement messages - PRPT_STATS_REQUEST = 3; - PRPT_STATS_REPLY = 4; + FLPT_STATS_REQUEST = 3; + FLPT_STATS_REPLY = 4; // Time indication messages - PRPT_SF_TRIGGER = 5; + FLPT_SF_TRIGGER = 5; // Asynchronous messages - PRPT_UL_SR_INFO = 6; + FLPT_UL_SR_INFO = 6; // eNB configuration messages - PRPT_GET_ENB_CONFIG_REQUEST = 7; - PRPT_GET_ENB_CONFIG_REPLY = 8; - PRPT_GET_UE_CONFIG_REQUEST = 9; - PRPT_GET_UE_CONFIG_REPLY = 10; - PRPT_GET_LC_CONFIG_REQUEST = 11; - PRPT_GET_LC_CONFIG_REPLY = 12; + FLPT_GET_ENB_CONFIG_REQUEST = 7; + FLPT_GET_ENB_CONFIG_REPLY = 8; + FLPT_GET_UE_CONFIG_REQUEST = 9; + FLPT_GET_UE_CONFIG_REPLY = 10; + FLPT_GET_LC_CONFIG_REQUEST = 11; + FLPT_GET_LC_CONFIG_REPLY = 12; //Controller command messages - PRPT_DL_MAC_CONFIG = 13; + FLPT_DL_MAC_CONFIG = 13; // UE state change messages - PRPT_UE_STATE_CHANGE = 14; + FLPT_UE_STATE_CHANGE = 14; // Control delegation messages - PRPT_DELEGATE_CONTROL = 15; - PRPT_RECONFIGURE_AGENT = 16; + FLPT_DELEGATE_CONTROL = 15; + FLPT_RECONFIGURE_AGENT = 16; } diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto index 4378e6d668..be7c72ab7b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto +++ b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto @@ -4,7 +4,7 @@ package protocol; // Message containing the DL DCI info // -message prp_dl_dci { +message flex_dl_dci { optional uint32 rnti = 1; optional uint32 res_alloc = 2; // Type of resource allocation optional uint32 rb_bitmap = 3; // Bitmap for RB allocation @@ -17,17 +17,17 @@ message prp_dl_dci { optional uint32 aggr_level = 10; optional uint32 precoding_info = 11; // 2 antenna ports:0..6, // 4 antenna ports:0..50 - optional uint32 format = 12; // DCI format. A PRDCIF_* value + optional uint32 format = 12; // DCI format. A FLDCIF_* value optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1 optional uint32 harq_process = 14; // HARQ process ID optional uint32 dai = 15; // TDD only - optional uint32 vrb_format = 16; // One of the PRVRBF_* values + optional uint32 vrb_format = 16; // One of the FLVRBF_* values optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag optional uint32 sps_release = 18; // Flag value optional uint32 pdcch_order = 19; optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 - optional uint32 n_gap = 22; // One of the PRNGV_* values + optional uint32 n_gap = 22; // One of the FLNGV_* values optional uint32 tbs_idx = 23; // The TBS index for Format 1A optional uint32 dl_power_offset = 24; // For format 1D optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB @@ -39,11 +39,11 @@ message prp_dl_dci { // Messages related to the creation of RLC PDUs // -message prp_rlc_pdu { - repeated prp_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB +message flex_rlc_pdu { + repeated flex_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB } -message prp_rlc_pdu_tb { +message flex_rlc_pdu_tb { optional uint32 logical_channel_id = 1; optional uint32 size = 2; // Maximum RLC PDU to be created in bytes } @@ -52,25 +52,25 @@ message prp_rlc_pdu_tb { // MAC content types related enums // -enum prp_dci_format { - PRDCIF_1 = 0; - PRDCIF_1A = 1; - PRDCIF_1B = 2; - PRDCIF_1C = 3; - PRDCIF_1D = 4; - PRDCIF_2 = 5; - PRDCIF_2A = 6; - PRDCIF_2B = 7; - PRDCIF_3 = 8; - PRDCIF_3A = 9; +enum flex_dci_format { + FLDCIF_1 = 0; + FLDCIF_1A = 1; + FLDCIF_1B = 2; + FLDCIF_1C = 3; + FLDCIF_1D = 4; + FLDCIF_2 = 5; + FLDCIF_2A = 6; + FLDCIF_2B = 7; + FLDCIF_3 = 8; + FLDCIF_3A = 9; } -enum prp_vrb_format { - PRVRBF_LOCALIZED = 0; - PRVRBF_DISTRIBUTED = 1; +enum flex_vrb_format { + FLVRBF_LOCALIZED = 0; + FLVRBF_DISTRIBUTED = 1; } -enum prp_ngap_val { - PRNGV_1 = 0; - PRNGV_2 = 1; +enum flex_ngap_val { + FLNGV_1 = 0; + FLNGV_2 = 1; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto deleted file mode 100644 index 235aba4363..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ /dev/null @@ -1,210 +0,0 @@ -//'syntax = "proto2";' -package protocol; - -import "stats_messages.proto"; -import "header.proto"; -import "time_common.proto"; -import "config_messages.proto"; -import "controller_commands.proto"; -import "control_delegation.proto"; - -message progran_message { - optional progran_direction msg_dir = 100; - oneof msg { - prp_hello hello_msg = 1; - prp_echo_request echo_request_msg = 2; - prp_echo_reply echo_reply_msg = 3; - prp_stats_request stats_request_msg = 4; - prp_stats_reply stats_reply_msg = 5; - prp_sf_trigger sf_trigger_msg = 6; - prp_ul_sr_info ul_sr_info_msg = 7; - prp_enb_config_request enb_config_request_msg = 8; - prp_enb_config_reply enb_config_reply_msg = 9; - prp_ue_config_request ue_config_request_msg = 10; - prp_ue_config_reply ue_config_reply_msg = 11; - prp_lc_config_request lc_config_request_msg = 12; - prp_lc_config_reply lc_config_reply_msg = 13; - prp_dl_mac_config dl_mac_config_msg = 14; - prp_ue_state_change ue_state_change_msg = 15; - prp_control_delegation control_delegation_msg = 16; - prp_agent_reconfiguration agent_reconfiguration_msg = 17; - } -} - -enum progran_direction { - //option allow_alias = true; - NOT_SET = 0; - INITIATING_MESSAGE = 1; - SUCCESSFUL_OUTCOME=2; - UNSUCCESSFUL_OUTCOME=3; -} - -enum progran_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 prp_hello { - optional prp_header header = 1; -} - -message prp_echo_request { - optional prp_header header = 1; - extensions 100 to 199; -} - - -message prp_echo_reply { - optional prp_header header = 1; - extensions 100 to 199; -} - - -// -// Statistics request and reply message -// - -message prp_stats_request { - optional prp_header header = 1; - optional prp_stats_type type = 2; - oneof body { - prp_complete_stats_request complete_stats_request = 3; - prp_cell_stats_request cell_stats_request = 4; - prp_ue_stats_request ue_stats_request = 5; - } -} - -message prp_stats_reply { - optional prp_header header = 1; - repeated prp_ue_stats_report ue_report = 2; - repeated prp_cell_stats_report cell_report = 3; -} - -// -// Time indication messages -// - -message prp_sf_trigger { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_dl_info dl_info = 3; - repeated prp_ul_info ul_info = 4; -} - -// -// Asynchronous messages -// - -message prp_ul_sr_info { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated uint32 rnti = 3; -} - -// -// eNB configuration messages -// -message prp_enb_config_request { - optional prp_header header = 1; -} - -message prp_enb_config_reply { - optional prp_header header = 1; - optional uint32 eNB_id = 2; // Unique id to distinguish the eNB - repeated prp_cell_config cell_config = 3; -} - -message prp_ue_config_request { - optional prp_header header = 1; -} - -message prp_ue_config_reply { - optional prp_header header = 1; - repeated prp_ue_config ue_config = 2; -} - -message prp_lc_config_request { - optional prp_header header = 1; -} - -message prp_lc_config_reply { - optional prp_header header = 1; - repeated prp_lc_ue_config lc_ue_config = 2; -} - -// -// Controller command messages -// - -message prp_dl_mac_config { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_dl_data dl_ue_data = 3; - repeated prp_dl_rar dl_rar = 4; - repeated prp_dl_broadcast dl_broadcast = 5; - repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC -} - -// -// UE state change message -// - -message prp_ue_state_change { - optional prp_header header = 1; - optional uint32 type = 2; // One of the PRUESC_* values - optional prp_ue_config config = 3; // Body of the message (based on type) -} - -// -// Control delegation message -// - -message prp_control_delegation { - optional prp_header header = 1; - optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags - optional bytes payload = 3; // Byte array of shared lib containing the delegated functions - optional string name = 4; // The delegated functions names ordered based on bitmap flags -} - -// -// Agent reconfiguration message -// - -message prp_agent_reconfiguration { - optional prp_header header = 1; - optional string policy = 2; // The policy changes using YAML syntax in string format -} - -// Extensions of the echo request and reply -// messages for carrying a latency value in ms -message prp_echo_request_latency { - extend prp_echo_request { - optional uint32 latency = 100; - } -} - -message prp_echo_reply_latency { - extend prp_echo_reply { - optional uint32 latency = 100; - } -} - - diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 50d66a620c..70f99618ac 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -5,7 +5,7 @@ package protocol; // // RLC buffer status for a specific logical channel of a UE -message prp_rlc_bsr { +message flex_rlc_bsr { optional uint32 lc_id = 1; optional uint32 tx_queue_size = 2; optional uint32 tx_queue_hol_delay = 3; @@ -15,39 +15,39 @@ message prp_rlc_bsr { } // Flags for MAC Control Elements -enum prp_ce_type { - PRPCET_TA = 1; - PRPCET_DRX = 2; - PRPCET_CR = 4; - PRPCET_CA = 8; +enum flex_ce_type { + FLPCET_TA = 1; + FLPCET_DRX = 2; + FLPCET_CR = 4; + FLPCET_CA = 8; } // Types of DL CSI reports -enum prp_csi_type { - PRCSIT_P10 = 0; - PRCSIT_P11 = 1; - PRCSIT_P20 = 2; - PRCSIT_P21 = 3; - PRCSIT_A12 = 4; - PRCSIT_A22 = 5; - PRCSIT_A20 = 6; - PRCSIT_A30 = 7; - PRCSIT_A31 = 8; +enum flex_csi_type { + FLCSIT_P10 = 0; + FLCSIT_P11 = 1; + FLCSIT_P20 = 2; + FLCSIT_P21 = 3; + FLCSIT_A12 = 4; + FLCSIT_A22 = 5; + FLCSIT_A20 = 6; + FLCSIT_A30 = 7; + FLCSIT_A31 = 8; } // CSI type P10 -message prp_csi_p10 { +message flex_csi_p10 { optional uint32 wb_cqi = 1; } // CSI type P11 -message prp_csi_p11 { +message flex_csi_p11 { repeated uint32 wb_cqi = 1; optional uint32 wb_pmi = 2; } // CSI type P20 -message prp_csi_p20 { +message flex_csi_p20 { optional uint32 wb_cqi = 1; optional uint32 sb_cqi = 2; optional uint32 bandwidth_part_index = 3; @@ -55,7 +55,7 @@ message prp_csi_p20 { } // CSI type P21 -message prp_csi_p21 { +message flex_csi_p21 { repeated uint32 wb_cqi = 1; optional uint32 wb_pmi = 2; repeated uint32 sb_cqi = 3; @@ -64,13 +64,13 @@ message prp_csi_p21 { } // CSI type A12 -message prp_csi_a12 { +message flex_csi_a12 { repeated uint32 wb_cqi = 1; repeated uint32 sb_pmi = 2; } // CSI type A22 -message prp_csi_a22 { +message flex_csi_a22 { repeated uint32 wb_cqi = 1; repeated uint32 sb_cqi = 2; optional uint32 wb_pmi = 3; @@ -79,56 +79,56 @@ message prp_csi_a22 { } // CSI type A20 -message prp_csi_a20 { +message flex_csi_a20 { optional uint32 wb_cqi = 1; optional uint32 sb_cqi = 2; repeated uint32 sb_list = 3; } // CSI type A30 -message prp_csi_a30 { +message flex_csi_a30 { optional uint32 wb_cqi = 1; repeated uint32 sb_cqi = 2; } // CSI type A31 -message prp_csi_a31 { +message flex_csi_a31 { repeated uint32 wb_cqi = 1; - repeated prp_msb_cqi sb_cqi = 2; + repeated flex_msb_cqi sb_cqi = 2; optional uint32 wb_pmi = 3; } // The CQI for the M-preffered subband -message prp_msb_cqi { +message flex_msb_cqi { repeated uint32 sb_cqi = 1; } // The CSI report of the UE for a specific servCellIndex -message prp_dl_csi { +message flex_dl_csi { optional uint32 serv_cell_index = 1; optional uint32 ri = 2; - optional prp_csi_type type = 3; + optional flex_csi_type type = 3; oneof report { - prp_csi_p10 p10csi = 4; - prp_csi_p11 p11csi = 5; - prp_csi_p20 p20csi = 6; - prp_csi_p21 p21csi = 7; - prp_csi_a12 a12csi = 8; - prp_csi_a22 a22csi = 9; - prp_csi_a20 a20csi = 10; - prp_csi_a30 a30csi = 11; - prp_csi_a31 a31csi = 12; + flex_csi_p10 p10csi = 4; + flex_csi_p11 p11csi = 5; + flex_csi_p20 p20csi = 6; + flex_csi_p21 p21csi = 7; + flex_csi_a12 a12csi = 8; + flex_csi_a22 a22csi = 9; + flex_csi_a20 a20csi = 10; + flex_csi_a30 a30csi = 11; + flex_csi_a31 a31csi = 12; } } // The full DL CQI report for all CC of a UE -message prp_dl_cqi_report { +message flex_dl_cqi_report { optional uint32 sfn_sn = 1; - repeated prp_dl_csi csi_report = 2; + repeated flex_dl_csi csi_report = 2; } // Paging message info -message prp_paging_info { +message flex_paging_info { optional uint32 paging_index = 1; optional uint32 paging_message_size = 2; optional uint32 paging_subframe = 3; @@ -136,34 +136,34 @@ message prp_paging_info { } // Report for the paging buffer status -message prp_paging_buffer_report { - repeated prp_paging_info paging_info = 1; +message flex_paging_buffer_report { + repeated flex_paging_info paging_info = 1; } // The type of UL CQI -enum prp_ul_cqi_type { - PRUCT_SRS = 0; - PRUCT_PUSCH = 1; - PRUCT_PUCCH_1 = 2; - PRUCT_PUCCH_2 = 3; - PRUCT_PRACH = 4; +enum flex_ul_cqi_type { + FLUCT_SRS = 0; + FLUCT_PUSCH = 1; + FLUCT_PUCCH_1 = 2; + FLUCT_PUCCH_2 = 3; + FLUCT_PRACH = 4; } // UL CQI report for a specific UE for a given report type -message prp_ul_cqi { - optional prp_ul_cqi_type type = 1; +message flex_ul_cqi { + optional flex_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; } // Full UL CQI report for a specific UE -message prp_ul_cqi_report { +message flex_ul_cqi_report { optional uint32 sfn_sn = 1; - repeated prp_ul_cqi cqi_meas = 2; - repeated prp_pucch_dbm pucch_dbm = 3; + repeated flex_ul_cqi cqi_meas = 2; + repeated flex_pucch_dbm pucch_dbm = 3; } -message prp_pucch_dbm { +message flex_pucch_dbm { optional int32 p0_pucch_dbm = 1; optional uint32 serv_cell_index = 2; } @@ -173,7 +173,7 @@ message prp_pucch_dbm { // // The UL noise and interference report for a UE -message prp_noise_interference_report { +message flex_noise_interference_report { optional uint32 sfn_sf = 1; optional uint32 rip = 2; optional uint32 tnp = 3; diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto index 5ec7ae690c..1b1567dda1 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto @@ -7,19 +7,19 @@ import "stats_common.proto"; // Bodies of statistics report requests // -message prp_complete_stats_request { - optional prp_stats_report_freq report_frequency = 1; +message flex_complete_stats_request { + optional flex_stats_report_freq report_frequency = 1; optional uint32 sf = 2; optional uint32 cell_report_flags = 3; optional uint32 ue_report_flags = 4; } -message prp_cell_stats_request { +message flex_cell_stats_request { repeated uint32 cell = 1; optional uint32 flags = 2; } -message prp_ue_stats_request { +message flex_ue_stats_request { repeated uint32 rnti = 1; optional uint32 flags = 2; } @@ -29,23 +29,23 @@ message prp_ue_stats_request { // // The full statistics report for a specific cell -message prp_cell_stats_report { +message flex_cell_stats_report { optional uint32 carrier_index = 1; optional uint32 flags = 2; - optional prp_noise_interference_report noise_inter_report = 3; + optional flex_noise_interference_report noise_inter_report = 3; } // Statistics report for a specific UE -message prp_ue_stats_report { +message flex_ue_stats_report { optional uint32 rnti = 1; optional uint32 flags = 2; repeated uint32 bsr = 3; optional uint32 phr = 4; - repeated prp_rlc_bsr rlc_report = 5; + repeated flex_rlc_bsr rlc_report = 5; optional uint32 pending_mac_ces = 6; - optional prp_dl_cqi_report dl_cqi_report = 7; - optional prp_paging_buffer_report pbr = 8; - optional prp_ul_cqi_report ul_cqi_report = 9; + optional flex_dl_cqi_report dl_cqi_report = 7; + optional flex_paging_buffer_report pbr = 8; + optional flex_ul_cqi_report ul_cqi_report = 9; } // @@ -54,33 +54,33 @@ message prp_ue_stats_report { //Types of statistics requested by the controller -enum prp_stats_type { - PRST_COMPLETE_STATS = 0; - PRST_CELL_STATS = 1; - PRST_UE_STATS = 2; +enum flex_stats_type { + FLST_COMPLETE_STATS = 0; + FLST_CELL_STATS = 1; + FLST_UE_STATS = 2; } // Report frequency for the requested statistics -enum prp_stats_report_freq { - PRSRF_ONCE = 0; - PRSRF_PERIODICAL = 1; - PRSRF_CONTINUOUS = 2; - PRSRF_OFF = 3; +enum flex_stats_report_freq { + FLSRF_ONCE = 0; + FLSRF_PERIODICAL = 1; + FLSRF_CONTINUOUS = 2; + FLSRF_OFF = 3; } // Flags for cell statistics -enum prp_cell_stats_type { - PRCST_NOISE_INTERFERENCE = 1; +enum flex_cell_stats_type { + FLCST_NOISE_INTERFERENCE = 1; } // Flags for UE-related statistics -enum prp_ue_stats_type { - PRUST_BSR = 1; - PRUST_PRH = 2; - PRUST_RLC_BS = 4; - PRUST_MAC_CE_BS = 8; - PRUST_DL_CQI = 16; - PRUST_PBS = 32; - PRUST_UL_CQI = 64; +enum flex_ue_stats_type { + FLUST_BSR = 1; + FLUST_PRH = 2; + FLUST_RLC_BS = 4; + FLUST_MAC_CE_BS = 8; + FLUST_DL_CQI = 16; + FLUST_PBS = 32; + FLUST_UL_CQI = 64; // To be extended with more types of stats } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto index 4c3ac4911e..30a56bb776 100644 --- a/openair2/ENB_APP/MESSAGES/V2/time_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/time_common.proto @@ -1,25 +1,25 @@ package protocol; -enum prp_harq_status { - PRHS_ACK = 0; - PRHS_NACK = 1; - PRHS_DTX = 2; +enum flex_harq_status { + FLHS_ACK = 0; + FLHS_NACK = 1; + FLHS_DTX = 2; } -enum prp_reception_status { - PRRS_OK = 0; - PRRS_NOT_OK = 1; - PRRS_NOT_VALID = 2; +enum flex_reception_status { + FLRS_OK = 0; + FLRS_NOT_OK = 1; + FLRS_NOT_VALID = 2; } -message prp_dl_info { +message flex_dl_info { optional uint32 rnti = 1; optional uint32 harq_process_id = 2; repeated uint32 harq_status = 3; optional uint32 serv_cell_index = 4; } -message prp_ul_info { +message flex_ul_info { optional uint32 rnti = 1; repeated uint32 ul_reception = 2; optional uint32 reception_status = 3; diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 6a9bcad878..8286771104 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -29,7 +29,7 @@ /*! \file enb_agent.h * \brief top level enb agent receive thread and itti task - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -57,7 +57,7 @@ char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -Protocol__ProgranMessage *enb_agent_timeout(void* args); +Protocol__FlexranMessage *enb_agent_timeout(void* args); int agent_task_created = 0; @@ -68,7 +68,7 @@ int agent_task_created = 0; void *enb_agent_task(void *args){ //enb_agent_instance_t *d = (enb_agent_instance_t *) args; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int size; err_code_t err_code; @@ -104,7 +104,7 @@ void *enb_agent_task(void *args){ data=enb_agent_pack_message(msg,&size); elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -135,11 +135,11 @@ void *receive_thread(void *args) { int priority; err_code_t err_code; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; while (1) { //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - // err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + // err_code = PROTOCOL__FLEXRAN_ERR__MSG_DEQUEUING; // goto error; //} @@ -157,7 +157,7 @@ void *receive_thread(void *args) { data=enb_agent_pack_message(msg,&size); if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -337,7 +337,7 @@ error: -Protocol__ProgranMessage *enb_agent_timeout(void* args){ +Protocol__FlexranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0f148d82dd..2baecd6041 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -29,7 +29,7 @@ /*! \file enb_agent_common.c * \brief common primitives for all agents - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -55,15 +55,15 @@ void * enb_rrc[NUM_MAX_ENB]; * message primitives */ -int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { +int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { - *size = protocol__progran_message__get_packed_size(msg); + *size = protocol__flexran_message__get_packed_size(msg); *buf = malloc(*size); if (buf == NULL) goto error; - protocol__progran_message__pack(msg, *buf); + protocol__flexran_message__pack(msg, *buf); return 0; @@ -76,8 +76,8 @@ int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int * /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ -int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg) { - *msg = protocol__progran_message__unpack(NULL, size, data); +int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { + *msg = protocol__flexran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; @@ -90,14 +90,14 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage -int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { +int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { - *header = malloc(sizeof(Protocol__PrpHeader)); + *header = malloc(sizeof(Protocol__FlexHeader)); if(*header == NULL) goto error; - protocol__prp_header__init(*header); - (*header)->version = PROGRAN_VERSION; + protocol__flex_header__init(*header); + (*header)->version = FLEXRAN_VERSION; (*header)->has_version = 1; // check if the type is set (*header)->type = type; @@ -112,28 +112,28 @@ int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader ** } -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexHeader *header; /*TODO: Need to set random xid or xid from received hello message*/ xid_t xid = 1; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) goto error; - Protocol__PrpHello *hello_msg; - hello_msg = malloc(sizeof(Protocol__PrpHello)); + Protocol__FlexHello *hello_msg; + hello_msg = malloc(sizeof(Protocol__FlexHello)); if(hello_msg == NULL) goto error; - protocol__prp_hello__init(hello_msg); + protocol__flex_hello__init(hello_msg); hello_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; @@ -150,9 +150,9 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage * } -int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG) goto error; free(msg->hello_msg->header); @@ -166,26 +166,26 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; /*TODO: Need to set a random xid*/ xid_t xid = 1; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) goto error; - Protocol__PrpEchoRequest *echo_request_msg; - echo_request_msg = malloc(sizeof(Protocol__PrpEchoRequest)); + Protocol__FlexEchoRequest *echo_request_msg; + echo_request_msg = malloc(sizeof(Protocol__FlexEchoRequest)); if(echo_request_msg == NULL) goto error; - protocol__prp_echo_request__init(echo_request_msg); + protocol__flex_echo_request__init(echo_request_msg); echo_request_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->echo_request_msg = echo_request_msg; return 0; @@ -201,8 +201,8 @@ int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMe } -int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) +int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) goto error; free(msg->echo_request_msg->header); @@ -217,30 +217,30 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEchoRequest *echo_req = input->echo_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexEchoRequest *echo_req = input->echo_request_msg; xid = (echo_req->header)->xid; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) goto error; - Protocol__PrpEchoReply *echo_reply_msg; - echo_reply_msg = malloc(sizeof(Protocol__PrpEchoReply)); + Protocol__FlexEchoReply *echo_reply_msg; + echo_reply_msg = malloc(sizeof(Protocol__FlexEchoReply)); if(echo_reply_msg == NULL) goto error; - protocol__prp_echo_reply__init(echo_reply_msg); + protocol__flex_echo_reply__init(echo_reply_msg); echo_reply_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->echo_reply_msg = echo_reply_msg; return 0; @@ -257,8 +257,8 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMess } -int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG) +int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; free(msg->echo_reply_msg->header); @@ -272,12 +272,12 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { } -int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) +int enb_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__PrpEnbConfigReply *reply = msg->enb_config_reply_msg; + 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); @@ -302,12 +302,12 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) +int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; free(msg->ue_config_reply_msg->header); int i, j; - Protocol__PrpUeConfigReply *reply = msg->ue_config_reply_msg; + Protocol__FlexUeConfigReply *reply = msg->ue_config_reply_msg; for(i = 0; i < reply->n_ue_config;i++){ free(reply->ue_config[i]->capabilities); @@ -323,8 +323,8 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) +int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; int i, j; @@ -345,8 +345,8 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) +int enb_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 @@ -359,8 +359,8 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) +int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; free(msg->enb_config_request_msg->header); free(msg->enb_config_request_msg); @@ -372,12 +372,12 @@ int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated UE config message */ return 0; } -int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated LC config message */ return 0; } @@ -397,10 +397,10 @@ long timer_end(struct timespec start_time){ return diffInNanos; } -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpControlDelegation *control_delegation_msg = input->control_delegation_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg; uint32_t delegation_type = control_delegation_msg->delegation_type; @@ -428,13 +428,13 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro return -1; } -int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; apply_reconfiguration_policy(mod_id, agent_reconfiguration_msg->policy, strlen(agent_reconfiguration_msg->policy)); @@ -442,7 +442,7 @@ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__Progra return 0; } -int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } @@ -949,11 +949,11 @@ int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { if(ue_context_p->ue_context.measGapConfig != NULL){ if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP1; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP2; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2; } else { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF; } } } @@ -1258,38 +1258,38 @@ int get_direction(mid_t ue_id, mid_t lc_id) int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { int size; - Protocol__ProgranMessage *msg; - Protocol__PrpHeader *header; + Protocol__FlexranMessage *msg; + Protocol__FlexHeader *header; void *data; int priority; err_code_t err_code; int xid = 0; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) goto error; - Protocol__PrpUeStateChange *ue_state_change_msg; - ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + Protocol__FlexUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange)); if(ue_state_change_msg == NULL) { goto error; } - protocol__prp_ue_state_change__init(ue_state_change_msg); + protocol__flex_ue_state_change__init(ue_state_change_msg); ue_state_change_msg->has_type = 1; ue_state_change_msg->type = state_change; - Protocol__PrpUeConfig *config; - config = malloc(sizeof(Protocol__PrpUeConfig)); + Protocol__FlexUeConfig *config; + config = malloc(sizeof(Protocol__FlexUeConfig)); if (config == NULL) { goto error; } - protocol__prp_ue_config__init(config); - if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + protocol__flex_ue_config__init(config); + if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) { // Simply set the rnti of the UE config->has_rnti = 1; config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED - || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + } 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); config->has_rnti = 1; config->rnti = rnti; @@ -1305,7 +1305,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) } //TODO: Set the measurement gap offset if applicable if(config->has_meas_gap_config_pattern == 1 && - config->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } @@ -1333,9 +1333,9 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *c_capabilities; - c_capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(c_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 = 1; c_capabilities->half_duplex = 1;//get_half_duplex(i); @@ -1353,7 +1353,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values + //TODO: Set UE transmission antenna. One of the FLUTA_* values if(get_ue_transmission_antenna(mod_id,i) != -1){ config->has_ue_transmission_antenna = 1; config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); @@ -1398,7 +1398,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); if (mode > 4) { - config->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; } else { config->aperiodic_cqi_rep_mode = mode; } @@ -1435,24 +1435,24 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_scell_deactivation_timer = 1; config->scell_deactivation_timer = 1; } - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) { // TODO: Not supported for now. Leave blank } ue_state_change_msg->config = config; - msg = malloc(sizeof(Protocol__ProgranMessage)); + msg = malloc(sizeof(Protocol__FlexranMessage)); if (msg == NULL) { goto error; } - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(msg); + msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; msg->ue_state_change_msg = ue_state_change_msg; data = enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1466,38 +1466,38 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) * timer primitives */ -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; xid = (lc_config_request_msg->header)->xid; int i, j; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpLcConfigReply *lc_config_reply_msg; - lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + Protocol__FlexLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__FlexLcConfigReply)); if(lc_config_reply_msg == NULL) goto error; - protocol__prp_lc_config_reply__init(lc_config_reply_msg); + protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; //TODO: Fill in the actual number of UEs that we are going to report LC configs about lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); - Protocol__PrpLcUeConfig **lc_ue_config; + Protocol__FlexLcUeConfig **lc_ue_config; if (lc_config_reply_msg->n_lc_ue_config > 0) { - lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); + 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++) { - lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); - protocol__prp_lc_ue_config__init(lc_ue_config[i]); + lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); + protocol__flex_lc_ue_config__init(lc_ue_config[i]); //TODO: Set the RNTI of the UE lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); @@ -1512,15 +1512,15 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra } else { lc_ue_config[i]->n_lc_config = 3; } - Protocol__PrpLcConfig **lc_config; + Protocol__FlexLcConfig **lc_config; if (lc_ue_config[i]->n_lc_config > 0) { - lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); + 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__PrpLcConfig)); - protocol__prp_lc_config__init(lc_config[j]); + lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); + protocol__flex_lc_config__init(lc_config[j]); //TODO: Set the LC id lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; @@ -1533,14 +1533,14 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set the LC direction lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); - //TODO: Bearer type. One of PRQBT_* values + //TODO: Bearer type. One of FLQBT_* values lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_NON_GBR; + 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 lc_config[j]->has_qci = 1; lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { //TODO: Set the max bitrate (UL) lc_config[j]->has_e_rab_max_bitrate_ul = 1; lc_config[j]->e_rab_max_bitrate_ul = 1; @@ -1560,12 +1560,12 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra } // end for UE lc_config_reply_msg->lc_ue_config = lc_ue_config; } // lc_config_reply_msg->n_lc_ue_config > 0 - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if (*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->lc_config_reply_msg = lc_config_reply_msg; return 0; @@ -1588,38 +1588,38 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra * ************************************ */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; xid = (ue_config_request_msg->header)->xid; int i; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpUeConfigReply *ue_config_reply_msg; - ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + Protocol__FlexUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__FlexUeConfigReply)); if(ue_config_reply_msg == NULL) goto error; - protocol__prp_ue_config_reply__init(ue_config_reply_msg); + protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; //TODO: Fill in the actual number of UEs that are currently connected ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); - Protocol__PrpUeConfig **ue_config; + Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { - ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + ue_config = malloc(sizeof(Protocol__FlexUeConfig *) * ue_config_reply_msg->n_ue_config); if (ue_config == NULL) { goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); - protocol__prp_ue_config__init(ue_config[i]); + ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); + protocol__flex_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; @@ -1638,7 +1638,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra } //TODO: Set the measurement gap offset if applicable if(ue_config[i]->has_meas_gap_config_pattern == 1 && - ue_config[i]->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); ue_config[i]->has_meas_gap_config_sf_offset = 1; } @@ -1666,9 +1666,9 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *capabilities; - capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(capabilities); + Protocol__FlexUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); + protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 1; capabilities->half_duplex = 1;//get_half_duplex(i); @@ -1686,7 +1686,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values + //TODO: Set UE transmission antenna. One of the FLUTA_* values if(get_ue_transmission_antenna(mod_id,i) != -1){ ue_config[i]->has_ue_transmission_antenna = 1; ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); @@ -1726,12 +1726,12 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_simultaneous_ack_nack_cqi = 1; ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + //TODO: Set FLACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); if (mode > 4) { - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; } else { ue_config[i]->aperiodic_cqi_rep_mode = mode; } @@ -1770,12 +1770,12 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra } ue_config_reply_msg->ue_config = ue_config; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if (*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->ue_config_reply_msg = ue_config_reply_msg; return 0; @@ -1798,29 +1798,29 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra * ************************************ */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexHeader *header; xid_t xid = 1; - if(prp_create_header(xid,PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + if(flex_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) goto error; - Protocol__PrpEnbConfigRequest *enb_config_request_msg; - enb_config_request_msg = malloc(sizeof(Protocol__PrpEnbConfigRequest)); + Protocol__FlexEnbConfigRequest *enb_config_request_msg; + enb_config_request_msg = malloc(sizeof(Protocol__FlexEnbConfigRequest)); if(enb_config_request_msg == NULL) goto error; - protocol__prp_enb_config_request__init(enb_config_request_msg); + protocol__flex_enb_config_request__init(enb_config_request_msg); enb_config_request_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->enb_config_request_msg = enb_config_request_msg; return 0; @@ -1836,26 +1836,26 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Pro return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; xid = (enb_config_req_msg->header)->xid; int i, j, k; int cc_id = 0; int enb_id = mod_id; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpEnbConfigReply *enb_config_reply_msg; - enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + Protocol__FlexEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); if(enb_config_reply_msg == NULL) goto error; - protocol__prp_enb_config_reply__init(enb_config_reply_msg); + protocol__flex_enb_config_reply__init(enb_config_reply_msg); enb_config_reply_msg->header = header; enb_config_reply_msg->enb_id = mod_id; @@ -1863,14 +1863,14 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; - Protocol__PrpCellConfig **cell_conf; + Protocol__FlexCellConfig **cell_conf; if(enb_config_reply_msg->n_cell_config > 0){ - cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * enb_config_reply_msg->n_cell_config); + 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++){ - cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); - protocol__prp_cell_config__init(cell_conf[i]); + cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); + protocol__flex_cell_config__init(cell_conf[i]); //TODO: Fill in with actual value, the PCI of this cell cell_conf[i]->phy_cell_id = 1; cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); @@ -1882,41 +1882,41 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->has_pusch_hopping_offset = 1; //TODO: Fill in with actual value if(get_hopping_mode(enb_id,i) == 0){ - cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTER; + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; }else if(get_hopping_mode(enb_id,i) == 1){ - cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTERINTRA; + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; //TODO: Fill in with actual value, the number of subbands cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of FLPR_ if(get_phich_resource(enb_id,i) == 0){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE_SIXTH; //0 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 }else if (get_phich_resource(enb_id,i) == 1){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_HALF; //1 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 }else if (get_phich_resource(enb_id,i) == 2){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE; // 2 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 }else if (get_phich_resource(enb_id,i) == 3){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_TWO;//3 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the PRPD_ values + //TODO: Fill in with actual value, one of the FLPD_ values if(get_phich_duration(enb_id,i) == 0){ - cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_NORMAL; + cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; }else if(get_phich_duration(enb_id,i) == 1){ - cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_EXTENDED; + cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; //TODO: Fill in with actual value - /* Protocol__PrpSiConfig *si_config; */ - /* si_config = malloc(sizeof(Protocol__PrpSiConfig)); */ + /* Protocol__FlexSiConfig *si_config; */ + /* si_config = malloc(sizeof(Protocol__FlexSiConfig)); */ /* if(si_config == NULL) */ /* goto error; */ - /* protocol__prp_si_config__init(si_config); */ + /* protocol__flex_si_config__init(si_config); */ /* //TODO: Fill in with actual value, Frame number to apply the SI configuration */ /* si_config->sfn = 1; */ /* si_config->has_sfn = 1; */ @@ -1928,15 +1928,15 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr /* si_config->has_si_window_length = 1; */ /* //TODO: Fill in with actual value, the number of SI messages */ /* si_config->n_si_message=1; */ - /* Protocol__PrpSiMessage **si_message; */ - /* si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); */ + /* 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__PrpSiMessage)); */ + /* si_message[j] = malloc(sizeof(Protocol__FlexSiMessage)); */ /* if(si_message[j] == NULL) */ /* goto error; */ - /* protocol__prp_si_message__init(si_message[j]); */ + /* 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; */ @@ -1955,29 +1955,29 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //TODO: Fill in with actual value, the UL transmission bandwidth in RBs cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of PRUCPL values + //TODO: Fill in with actual value, one of FLUCPL values if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_NORMAL; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_EXTENDED; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of PRUCPL values + //TODO: Fill in with actual value, one of FLUCPL values if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_NORMAL; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_EXTENDED; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; } cell_conf[i]->has_dl_cyclic_prefix_length = 1; //TODO: Fill in with actual value, number of cell specific antenna ports cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of PRDM values + //TODO: Fill in with actual value, one of FLDM values if(get_duplex_mode(enb_id,i) == 1){ - cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_FDD; + cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; }else if(get_duplex_mode(enb_id,i) == 0){ - cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_TDD; + cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only @@ -2052,11 +2052,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the PREQ_ values + //TODO: Fill in with actual value, One of the FLEQ_ values if(get_enable64QAM(enb_id,i) == 0){ - cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_16QAM; + cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; }else if(get_enable64QAM(enb_id,i) == 1){ - cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_64QAM; + cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; //TODO: Fill in with actual value, Carrier component index @@ -2065,12 +2065,12 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr } enb_config_reply_msg->cell_config=cell_conf; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->enb_config_reply_msg = enb_config_reply_msg; return 0; @@ -2104,7 +2104,7 @@ err_code_t enb_agent_init_timer(void){ memset(&e, 0, sizeof(enb_agent_timer_element_t)); RB_INSERT(enb_agent_map, &agent_map, &e); */ - return PROTOCOL__PROGRAN_ERR__NO_ERR; + return PROTOCOL__FLEXRAN_ERR__NO_ERR; } RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); @@ -2190,7 +2190,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){ if (e != NULL ) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2211,7 +2211,7 @@ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { if (e->xid == xid) { timer_id = e->timer_id; RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); if (timer_remove(timer_id) < 0 ) { goto error; @@ -2232,7 +2232,7 @@ err_code_t enb_agent_destroy_timers(void){ RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); timer_remove(e->timer_id); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2310,7 +2310,7 @@ err_code_t enb_agent_restart_timer(uint32_t *timer_id){ } if (ret < 0 ) { - return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED; + return PROTOCOL__FLEXRAN_ERR__TIMER_SETUP_FAILED; } return 0; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 18c9129989..b5a35ec338 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -29,7 +29,7 @@ /*! \file enb_agent_common.h * \brief common message primitves and utilities - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -42,7 +42,7 @@ #include #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" @@ -56,72 +56,72 @@ # include "intertask_interface.h" # include "timer.h" -#define PROGRAN_VERSION 0 +#define FLEXRAN_VERSION 0 typedef int (*enb_agent_message_decoded_callback)( mid_t mod_id, const void *params, - Protocol__ProgranMessage **msg + Protocol__FlexranMessage **msg ); typedef int (*enb_agent_message_destruction_callback)( - Protocol__ProgranMessage *msg + Protocol__FlexranMessage *msg ); /********************************** - * progRAN protocol messages helper + * FlexRAN protocol messages helper * functions and generic handlers **********************************/ -int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); -int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); +int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); -void * enb_agent_pack_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); -err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); +err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); -int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); +int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); -int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); +int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); -int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); +int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); -int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); +int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); -int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); +int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg); +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); -Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); -Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); +Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); @@ -145,7 +145,7 @@ 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*/ + Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); @@ -287,7 +287,7 @@ int get_direction(mid_t ue_id, mid_t lc_id); /* Type of the callback executed when the timer expired */ -typedef Protocol__ProgranMessage *(*enb_agent_timer_callback_t)(void*); +typedef Protocol__FlexranMessage *(*enb_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ @@ -319,7 +319,7 @@ typedef enum { typedef struct enb_agent_timer_args_s{ mid_t mod_id; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; } enb_agent_timer_args_t; @@ -371,7 +371,7 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index da53343818..46459f98bc 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -29,7 +29,7 @@ /*! \file enb_agent_handler.c * \brief enb agent tx and rx message handler - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -42,23 +42,23 @@ #include "assertions.h" enb_agent_message_decoded_callback agent_messages_callback[][3] = { - {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ - {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ - {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ - {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ - {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ + {enb_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply + {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ + {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ + {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ + {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ + {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ + {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ + {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; enb_agent_message_destruction_callback message_destruction_callback[] = { @@ -89,27 +89,27 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size){ - Protocol__ProgranMessage *decoded_message, *reply_message; + Protocol__FlexranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { - err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; + err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; goto error; } if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || - (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ - err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; + (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; goto error; } if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { - err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; + err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_SUPPORTED; goto error; } @@ -118,7 +118,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, 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__progran_message__free_unpacked(decoded_message, NULL); + protocol__flexran_message__free_unpacked(decoded_message, NULL); } return reply_message; @@ -130,14 +130,14 @@ error: -void * enb_agent_pack_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size){ void * buffer; - err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; + err_code_t err_code = PROTOCOL__FLEXRAN_ERR__NO_ERR; if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENCODING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENCODING; goto error; } @@ -157,11 +157,11 @@ void * enb_agent_pack_message(Protocol__ProgranMessage *msg, return NULL; } -Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { +Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { err_code_t err_code; enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; - Protocol__ProgranMessage *timed_task, *reply_message; + Protocol__FlexranMessage *timed_task, *reply_message; timed_task = timer_args->msg; err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ @@ -175,7 +175,7 @@ Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { return NULL; } -Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__FlexranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); @@ -192,6 +192,6 @@ Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_a return TIMER_ELEMENT_NOT_FOUND; } -err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg) { +err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { return ((*message_destruction_callback[msg->msg_case-1])(msg)); } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 744768135e..d040622a02 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -29,7 +29,7 @@ /*! \file enb_agent_mac.c * \brief enb agent message handler for MAC layer - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -61,7 +61,7 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -86,16 +86,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr uint32_t ue_flags = 0; uint32_t c_flags = 0; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; + Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; xid = (stats_req->header)->xid; // Check the type of request that is made switch(stats_req->body_case) { - case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; - Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; + Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; + if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) { /*Disable both periodic and continuous updates*/ enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); @@ -133,12 +133,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr report_config.cc_report_type[i].cc_report_flags = c_flags; } /* Check if request was periodical */ - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { - /* Create a one off progran message as an argument for the periodical task */ - Protocol__ProgranMessage *timer_msg; + 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__PRP_STATS_TYPE__PRST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + 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) { @@ -170,13 +170,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + } 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*/ enb_agent_disable_cont_mac_stats_update(mod_id); stats_request_config_t request_config; - request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + 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) { @@ -195,8 +195,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr } } break; - case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; - Protocol__PrpCellStatsRequest *cell_req = stats_req->cell_stats_request; + case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; + Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request; // UE report config will be blank report_config.nr_ue = 0; report_config.ue_report_type = NULL; @@ -213,8 +213,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr report_config.cc_report_type[i].cc_report_flags = cell_req->flags; } break; - case PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST:; - Protocol__PrpUeStatsRequest *ue_req = stats_req->ue_stats_request; + case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:; + Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request; // Cell report config will be blank report_config.nr_cc = 0; report_config.cc_report_type = NULL; @@ -237,7 +237,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr } if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ - err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } @@ -254,32 +254,32 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, - Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) goto error; - Protocol__PrpStatsRequest *stats_request_msg; - stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); + Protocol__FlexStatsRequest *stats_request_msg; + stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest)); if(stats_request_msg == NULL) goto error; - protocol__prp_stats_request__init(stats_request_msg); + protocol__flex_stats_request__init(stats_request_msg); stats_request_msg->header = header; stats_request_msg->type = report_config->report_type; stats_request_msg->has_type = 1; switch (report_config->report_type) { - case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; - Protocol__PrpCompleteStatsRequest *complete_stats; - complete_stats = malloc(sizeof(Protocol__PrpCompleteStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; + Protocol__FlexCompleteStatsRequest *complete_stats; + complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest)); if(complete_stats == NULL) goto error; - protocol__prp_complete_stats_request__init(complete_stats); + protocol__flex_complete_stats_request__init(complete_stats); complete_stats->report_frequency = report_config->report_frequency; complete_stats->has_report_frequency = 1; complete_stats->sf = report_config->period; @@ -294,13 +294,13 @@ int enb_agent_mac_stats_request(mid_t mod_id, } stats_request_msg->complete_stats_request = complete_stats; break; - case PROTOCOL__PRP_STATS_TYPE__PRST_CELL_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST; - Protocol__PrpCellStatsRequest *cell_stats; - cell_stats = malloc(sizeof(Protocol__PrpCellStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST; + Protocol__FlexCellStatsRequest *cell_stats; + cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest)); if(cell_stats == NULL) goto error; - protocol__prp_cell_stats_request__init(cell_stats); + protocol__flex_cell_stats_request__init(cell_stats); cell_stats->n_cell = report_config->config->nr_cc; cell_stats->has_flags = 1; if (cell_stats->n_cell > 0) { @@ -314,13 +314,13 @@ int enb_agent_mac_stats_request(mid_t mod_id, } stats_request_msg->cell_stats_request = cell_stats; break; - case PROTOCOL__PRP_STATS_TYPE__PRST_UE_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST; - Protocol__PrpUeStatsRequest *ue_stats; - ue_stats = malloc(sizeof(Protocol__PrpUeStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST; + Protocol__FlexUeStatsRequest *ue_stats; + ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest)); if(ue_stats == NULL) goto error; - protocol__prp_ue_stats_request__init(ue_stats); + protocol__flex_ue_stats_request__init(ue_stats); ue_stats->n_rnti = report_config->config->nr_ue; ue_stats->has_flags = 1; if (ue_stats->n_rnti > 0) { @@ -337,12 +337,12 @@ int enb_agent_mac_stats_request(mid_t mod_id, default: goto error; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->stats_request_msg = stats_request_msg; return 0; @@ -358,14 +358,14 @@ int enb_agent_mac_stats_request(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG) +int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) goto error; free(msg->stats_request_msg->header); - if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { + if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { free(msg->stats_request_msg->cell_stats_request->cell); } - if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST) { + if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) { free(msg->stats_request_msg->ue_stats_request->rnti); } free(msg->stats_request_msg); @@ -380,8 +380,8 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, - Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i, j, k; int cc_id = 0; int enb_id = mod_id; @@ -389,31 +389,31 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //UE_list_t *eNB_UE_list= &eNB->UE_list; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) goto error; - Protocol__PrpStatsReply *stats_reply_msg; - stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + Protocol__FlexStatsReply *stats_reply_msg; + stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); if (stats_reply_msg == NULL) goto error; - protocol__prp_stats_reply__init(stats_reply_msg); + protocol__flex_stats_reply__init(stats_reply_msg); stats_reply_msg->header = header; stats_reply_msg->n_ue_report = report_config->nr_ue; stats_reply_msg->n_cell_report = report_config->nr_cc; - Protocol__PrpUeStatsReport **ue_report; - Protocol__PrpCellStatsReport **cell_report; + Protocol__FlexUeStatsReport **ue_report; + Protocol__FlexCellStatsReport **cell_report; /* Allocate memory for list of UE reports */ if (report_config->nr_ue > 0) { - ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); + ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); if (ue_report == NULL) goto error; for (i = 0; i < report_config->nr_ue; i++) { - ue_report[i] = malloc(sizeof(Protocol__PrpUeStatsReport)); - protocol__prp_ue_stats_report__init(ue_report[i]); + ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); + 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; @@ -421,9 +421,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check the types of reports that need to be constructed based on flag values */ /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { - //TODO: Create a report for each LCG (4 elements). See prp_ue_stats_report of - // progRAN specifications for more details + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { + //TODO: Create a report for each LCG (4 elements). See flex_ue_stats_report of + // FlexRAN specifications for more details ue_report[i]->n_bsr = 4; uint32_t *elem; elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); @@ -438,28 +438,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of PRH report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI ue_report[i]->phr = 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; } /* Check flag for creation of RLC buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { // TODO: Fill in the actual RLC buffer status reports ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE - Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); + Protocol__FlexRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { - rlc_reports[j] = malloc(sizeof(Protocol__PrpRlcBsr)); + rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); if (rlc_reports[j] == NULL) goto error; - protocol__prp_rlc_bsr__init(rlc_reports[j]); + protocol__flex_rlc_bsr__init(rlc_reports[j]); //TODO:Set logical channel id rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; @@ -485,38 +485,38 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of MAC CE buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the - PROTOCOL__PRP_CE_TYPE__PRPCET_ values + PROTOCOL__FLEX_CE_TYPE__FLPCET_ values found in stats_common.pb-c.h. See - prp_ce_type in progRAN specification */ + flex_ce_type in FlexRAN specification */ ue_report[i]->has_pending_mac_ces = 1; } /* Check flag for creation of DL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { // TODO: Fill in the actual DL CQI report for the UE based on its configuration - Protocol__PrpDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + Protocol__FlexDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); if (dl_report == NULL) goto error; - protocol__prp_dl_cqi_report__init(dl_report); + protocol__flex_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = get_active_CC(enb_id,i); //TODO:Create the actual CSI reports. - Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); + Protocol__FlexDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { - csi_reports[j] = malloc(sizeof(Protocol__PrpDlCsi)); + csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); if (csi_reports[j] == NULL) goto error; - protocol__prp_dl_csi__init(csi_reports[j]); + protocol__flex_dl_csi__init(csi_reports[j]); //TODO: the servCellIndex for this report csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; @@ -526,16 +526,16 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: the type of CSI report based on the configuration of the UE //For this example we use type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and - //in the progRAN specifications - csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + //in the FlexRAN specifications + csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; - if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P10CSI){ - Protocol__PrpCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI; + if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI){ + Protocol__FlexCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__FlexCsiP10)); if (csi10 == NULL) goto error; - protocol__prp_csi_p10__init(csi10); + protocol__flex_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; @@ -543,28 +543,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P11CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P20CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P21CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A12CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A22CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A20CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A30CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A31CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI){ } } @@ -575,26 +575,26 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of paging buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI //set in the report must be a P-RNTI - Protocol__PrpPagingBufferReport *paging_report; - paging_report = malloc(sizeof(Protocol__PrpPagingBufferReport)); + Protocol__FlexPagingBufferReport *paging_report; + paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport)); if (paging_report == NULL) goto error; - protocol__prp_paging_buffer_report__init(paging_report); + protocol__flex_paging_buffer_report__init(paging_report); //Set the number of pending paging messages paging_report->n_paging_info = 1; //Provide a report for each pending paging message - Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); + Protocol__FlexPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { - p_info[j] = malloc(sizeof(Protocol__PrpPagingInfo)); + p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); if(p_info[j] == NULL) goto error; - protocol__prp_paging_info__init(p_info[j]); + protocol__flex_paging_info__init(p_info[j]); //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller p_info[j]->paging_index = 10; @@ -616,35 +616,35 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of UL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { //Fill in the full UL CQI report of the UE - Protocol__PrpUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + Protocol__FlexUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); if(full_ul_report == NULL) goto error; - protocol__prp_ul_cqi_report__init(full_ul_report); + protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report full_ul_report->sfn_sn = get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex full_ul_report->n_cqi_meas = 1; - Protocol__PrpUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + Protocol__FlexUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); if(ul_report == NULL) goto error; //Fill each UL report of the UE for each of the configured report types for(j = 0; j < full_ul_report->n_cqi_meas; j++) { - ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); + ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); if(ul_report[j] == NULL) goto error; - protocol__prp_ul_cqi__init(ul_report[j]); + protocol__flex_ul_cqi__init(ul_report[j]); //TODO: Set the type of the UL report. As an example set it to SRS UL report - // See enum prp_ul_cqi_type in progRAN specification for more details - ul_report[j]->type = PROTOCOL__PRP_UL_CQI_TYPE__PRUCT_SRS; + // See enum flex_ul_cqi_type in FlexRAN specification for more details + ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS; ul_report[j]->has_type = 1; //TODO:Set the number of SINR measurements based on the report type - //See struct prp_ul_cqi in progRAN specification for more details + //See struct flex_ul_cqi in FlexRAN specification for more details ul_report[j]->n_sinr = 100; uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); @@ -663,11 +663,11 @@ int enb_agent_mac_stats_reply(mid_t mod_id, full_ul_report->cqi_meas = ul_report; full_ul_report->n_pucch_dbm = MAX_NUM_CCs; - full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm); for (j = 0; j < MAX_NUM_CCs; j++) { - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); - protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm)); + protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; full_ul_report->pucch_dbm[j]->serv_cell_index = j; if(get_p0_pucch_dbm(enb_id,i, j) != -1){ @@ -687,28 +687,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Allocate memory for list of cell reports */ if (report_config->nr_cc > 0) { - cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *) * report_config->nr_cc); + cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); if (cell_report == NULL) goto error; // Fill in the Cell reports for (i = 0; i < report_config->nr_cc; i++) { - cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); + cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); if(cell_report[i] == NULL) goto error; - protocol__prp_cell_stats_report__init(cell_report[i]); + 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; /* Check flag for creation of noise and interference report */ - if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { // TODO: Fill in the actual noise and interference report for this cell - Protocol__PrpNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + Protocol__FlexNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); if(ni_report == NULL) goto error; - protocol__prp_noise_interference_report__init(ni_report); + protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; @@ -728,12 +728,12 @@ int enb_agent_mac_stats_reply(mid_t mod_id, stats_reply_msg->cell_report = cell_report; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->stats_reply_msg = stats_reply_msg; return 0; @@ -749,17 +749,17 @@ int enb_agent_mac_stats_reply(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { //TODO: Need to deallocate memory for the stats reply message - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) goto error; free(msg->stats_reply_msg->header); int i, j, k; - Protocol__PrpStatsReply *reply = msg->stats_reply_msg; - Protocol__PrpDlCqiReport *dl_report; - Protocol__PrpUlCqiReport *ul_report; - Protocol__PrpPagingBufferReport *paging_report; + Protocol__FlexStatsReply *reply = msg->stats_reply_msg; + Protocol__FlexDlCqiReport *dl_report; + Protocol__FlexUlCqiReport *ul_report; + Protocol__FlexPagingBufferReport *paging_report; // Free the memory for the UE reports for (i = 0; i < reply->n_ue_report; i++) { @@ -769,47 +769,47 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(reply->ue_report[i]->rlc_report); // If DL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { dl_report = reply->ue_report[i]->dl_cqi_report; // Delete all CSI reports for (j = 0; j < dl_report->n_csi_report; j++) { //Must free memory based on the type of report switch(dl_report->csi_report[j]->report_case) { - case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: free(dl_report->csi_report[j]->p10csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: free(dl_report->csi_report[j]->p11csi->wb_cqi); free(dl_report->csi_report[j]->p11csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: free(dl_report->csi_report[j]->p20csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: free(dl_report->csi_report[j]->p21csi->wb_cqi); free(dl_report->csi_report[j]->p21csi->sb_cqi); free(dl_report->csi_report[j]->p21csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: free(dl_report->csi_report[j]->a12csi->wb_cqi); free(dl_report->csi_report[j]->a12csi->sb_pmi); free(dl_report->csi_report[j]->a12csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: free(dl_report->csi_report[j]->a22csi->wb_cqi); free(dl_report->csi_report[j]->a22csi->sb_cqi); free(dl_report->csi_report[j]->a22csi->sb_list); free(dl_report->csi_report[j]->a22csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: free(dl_report->csi_report[j]->a20csi->sb_list); free(dl_report->csi_report[j]->a20csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: free(dl_report->csi_report[j]->a30csi->sb_cqi); free(dl_report->csi_report[j]->a30csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: free(dl_report->csi_report[j]->a31csi->wb_cqi); for (k = 0; k < dl_report->csi_report[j]->a31csi->n_sb_cqi; k++) { free(dl_report->csi_report[j]->a31csi->sb_cqi[k]); @@ -824,7 +824,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(dl_report); } // If Paging buffer report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { paging_report = reply->ue_report[i]->pbr; // Delete all paging buffer reports for (j = 0; j < paging_report->n_paging_info; j++) { @@ -834,7 +834,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(paging_report); } // If UL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { ul_report = reply->ue_report[i]->ul_cqi_report; for (j = 0; j < ul_report->n_cqi_meas; j++) { free(ul_report->cqi_meas[j]->sinr); @@ -866,19 +866,19 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_SR_INFO, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) goto error; - Protocol__PrpUlSrInfo *ul_sr_info_msg; - ul_sr_info_msg = malloc(sizeof(Protocol__PrpUlSrInfo)); + Protocol__FlexUlSrInfo *ul_sr_info_msg; + ul_sr_info_msg = malloc(sizeof(Protocol__FlexUlSrInfo)); if (ul_sr_info_msg == NULL) { goto error; } - protocol__prp_ul_sr_info__init(ul_sr_info_msg); + protocol__flex_ul_sr_info__init(ul_sr_info_msg); ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; @@ -895,12 +895,12 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes ul_sr_info_msg->rnti[i] = 1; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->ul_sr_info_msg = ul_sr_info_msg; return 0; @@ -918,8 +918,8 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes return -1; } -int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG) +int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG) goto error; free(msg->ul_sr_info_msg->header); @@ -933,19 +933,19 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i,j; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_SF_TRIGGER, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) goto error; - Protocol__PrpSfTrigger *sf_trigger_msg; - sf_trigger_msg = malloc(sizeof(Protocol__PrpSfTrigger)); + Protocol__FlexSfTrigger *sf_trigger_msg; + sf_trigger_msg = malloc(sizeof(Protocol__FlexSfTrigger)); if (sf_trigger_msg == NULL) { goto error; } - protocol__prp_sf_trigger__init(sf_trigger_msg); + protocol__flex_sf_trigger__init(sf_trigger_msg); frame_t frame; sub_frame_t subframe; @@ -974,18 +974,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran */ sf_trigger_msg->n_dl_info = get_num_ues(mod_id); - Protocol__PrpDlInfo **dl_info = NULL; + Protocol__FlexDlInfo **dl_info = NULL; if (sf_trigger_msg->n_dl_info > 0) { - dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * sf_trigger_msg->n_dl_info); + dl_info = malloc(sizeof(Protocol__FlexDlInfo *) * sf_trigger_msg->n_dl_info); if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE for(i = 0; i < sf_trigger_msg->n_dl_info; i++) { - dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); + dl_info[i] = malloc(sizeof(Protocol__FlexDlInfo)); if(dl_info[i] == NULL) goto error; - protocol__prp_dl_info__init(dl_info[i]); + protocol__flex_dl_info__init(dl_info[i]); dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ @@ -1000,9 +1000,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK; else if (harq_status == 1) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; + dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1017,18 +1017,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); - Protocol__PrpUlInfo **ul_info = NULL; + Protocol__FlexUlInfo **ul_info = NULL; if (sf_trigger_msg->n_ul_info > 0) { - ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * sf_trigger_msg->n_ul_info); + ul_info = malloc(sizeof(Protocol__FlexUlInfo *) * sf_trigger_msg->n_ul_info); if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE for(i = 0; i < sf_trigger_msg->n_ul_info; i++) { - ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); + ul_info[i] = malloc(sizeof(Protocol__FlexUlInfo)); if(ul_info[i] == NULL) goto error; - protocol__prp_ul_info__init(ul_info[i]); + protocol__flex_ul_info__init(ul_info[i]); ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*TODO: fill in the Tx power control command for this UE (if available)*/ @@ -1048,7 +1048,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->ul_reception[j] = 100; } /*TODO: Fill in the reception status for each UEs data*/ - ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; + ul_info[i]->reception_status = PROTOCOL__FLEX_RECEPTION_STATUS__FLRS_OK; ul_info[i]->has_reception_status = 1; /*TODO: fill in the serving cell index for this UE */ ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1058,12 +1058,12 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran sf_trigger_msg->ul_info = ul_info; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; @@ -1087,9 +1087,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran return -1; } -int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; free(msg->sf_trigger_msg->header); @@ -1113,30 +1113,30 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg) { +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { int xid = 0; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_MAC_CONFIG, &header) != 0) + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) goto error; - Protocol__PrpDlMacConfig *dl_mac_config_msg; - dl_mac_config_msg = malloc(sizeof(Protocol__PrpDlMacConfig)); + Protocol__FlexDlMacConfig *dl_mac_config_msg; + dl_mac_config_msg = malloc(sizeof(Protocol__FlexDlMacConfig)); if (dl_mac_config_msg == NULL) { goto error; } - protocol__prp_dl_mac_config__init(dl_mac_config_msg); + protocol__flex_dl_mac_config__init(dl_mac_config_msg); dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->dl_mac_config_msg = dl_mac_config_msg; return 0; @@ -1145,12 +1145,12 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage return -1; } -int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { int i,j, k; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) goto error; - Protocol__PrpDlDci *dl_dci; + Protocol__FlexDlDci *dl_dci; free(msg->dl_mac_config_msg->header); for (i = 0; i < msg->dl_mac_config_msg->n_dl_ue_data; i++) { @@ -1208,7 +1208,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg) { +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; @@ -1220,11 +1220,11 @@ void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage } } -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; enum lfds700_misc_flag overwrite_occurred_flag; - Protocol__ProgranMessage *overwritten_dl_config; + Protocol__FlexranMessage *overwritten_dl_config; LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; lfds700_misc_prng_init(&ls); @@ -1264,7 +1264,7 @@ void enb_agent_init_mac_agent(mid_t mod_id) { void enb_agent_send_sr_info(mid_t mod_id) { int size; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int priority; err_code_t err_code; @@ -1281,7 +1281,7 @@ void enb_agent_send_sr_info(mid_t mod_id) { data=enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1294,7 +1294,7 @@ void enb_agent_send_sr_info(mid_t mod_id) { void enb_agent_send_sf_trigger(mid_t mod_id) { int size; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int priority; err_code_t err_code; @@ -1311,7 +1311,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { data=enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1324,7 +1324,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { void enb_agent_send_update_mac_stats(mid_t mod_id) { - Protocol__ProgranMessage *current_report = NULL, *msg; + Protocol__FlexranMessage *current_report = NULL, *msg; void *data; int size; err_code_t err_code; @@ -1352,7 +1352,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ /* /\*Destroy the old stats*\/ */ - /* enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ /* } */ /* /\*Use the current report for future comparissons*\/ */ /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ @@ -1366,7 +1366,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { data=enb_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1447,8 +1447,8 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].is_initialized = 0; - enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); mac_agent_registered[mod_id] = NULL; @@ -1463,7 +1463,7 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, goto error; } - Protocol__ProgranMessage *req_msg; + Protocol__FlexranMessage *req_msg; enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; @@ -1490,10 +1490,10 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].xid = 0; if (mac_stats_context[mod_id].stats_req != NULL) { - enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); } if (mac_stats_context[mod_id].prev_stats_reply != NULL) { - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); } if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 2a8f4c3a40..a6b9a0fe80 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -29,7 +29,7 @@ /*! \file enb_agent_mac.h * \brief enb agent message handler APIs for MAC layer - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -38,7 +38,7 @@ #define ENB_AGENT_MAC_H_ #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" @@ -52,14 +52,14 @@ typedef struct { uint16_t ue_rnti; uint32_t ue_report_flags; /* Indicates the report elements required for this UE id. See - ProgRAN specification 1.2.4.2 */ + FlexRAN specification 1.2.4.2 */ } ue_report_type_t; typedef struct { uint16_t cc_id; uint32_t cc_report_flags; /* Indicates the report elements required for this CC index. See - ProgRAN specification 1.2.4.3 */ + FlexRAN specification 1.2.4.3 */ } cc_report_type_t; typedef struct { @@ -79,29 +79,29 @@ typedef struct stats_request_config_s{ /* Initialization function for the agent structures etc */ void enb_agent_init_mac_agent(mid_t mod_id); -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); -int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg); +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /********************************** @@ -119,7 +119,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id); void enb_agent_send_update_mac_stats(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg); +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 1511ee7262..cf473cae7d 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -39,7 +39,7 @@ #define __ENB_AGENT_MAC_PRIMITIVES_H__ #include "enb_agent_defs.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "header.pb-c.h" #define RINGBUFFER_SIZE 100 @@ -60,13 +60,13 @@ typedef struct { /// Provide to the scheduler a pending dl_mac_config message void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, - Protocol__ProgranMessage **msg); + Protocol__FlexranMessage **msg); - /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that - /// dl_info is already initialized as prp_dl_mac_config and fills the - /// prp_dl_data part of it + /// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that + /// dl_info is already initialized as flex_dl_mac_config and fills the + /// flex_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /// Notify the controller for a state change of a particular UE, by sending the proper diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index 4d5ba34610..b42b3ac79b 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -39,20 +39,20 @@ #include "enb_agent_mac_internal.h" -Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, - Protocol__ProgranMessage *old_message) { +Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, + Protocol__FlexranMessage *old_message) { int i, j; - Protocol__PrpStatsReply *old_report, *new_report; + Protocol__FlexStatsReply *old_report, *new_report; - Protocol__PrpStatsReply *stats_reply_msg = NULL; - Protocol__ProgranMessage *msg = NULL; + Protocol__FlexStatsReply *stats_reply_msg = NULL; + Protocol__FlexranMessage *msg = NULL; - Protocol__PrpUeStatsReport **ue_report; - Protocol__PrpUeStatsReport *tmp_ue_report[NUM_MAX_UE]; - Protocol__PrpCellStatsReport **cell_report; - Protocol__PrpCellStatsReport *tmp_cell_report[NUM_MAX_UE]; + Protocol__FlexUeStatsReport **ue_report; + Protocol__FlexUeStatsReport *tmp_ue_report[NUM_MAX_UE]; + Protocol__FlexCellStatsReport **cell_report; + Protocol__FlexCellStatsReport *tmp_cell_report[NUM_MAX_UE]; old_report = old_message->stats_reply_msg; new_report = new_message->stats_reply_msg; @@ -113,7 +113,7 @@ Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Pr /*TODO: create the reply message based on the findings*/ /*Create ue report list*/ if (n_ue_report > 0) { - ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *)); + ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *)); for (i = 0; i 0) { - cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *)); + cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *)); for (i = 0; i 0 || n_ue_report > 0) { /*Create header*/ int xid = old_report->header->xid; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) { + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } - stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); - protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); + protocol__flex_stats_reply__init(stats_reply_msg); stats_reply_msg->header = header; stats_reply_msg->n_ue_report = n_ue_report; stats_reply_msg->ue_report = ue_report; stats_reply_msg->n_cell_report = n_cell_report; stats_reply_msg->cell_report = cell_report; - msg = malloc(sizeof(Protocol__ProgranMessage)); + msg = malloc(sizeof(Protocol__FlexranMessage)); if(msg == NULL) goto error; - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(msg); + msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; + msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; msg->stats_reply_msg = stats_reply_msg; } return msg; @@ -155,28 +155,28 @@ Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Pr return NULL; } -int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, - Protocol__PrpUeStatsReport *rep2) { +int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, + Protocol__FlexUeStatsReport *rep2) { return 1; } -int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, - Protocol__PrpCellStatsReport *rep2) { +int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, + Protocol__FlexCellStatsReport *rep2) { return 1; } -Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original) { +Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original) { int i; - Protocol__PrpUeStatsReport *copy = malloc(sizeof(Protocol__PrpUeStatsReport)); + Protocol__FlexUeStatsReport *copy = malloc(sizeof(Protocol__FlexUeStatsReport)); if (copy == NULL) goto error; - protocol__prp_ue_stats_report__init(copy); + protocol__flex_ue_stats_report__init(copy); copy->rnti = original->rnti; copy->has_rnti = original->has_rnti; copy->flags = original->flags; copy->has_flags = original->has_flags; - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { copy->n_bsr = original->n_bsr; if (copy->n_bsr > 0) { uint32_t *elem; @@ -190,16 +190,16 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o } } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { copy->has_phr = original->has_phr; copy->phr = original->phr; } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { copy->n_rlc_report = original->n_rlc_report; if (copy->n_rlc_report > 0) { - Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * copy->n_rlc_report); + Protocol__FlexRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr) * copy->n_rlc_report); if (rlc_reports == NULL) goto error; for (i = 0; i < copy->n_rlc_report; i++) { @@ -209,22 +209,22 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o } } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { copy->has_pending_mac_ces = original->has_pending_mac_ces; copy->pending_mac_ces = original->pending_mac_ces; } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { copy->dl_cqi_report = copy_dl_cqi_report(original->dl_cqi_report); } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { /*Copy the Paging Buffer report*/ copy->pbr = copy_paging_buffer_report(original->pbr); } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { /*TODO: Copy the UL report*/ copy->ul_cqi_report = copy_ul_cqi_report(original->ul_cqi_report); } @@ -235,11 +235,11 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o return NULL; } -Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { - Protocol__PrpRlcBsr * copy = malloc(sizeof(Protocol__PrpRlcBsr)); +Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original) { + Protocol__FlexRlcBsr * copy = malloc(sizeof(Protocol__FlexRlcBsr)); if (copy == NULL) goto error; - protocol__prp_rlc_bsr__init(copy); + protocol__flex_rlc_bsr__init(copy); copy->lc_id = original->lc_id; copy->has_lc_id = original->has_lc_id; copy->tx_queue_size = original->tx_queue_size; @@ -259,30 +259,30 @@ Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { return NULL; } -Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original) { +Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original) { int i, j; //Fill in the full UL CQI report of the UE - Protocol__PrpUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + Protocol__FlexUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); if(full_ul_report == NULL) { goto error; } - protocol__prp_ul_cqi_report__init(full_ul_report); + protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report full_ul_report->sfn_sn = original->sfn_sn; full_ul_report->has_sfn_sn = original->has_sfn_sn; full_ul_report->n_cqi_meas = original->n_cqi_meas; - Protocol__PrpUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + Protocol__FlexUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); if(ul_report == NULL) goto error; for(i = 0; i++; i < full_ul_report->n_cqi_meas) { - ul_report[i] = malloc(sizeof(Protocol__PrpUlCqi)); + ul_report[i] = malloc(sizeof(Protocol__FlexUlCqi)); if(ul_report[i] == NULL) goto error; - protocol__prp_ul_cqi__init(ul_report[i]); + protocol__flex_ul_cqi__init(ul_report[i]); ul_report[i]->type = original->cqi_meas[i]->type; ul_report[i]->has_type = original->cqi_meas[i]->has_type; ul_report[i]->n_sinr = original->cqi_meas[i]->n_sinr; @@ -305,21 +305,21 @@ Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * origina return NULL; } -Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original) { +Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original) { int i; /*Copy the DL report*/ - Protocol__PrpDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + Protocol__FlexDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); if (dl_report == NULL) goto error; - protocol__prp_dl_cqi_report__init(dl_report); + protocol__flex_dl_cqi_report__init(dl_report); dl_report->sfn_sn = original->sfn_sn; dl_report->has_sfn_sn = original->has_sfn_sn; dl_report->n_csi_report = original->n_csi_report; - Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *) * dl_report->n_csi_report); + Protocol__FlexDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__FlexDlCsi *) * dl_report->n_csi_report); if (csi_reports == NULL) goto error; @@ -334,26 +334,26 @@ Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * origina return NULL; } -Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original) { +Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original) { int i; - Protocol__PrpPagingBufferReport *copy; - copy = malloc(sizeof(Protocol__PrpPagingBufferReport)); + Protocol__FlexPagingBufferReport *copy; + copy = malloc(sizeof(Protocol__FlexPagingBufferReport)); if (copy == NULL) goto error; - protocol__prp_paging_buffer_report__init(copy); + protocol__flex_paging_buffer_report__init(copy); copy->n_paging_info = original->n_paging_info; - Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * copy->n_paging_info); + Protocol__FlexPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * copy->n_paging_info); if (p_info == NULL) goto error; for (i = 0; i < copy->n_paging_info; i++) { - p_info[i] = malloc(sizeof(Protocol__PrpPagingInfo)); + p_info[i] = malloc(sizeof(Protocol__FlexPagingInfo)); if(p_info[i] == NULL) goto error; - protocol__prp_paging_info__init(p_info[i]); + protocol__flex_paging_info__init(p_info[i]); p_info[i]->paging_index = original->paging_info[i]->paging_index; p_info[i]->has_paging_index = original->paging_info[i]->has_paging_index;; p_info[i]->paging_message_size = original->paging_info[i]->paging_message_size; @@ -371,12 +371,12 @@ Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingB return NULL; } -Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { +Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original) { int i, j; - Protocol__PrpDlCsi *copy = malloc(sizeof(Protocol__PrpDlCsi)); + Protocol__FlexDlCsi *copy = malloc(sizeof(Protocol__FlexDlCsi)); if (copy == NULL) goto error; - protocol__prp_dl_csi__init(copy); + protocol__flex_dl_csi__init(copy); copy->serv_cell_index = original->serv_cell_index; copy->has_serv_cell_index = original->has_serv_cell_index; copy->ri = original->ri; @@ -387,11 +387,11 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->report_case = original->report_case; switch (copy->report_case) { - case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: copy->p10csi->wb_cqi = original->p10csi->wb_cqi; copy->p10csi->has_wb_cqi = original->p10csi->has_wb_cqi; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: copy->p11csi->n_wb_cqi = original->p11csi->n_wb_cqi; copy->p11csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p11csi->n_wb_cqi); for (i = 0; i < copy->p11csi->n_wb_cqi; i++) { @@ -400,7 +400,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p11csi->has_wb_pmi = original->p11csi->has_wb_pmi; copy->p11csi->wb_pmi = original->p11csi->wb_pmi; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: copy->p20csi->has_wb_cqi = original->p20csi->has_wb_cqi; copy->p20csi->wb_cqi = original->p20csi->wb_cqi; copy->p20csi->has_sb_cqi = original->p20csi->has_sb_cqi; @@ -410,7 +410,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p20csi->has_sb_index = original->p20csi->has_sb_index; copy->p20csi->sb_index = original->p20csi->sb_index; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: copy->p21csi->n_wb_cqi = original->p21csi->n_wb_cqi; copy->p21csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_wb_cqi); for (i = 0; i < copy->p21csi->n_wb_cqi; i++) { @@ -428,7 +428,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p21csi->has_sb_index = original->p21csi->has_sb_index; copy->p21csi->sb_index = original->p21csi->sb_index; break; - case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: copy->a12csi->n_wb_cqi = original->a12csi->n_wb_cqi; copy->a12csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_wb_cqi); for (i = 0; i < copy->a12csi->n_wb_cqi; i++) { @@ -440,7 +440,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a12csi->sb_pmi[i] = original->a12csi->sb_pmi[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: copy->a22csi->n_wb_cqi = original->a22csi->n_wb_cqi; copy->a22csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_wb_cqi); for (i = 0; i < copy->a22csi->n_wb_cqi; i++) { @@ -461,7 +461,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a22csi->sb_list[i] = original->a22csi->sb_list[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: copy->a20csi->has_wb_cqi = original->a20csi->has_wb_cqi; copy->a20csi->wb_cqi = original->a20csi->wb_cqi; copy->a20csi->has_sb_cqi = original->a20csi->has_sb_cqi; @@ -472,7 +472,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a20csi->sb_list[i] = original->a20csi->sb_list[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: copy->a30csi->has_wb_cqi = original->a30csi->has_wb_cqi; copy->a30csi->wb_cqi = original->a30csi->wb_cqi; copy->a30csi->n_sb_cqi = original->a30csi->n_sb_cqi; @@ -481,7 +481,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a30csi->sb_cqi[i] = original->a30csi->sb_cqi[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: copy->a31csi->n_wb_cqi = original->a31csi->n_wb_cqi; copy->a31csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->n_wb_cqi); for (i = 0; i < copy->a31csi->n_wb_cqi; i++) { @@ -490,16 +490,16 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a31csi->has_wb_pmi = original->a31csi->has_wb_pmi; copy->a31csi->wb_pmi = original->a31csi->wb_pmi; copy->a31csi->n_sb_cqi = original->a31csi->n_sb_cqi; - copy->a31csi->sb_cqi = malloc(sizeof(Protocol__PrpMsbCqi *) * copy->a31csi->n_sb_cqi); + copy->a31csi->sb_cqi = malloc(sizeof(Protocol__FlexMsbCqi *) * copy->a31csi->n_sb_cqi); if (copy->a31csi == NULL) { goto error; } for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { - copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__PrpMsbCqi)); + copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__FlexMsbCqi)); if (copy->a31csi->sb_cqi[i] == NULL) { goto error; } - protocol__prp_msb_cqi__init(copy->a31csi->sb_cqi[i]); + protocol__flex_msb_cqi__init(copy->a31csi->sb_cqi[i]); copy->a31csi->sb_cqi[i]->n_sb_cqi = original->a31csi->sb_cqi[i]->n_sb_cqi; copy->a31csi->sb_cqi[i]->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->sb_cqi[i]->n_sb_cqi); for (j = 0; j < copy->a31csi->sb_cqi[i]->n_sb_cqi; j++) { @@ -516,20 +516,20 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { return NULL; } -Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original) { +Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original) { - Protocol__PrpCellStatsReport * copy = malloc(sizeof(Protocol__PrpCellStatsReport)); + Protocol__FlexCellStatsReport * copy = malloc(sizeof(Protocol__FlexCellStatsReport)); if(copy == NULL) { goto error; } - protocol__prp_cell_stats_report__init(copy); + protocol__flex_cell_stats_report__init(copy); copy->carrier_index = original->carrier_index; copy->has_carrier_index = original->has_carrier_index; copy->flags = original->flags; copy->has_flags = original->has_flags; - if(copy->flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + if(copy->flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { copy->noise_inter_report = copy_noise_inter_report(original->noise_inter_report); } @@ -539,13 +539,13 @@ Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsRepo return NULL; } -Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original) { - Protocol__PrpNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); +Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original) { + Protocol__FlexNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); if(ni_report == NULL) { goto error; } - protocol__prp_noise_interference_report__init(ni_report); + protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number ni_report->sfn_sf = original->sfn_sf; ni_report->has_sfn_sf = original->sfn_sf; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 4a76f0ed38..86a021f946 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -53,8 +53,8 @@ typedef struct { uint8_t is_initialized; volatile uint8_t cont_update; xid_t xid; - Protocol__ProgranMessage *stats_req; - Protocol__ProgranMessage *prev_stats_reply; + Protocol__FlexranMessage *stats_req; + Protocol__FlexranMessage *prev_stats_reply; pthread_mutex_t *mutex; } mac_stats_updates_context_t; @@ -75,30 +75,30 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); -Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_report, - Protocol__ProgranMessage *old_report); +Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, + Protocol__FlexranMessage *old_report); -Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original); +Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original); -Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original); +Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original); -Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original); +Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original); -Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original); +Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original); -Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original); +Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original); -Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original); +Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original); -Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original); +Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original); -Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original); +Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original); -int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, - Protocol__PrpUeStatsReport *rep2); +int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, + Protocol__FlexUeStatsReport *rep2); -int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, - Protocol__PrpCellStatsReport *rep2); +int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, + Protocol__FlexCellStatsReport *rep2); /* Functions for parsing the MAC agent policy reconfiguration command */ diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c index e2c31319e4..9b4be2ff6a 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -48,7 +48,7 @@ #define RIGHT(x) (2 * (x) + 2) #define PARENT(x) ((x - 1) / 2) -enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, +enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, uint16_t frame_num, uint8_t subframe_num) { enb_agent_task_t *task = NULL; task = malloc(sizeof(enb_agent_task_t)); diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h index ef60152b27..0c458061cf 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -41,7 +41,7 @@ #include #include -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "enb_agent_common.h" @@ -59,8 +59,8 @@ typedef struct enb_agent_task_s { uint16_t frame_num; /* The subframe in which the task needs to be executed */ uint8_t subframe_num; - /* The task to be executed in the form of a Protocol__ProgranMessage */ - Protocol__ProgranMessage *task; + /* The task to be executed in the form of a Protocol__FlexranMessage */ + Protocol__FlexranMessage *task; } enb_agent_task_t; /** @@ -95,7 +95,7 @@ typedef enum { /** * Allocate memory for a task in the queue */ -enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, +enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, uint16_t frame_num, uint8_t subframe_num); /** diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index b2a66bfe2d..b75b0467b1 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -48,7 +48,7 @@ #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/progran_dci_conversions.h" +#include "LAYER2/MAC/flexran_dci_conversions.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -60,7 +60,7 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -69,9 +69,9 @@ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__ProgranMessage *dl_scheduling_info) { + const Protocol__FlexranMessage *dl_scheduling_info) { - Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + Protocol__FlexDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; // Check if there is anything to schedule for random access if (mac_config->n_dl_rar > 0) { @@ -97,7 +97,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t subframe, int *mbsfn_flag, uint32_t n_dl_ue_data, - const Protocol__PrpDlData **dl_ue_data) { + const Protocol__FlexDlData **dl_ue_data) { uint8_t CC_id; int UE_id; @@ -128,8 +128,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, int i; - Protocol__PrpDlData *dl_data; - Protocol__PrpDlDci *dl_dci; + Protocol__FlexDlData *dl_data; + Protocol__FlexDlDci *dl_dci; uint32_t rlc_size, n_lc, lcid; @@ -161,7 +161,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command and set the length appropriately - ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0; } if (ta_len > 0) { @@ -359,7 +359,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, - const Protocol__PrpDlDci *dl_dci) { + const Protocol__FlexDlDci *dl_dci) { void *DLSCH_dci = NULL; DCI_PDU *DCI_pdu; @@ -397,92 +397,92 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, switch (frame_parms[CC_id]->N_RB_DL) { case 6: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_TDD_t); size_bits = sizeof_DCI1_1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_FDD_t); size_bits = sizeof_DCI1_1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 25: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_TDD_t); size_bits = sizeof_DCI1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_FDD_t); size_bits = sizeof_DCI1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 50: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_TDD_t); size_bits = sizeof_DCI1_10MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_FDD_t); size_bits = sizeof_DCI1_10MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 100: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_TDD_t); size_bits = sizeof_DCI1_20MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_FDD_t); size_bits = sizeof_DCI1_20MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } @@ -491,31 +491,31 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, //Set format to the proper type switch(dl_dci->format) { - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1: format = format1; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1A: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1A: format = format1A; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1B: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1B: format = format1B; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1C: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1C: format = format1C; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D: format = format1E_2A_M10PRB; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2: format = format2; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A: format = format2A; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2B: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2B: format = format2B; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_3: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_3: format = 3; break; default: diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index e1e22de549..90d5ad5f1b 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -63,7 +63,7 @@ #include "pdcp.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "enb_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -81,7 +81,7 @@ schedule_ue_spec_default( uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage **dl_info + Protocol__FlexranMessage **dl_info ) //------------------------------------------------------------------------------ { @@ -109,14 +109,14 @@ schedule_ue_spec_default( static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; - Protocol__PrpDlData *dl_data[NUM_MAX_UE]; + Protocol__FlexDlData *dl_data[NUM_MAX_UE]; int num_ues_added = 0; int channels_added = 0; - Protocol__PrpDlDci *dl_dci; - Protocol__PrpRlcPdu *rlc_pdus[11]; + Protocol__FlexDlDci *dl_dci; + Protocol__FlexRlcPdu *rlc_pdus[11]; uint32_t *ce_bitmap; - Protocol__PrpRlcPdu **rlc_pdu; + Protocol__FlexRlcPdu **rlc_pdu; int num_tb; uint32_t ce_flags = 0; @@ -216,8 +216,8 @@ schedule_ue_spec_default( channels_added = 0; // After this point all the UEs will be scheduled - dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); - protocol__prp_dl_data__init(dl_data[num_ues_added]); + dl_data[num_ues_added] = (Protocol__FlexDlData *) malloc(sizeof(Protocol__FlexDlData)); + protocol__flex_dl_data__init(dl_data[num_ues_added]); dl_data[num_ues_added]->has_rnti = 1; dl_data[num_ues_added]->rnti = rnti; dl_data[num_ues_added]->n_rlc_pdu = 0; @@ -258,8 +258,8 @@ schedule_ue_spec_default( eNB_UE_stats->DL_cqi[0], mcs, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); - dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); - protocol__prp_dl_dci__init(dl_dci); + dl_dci = (Protocol__FlexDlDci*) malloc(sizeof(Protocol__FlexDlDci)); + protocol__flex_dl_dci__init(dl_dci); dl_data[num_ues_added]->dl_dci = dl_dci; @@ -353,12 +353,12 @@ schedule_ue_spec_default( dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); if (ta_len > 0) { - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; + ce_flags |= PROTOCOL__FLEX_CE_TYPE__FLPCET_TA; } /*TODO: Add other flags if DRX and other CE are required*/ - // Add the control element flags to the progran message + // Add the control element flags to the flexran message dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; @@ -394,18 +394,18 @@ schedule_ue_spec_default( data_to_request++; //It is not correct but fixes some RLC bug for DCCH } LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added] = (Protocol__FlexRlcPdu *) malloc(sizeof(Protocol__FlexRlcPdu)); + protocol__flex_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__FlexRlcPduTb **) malloc(sizeof(Protocol__FlexRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb)); + protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = j; rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb)); + protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = j; rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; @@ -422,7 +422,7 @@ schedule_ue_spec_default( } // End of iterating the logical channels // Add rlc_pdus to the dl_data message - dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->rlc_pdu = (Protocol__FlexRlcPdu **) malloc(sizeof(Protocol__FlexRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) { dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; @@ -595,9 +595,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -625,9 +625,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -659,9 +659,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -693,9 +693,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -733,9 +733,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -770,9 +770,9 @@ schedule_ue_spec_default( } // UE_id loop } // CC_id loop - // Add all the dl_data elements to the progran message + // Add all the dl_data elements to the flexran message (*dl_info)->dl_mac_config_msg->n_dl_ue_data = num_ues_added; - (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__FlexDlData **) malloc(sizeof(Protocol__FlexDlData *) * num_ues_added); for (i = 0; i < num_ues_added; i++) { (*dl_info)->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; } diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index d8d2373332..b5882c84e3 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -53,7 +53,7 @@ int queue_initialized = 0; //uint32_t sched [] = {1, 2, 3}; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { //if ((subframe == skip_subframe) && (frame % period == 0)) { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index 7d2c2cbc6f..9ff750969b 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -40,7 +40,7 @@ #ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ #define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "header.pb-c.h" #include "ENB_APP/enb_agent_defs.h" @@ -54,7 +54,7 @@ #define SCHED_AHEAD_SUBFRAMES 20 typedef struct dl_mac_config_element_s { - Protocol__ProgranMessage *dl_info; + Protocol__FlexranMessage *dl_info; TAILQ_ENTRY(dl_mac_config_element_s) configs; } dl_mac_config_element_t; @@ -64,7 +64,7 @@ TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); * Default scheduler used by the eNB agent */ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); // Find the difference in subframes from the given subframe diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index f83606eddf..b57f5e965b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -103,7 +103,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, void *DLSCH_dci=NULL; int size_bits=0,size_bytes=0; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); @@ -143,7 +143,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } } else { diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h index f453fa2fa3..3c2d36e678 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -42,29 +42,29 @@ #include "enb_agent_defs.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" /* * Default scheduler used by the eNB agent */ void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__ProgranMessage *dl_scheduling_info); + const Protocol__FlexranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler */ void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - uint32_t n_dl_ue_data, const Protocol__PrpDlData **dl_ue_data); + uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); /* * Data plane function for filling the DCI structure */ -void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__PrpDlDci *dl_dci); +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); #endif diff --git a/openair2/LAYER2/MAC/progran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h similarity index 58% rename from openair2/LAYER2/MAC/progran_dci_conversions.h rename to openair2/LAYER2/MAC/flexran_dci_conversions.h index 90324fdb30..e9d9494a1a 100644 --- a/openair2/LAYER2/MAC/progran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -28,32 +28,32 @@ *******************************************************************************/ /*! \file dci_conversions.h - * \brief Conversion helpers from progran messages to OAI formats DCI + * \brief Conversion helpers from flexran messages to OAI formats DCI * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef LAYER2_MAC_PROGRAN_DCI_CONVERISIONS_H__ -#define LAYER2_MAC_DCI_PROGRAN_CONVERISIONS_H__ +#ifndef LAYER2_MAC_FLEXRAN_DCI_CONVERISIONS_H__ +#define LAYER2_MAC_DCI_FLEXRAN_CONVERISIONS_H__ -#define FILL_DCI_FDD_1(TYPE, DCI, PROGRAN_DCI) \ - ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ - ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ - ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ - ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ - ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ - ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ - ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; +#define FILL_DCI_FDD_1(TYPE, DCI, FLEXRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0]; -#define FILL_DCI_TDD_1(TYPE, DCI, PROGRAN_DCI) \ - ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ - ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ - ((TYPE*)DCI)->dai = PROGRAN_DCI->dai; \ - ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ - ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ - ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ - ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ - ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; +#define FILL_DCI_TDD_1(TYPE, DCI, FLEXRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->dai = FLEXRAN_DCI->dai; \ + ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0]; #endif diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 655c8d4c02..2b075a7ed3 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -4545,7 +4545,7 @@ rrc_eNB_decode_dcch( if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); } } #if defined(ENABLE_ITTI) @@ -4646,7 +4646,7 @@ rrc_eNB_decode_dcch( if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } } } From b6c7909d03f740a2b390cf2bc6c7c8af62bda476 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 24 Oct 2016 19:14:07 +0300 Subject: [PATCH 142/182] Fixed bugs related to MAC padding and RLC requests in AM mode --- .../MAC/eNB_agent_scheduler_dataplane.c | 29 ++- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 12 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 2 +- .../enb.band7.flexran.50PRB.usrpb210.conf | 182 ++++++++++++++++++ 4 files changed, 209 insertions(+), 16 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index b75b0467b1..a4d4d79250 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -126,6 +126,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; + int last_sdu_header_len = 0; + int i; Protocol__FlexDlData *dl_data; @@ -161,18 +163,21 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command and set the length appropriately - ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0; + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 1 : 0; } + + num_sdus = 0; + sdu_length_total = 0; if (ta_len > 0) { // Reset the measurement ue_sched_ctl->ta_timer = 20; eNB_UE_stats->timing_advance_update = 0; + header_len = ta_len; + last_sdu_header_len = ta_len; } - + n_lc = dl_data->n_rlc_pdu; - num_sdus = 0; - sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; @@ -192,6 +197,10 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (rlc_status.bytes_in_buffer > 0) { + if (rlc_size <= 2) { + rlc_size = 3; + } + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -223,12 +232,13 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - if (sdu_lengths[i] < 128) { + if (sdu_lengths[i] <= 128) { header_len += 2; + last_sdu_header_len = 2; } else { header_len += 3; + last_sdu_header_len = 3; } - num_sdus++; } } @@ -238,13 +248,14 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (((sdu_length_total + header_len) > 0)) { - header_len_tmp = header_len; + // header_len_tmp = header_len; // If we have only a single SDU, header length becomes 1 - if (header_len == 2 || header_len == 3) { + if ((num_sdus + ta_len) == 1) { + //if (header_len == 2 || header_len == 3) { header_len = 1; } else { - header_len--; + header_len = (header_len - last_sdu_header_len) + 1; } // there is a payload diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 90d5ad5f1b..4572e73def 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -371,7 +371,7 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if (dci_tbs - ta_len - header_len > 0) { - LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer if channel %d during first call\n", dci_tbs-ta_len-header_len); + LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -390,10 +390,10 @@ schedule_ue_spec_default( if (data_to_request < 128) { //The header will be one byte less header_len--; } - if (j == 1 || j == 2) { - data_to_request++; //It is not correct but fixes some RLC bug for DCCH - } - LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); + /* if (j == 1 || j == 2) { */ + /* data_to_request+=0; + /* } */ + LOG_D(MAC, "[TEST]Will request %d from channel %d\n", data_to_request, j); rlc_pdus[channels_added] = (Protocol__FlexRlcPdu *) malloc(sizeof(Protocol__FlexRlcPdu)); protocol__flex_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; @@ -523,7 +523,7 @@ schedule_ue_spec_default( if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); -#warning only for 5MHz channel + //#warning only for 5MHz channel update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 7946fdf663..a5c1e90147 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -146,7 +146,7 @@ rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) return (rnti); } - LOG_E(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP); + LOG_D(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP); //display_backtrace(); return(NOT_A_RNTI); } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf new file mode 100644 index 0000000000..f73a78b3b0 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf @@ -0,0 +1,182 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + 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 = 2660000000L; + 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; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + 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 = -100; + 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 = -104; + 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; + } + ); + + 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 = "192.168.100.101"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + 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"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); From 92fda18ab6313eedde9287af92d4f024995ee2ff Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 12:40:37 +0200 Subject: [PATCH 143/182] Added brief documentation of agent API functions --- openair2/ENB_APP/enb_agent.c | 26 +- openair2/ENB_APP/enb_agent.h | 7 +- openair2/ENB_APP/enb_agent_async.h | 4 + openair2/ENB_APP/enb_agent_common.c | 456 +++++++++++--------------- openair2/ENB_APP/enb_agent_common.h | 115 ++++++- openair2/ENB_APP/enb_agent_extern.h | 3 + openair2/ENB_APP/enb_agent_mac.c | 68 ++-- openair2/ENB_APP/enb_agent_mac.h | 10 +- openair2/ENB_APP/enb_agent_net_comm.h | 1 - 9 files changed, 347 insertions(+), 343 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 8286771104..179392b3a2 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -138,16 +138,12 @@ void *receive_thread(void *args) { Protocol__FlexranMessage *msg; while (1) { - //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - // err_code = PROTOCOL__FLEXRAN_ERR__MSG_DEQUEUING; - // goto error; - //} while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { LOG_D(ENB_AGENT,"received message with size %d\n", size); - + // Invoke the message handler msg=enb_agent_handle_message(d->enb_id, data, size); free(data); @@ -317,26 +313,6 @@ error: } - - -/* int enb_agent_stop(mid_t mod_id){ */ - -/* int i=0; */ - -/* enb_agent_destroy_timers(); */ -/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */ - -/* destroy_link_manager(enb_agent[i].manager); */ - -/* destroy_message_queue(enb_agent[i].send_queue); */ -/* destroy_message_queue(enb_agent[i].receive_queue); */ - -/* close_link(enb_agent[i].link); */ -/* } */ -/* } */ - - - Protocol__FlexranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h index 1a53841d45..a75790d8b0 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/enb_agent.h @@ -41,10 +41,15 @@ #include "enb_config.h" // for enb properties #include "enb_agent_common.h" -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); +/* Initiation and termination of the eNodeB agent */ +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); int enb_agent_stop(mid_t mod_id); +/* + * 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 *enb_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h index d722f92a8e..a8c4ae90fe 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/enb_agent_async.h @@ -47,12 +47,16 @@ typedef struct { link_manager_t *manager; } enb_agent_async_channel_t; +/* Create a new channel for a given destination ip and destination port */ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +/* Send a message to the given channel */ int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); +/* Receive a message from a given channel */ int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +/* Release a channel */ void enb_agent_async_release(enb_agent_channel_t *channel); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 2baecd6041..51ade8d851 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -51,6 +51,7 @@ void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; + /* * message primitives */ @@ -446,6 +447,7 @@ int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } + /* * get generic info from RAN */ @@ -541,7 +543,7 @@ int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; } -int get_ue_crnti (mid_t mod_id, mid_t ue_id){ +int get_ue_crnti (mid_t mod_id, mid_t ue_id) { return UE_RNTI(mod_id, ue_id); } @@ -608,13 +610,12 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) else return 0; } -int get_active_CC(mid_t mod_id, mid_t ue_id) -{ + +int get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; } -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) -{ +int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int pCCid = UE_PCCID(mod_id,ue_id); @@ -629,8 +630,7 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } -int get_tpc(mid_t mod_id, mid_t ue_id) -{ +int get_tpc(mid_t mod_id, mid_t ue_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int32_t normalized_rx_power, target_rx_power; int tpc = 1; @@ -660,8 +660,7 @@ int get_tpc(mid_t mod_id, mid_t ue_id) return tpc; } -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) //flag_id_status = 0 then id, else status -{ +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) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ @@ -684,8 +683,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) -{ +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint32_t rnti = get_ue_crnti(mod_id,ue_id); @@ -703,8 +701,7 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) return -1; } -int get_p0_nominal_pucch(mid_t mod_id, int CC_id) -{ +int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); return pucch_rx_received; } @@ -716,43 +713,42 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id) * ************************************ */ -int get_hopping_offset(mid_t mod_id, int CC_id) -{ +int get_hopping_offset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.pusch_HoppingOffset; } -int get_hopping_mode(mid_t mod_id, int CC_id) -{ + +int get_hopping_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.hoppingMode; } -int get_n_SB(mid_t mod_id, int CC_id) -{ + +int get_n_SB(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.n_SB; } -int get_enable64QAM(mid_t mod_id, int CC_id) -{ + +int get_enable64QAM(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.enable64QAM; } -int get_phich_duration(mid_t mod_id, int CC_id) -{ + +int get_phich_duration(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->phich_config_common.phich_duration; } -int get_phich_resource(mid_t mod_id, int CC_id) -{ + +int get_phich_resource(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -767,132 +763,132 @@ int get_phich_resource(mid_t mod_id, int CC_id) return -1; } -int get_n1pucch_an(mid_t mod_id, int CC_id) -{ + +int get_n1pucch_an(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.n1PUCCH_AN; } -int get_nRB_CQI(mid_t mod_id, int CC_id) -{ + +int get_nRB_CQI(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.nRB_CQI; } -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) -{ + +int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.deltaPUCCH_Shift; } -int get_prach_ConfigIndex(mid_t mod_id, int CC_id) -{ + +int get_prach_ConfigIndex(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; } -int get_prach_FreqOffset(mid_t mod_id, int CC_id) -{ + +int get_prach_FreqOffset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; } -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) -{ + +int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->maxHARQ_Msg3Tx; } -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) -{ + +int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp_UL; } -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) -{ + +int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp; } -int get_cell_id(mid_t mod_id, int CC_id) -{ + +int get_cell_id(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Nid_cell; } -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) -{ + +int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; } -int get_srs_SubframeConfig(mid_t mod_id, int CC_id) -{ + +int get_srs_SubframeConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; } -int get_srs_MaxUpPts(mid_t mod_id, int CC_id) -{ + +int get_srs_MaxUpPts(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; } -int get_N_RB_DL(mid_t mod_id, int CC_id) -{ + +int get_N_RB_DL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_DL; } -int get_N_RB_UL(mid_t mod_id, int CC_id) -{ + +int get_N_RB_UL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_UL; } -int get_subframe_assignment(mid_t mod_id, int CC_id) -{ + +int get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config; } -int get_special_subframe_assignment(mid_t mod_id, int CC_id) -{ + +int get_special_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config_S; } -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) -{ + +int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; } -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) -{ + +int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; } -int get_duplex_mode(mid_t mod_id, int CC_id) -{ + +int get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -903,21 +899,23 @@ int get_duplex_mode(mid_t mod_id, int CC_id) return -1; } -long get_si_window_length(mid_t mod_id, int CC_id) -{ + +long get_si_window_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; } -int get_sib1_length(mid_t mod_id, int CC_id) -{ + +int get_sib1_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; } -int get_num_pdcch_symb(mid_t mod_id, int CC_id) -{ + +int get_num_pdcch_symb(mid_t mod_id, int CC_id) { /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ return 0; //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } + + /* * ************************************ * Get Messages for UE Configuration Reply @@ -925,8 +923,7 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) -{ +int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -982,18 +979,16 @@ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) -{ +int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; } -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) -{ +int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; } -int get_half_duplex(mid_t ue_id) -{ +int get_half_duplex(mid_t ue_id) { + // TODO //int halfduplex = 0; //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; //for (int i =0; i < bands_to_scan; i++){ @@ -1003,37 +998,32 @@ int get_half_duplex(mid_t ue_id) //return halfduplex; } -int get_intra_sf_hopping(mid_t ue_id) -{ +int get_intra_sf_hopping(mid_t ue_id) { //TODO:Get proper value //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (0 & ( 1 << (31))); } -int get_type2_sb_1(mid_t ue_id) -{ +int get_type2_sb_1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (11))); } -int get_ue_category(mid_t ue_id) -{ +int get_ue_category(mid_t ue_id) { //TODO:Get proper value //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } -int get_res_alloc_type1(mid_t ue_id) -{ +int get_res_alloc_type1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (30))); } -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) -{ +int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1049,8 +1039,7 @@ int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) return -1; } -int get_tti_bundling(mid_t mod_id, mid_t ue_id) -{ +int get_tti_bundling(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1078,8 +1067,7 @@ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { return -1; } -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1094,8 +1082,7 @@ int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1110,8 +1097,7 @@ int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1126,8 +1112,7 @@ int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) -{ +int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1142,8 +1127,7 @@ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) return -1; } -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) -{ +int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } @@ -1161,8 +1145,7 @@ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { return -1; } -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) -{ +int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1178,8 +1161,7 @@ int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) return -1; } -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) -{ +int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1213,8 +1195,7 @@ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) -{ +int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1235,8 +1216,7 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) return -1; } -int get_lcg(mid_t ue_id, mid_t lc_id) -{ +int get_lcg(mid_t ue_id, mid_t lc_id) { if (UE_mac_inst == NULL) { return -1; } @@ -1247,8 +1227,7 @@ int get_lcg(mid_t ue_id, mid_t lc_id) } } -int get_direction(mid_t ue_id, mid_t lc_id) -{ +int get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ if(lc_id == DCCH | lc_id == DCCH1) return 2; @@ -1293,43 +1272,37 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int i =find_UE_id(mod_id,rnti); config->has_rnti = 1; config->rnti = rnti; - //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ config->time_alignment_timer = get_time_alignment_timer(mod_id,i); config->has_time_alignment_timer = 1; } - //TODO: Set the measurement gap configuration pattern if(get_meas_gap_config(mod_id,i) != -1){ config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); config->has_meas_gap_config_pattern = 1; } - //TODO: Set the measurement gap offset if applicable 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 = get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) - //Not supported for noe, so we do not set it + //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 - - //TODO: Set the transmission mode - if(get_ue_transmission_mode(mod_id,i) != -1){ + + if(get_ue_transmission_mode(mod_id,i) != -1){ config->transmission_mode = get_ue_transmission_mode(mod_id,i); config->has_transmission_mode = 1; } - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) - config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); config->has_ue_aggregated_max_bitrate_ul = 1; - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) - config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); config->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities @@ -1337,63 +1310,63 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(c_capabilities); //TODO: Set half duplex (FDD operation) - c_capabilities->has_half_duplex = 1; + c_capabilities->has_half_duplex = 0; c_capabilities->half_duplex = 1;//get_half_duplex(i); //TODO: Set intra-frame hopping flag - c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->has_intra_sf_hopping = 0; c_capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 - c_capabilities->has_type2_sb_1 = 1; + c_capabilities->has_type2_sb_1 = 0; c_capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category - c_capabilities->has_ue_category = 1; + c_capabilities->has_ue_category = 0; c_capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 - c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->has_res_alloc_type1 = 0; c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - //TODO: Set UE transmission antenna. One of the FLUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ config->has_ue_transmission_antenna = 1; config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); } - //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ config->has_tti_bundling = 1; config->tti_bundling = get_tti_bundling(mod_id,i); } - //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ config->has_max_harq_tx = 1; config->max_harq_tx = get_maxHARQ_TX(mod_id,i); } - //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ config->has_beta_offset_ack_index = 1; config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); } - //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ config->has_beta_offset_ri_index = 1; config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); } - //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ config->has_beta_offset_cqi_index = 1; config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); } - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ config->has_ack_nack_simultaneous_trans = 1; config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); } - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ config->has_simultaneous_ack_nack_cqi = 1; config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ config->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); @@ -1403,22 +1376,22 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->aperiodic_cqi_rep_mode = mode; } } - //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ config->has_tdd_ack_nack_feedback = 1; config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } - //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ config->has_ack_nack_repetition_factor = 1; config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } - //TODO: Set extended BSR size + if(get_extended_bsr_size(mod_id, i) != -1){ config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } - //TODO: Set index of primary cell + config->has_pcell_carrier_index = 1; config->pcell_carrier_index = UE_PCCID(mod_id, i); //TODO: Set carrier aggregation support (boolean) @@ -1432,8 +1405,8 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) // We do not set it for now. No carrier aggregation support //TODO: Set deactivation timer for secondary cell - config->has_scell_deactivation_timer = 1; - config->scell_deactivation_timer = 1; + 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 @@ -1462,9 +1435,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) LOG_D(ENB_AGENT, "Could not send UE state message\n"); } -/* - * timer primitives - */ + int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { @@ -1485,7 +1456,6 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; - //TODO: Fill in the actual number of UEs that we are going to report LC configs about lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); Protocol__FlexLcUeConfig **lc_ue_config; @@ -1498,9 +1468,10 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra for (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]); - //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = 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; @@ -1512,6 +1483,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra } 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); @@ -1521,38 +1493,39 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra 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]); - //TODO: Set the LC id + lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; - //TODO: Set the LCG of the channel + int lcg = get_lcg(i, j+1); if (lcg >= 0 && lcg <= 3) { lc_config[j]->has_lcg = 1; lc_config[j]->lcg = get_lcg(i,j+1); } - //TODO: Set the LC direction + lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); - //TODO: Bearer type. One of FLQBT_* values + //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 + // 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: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 1; - lc_config[j]->e_rab_max_bitrate_ul = 1; + 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 = 1; - lc_config[j]->e_rab_max_bitrate_dl = 1; + 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 = 1; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + 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 = 1; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + 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; @@ -1608,7 +1581,6 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; - //TODO: Fill in the actual number of UEs that are currently connected ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; @@ -1620,23 +1592,22 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); ue_config[i]->has_time_alignment_timer = 1; } - //TODO: Set the measurement gap configuration pattern + if(get_meas_gap_config(mod_id,i) != -1){ ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); ue_config[i]->has_meas_gap_config_pattern = 1; } - //TODO: Set the measurement gap offset if applicable + 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 = get_meas_gap_config_offset(mod_id,i); @@ -1651,82 +1622,78 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set the CQI configuration (Optional) //We do not set it for now - //TODO: Set the transmission mode if(get_ue_transmission_mode(mod_id,i) != -1){ ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); ue_config[i]->has_transmission_mode = 1; } - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; - //TODO: Set the UE capabilities Protocol__FlexUeCapabilities *capabilities; capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) - capabilities->has_half_duplex = 1; - capabilities->half_duplex = 1;//get_half_duplex(i); + capabilities->has_half_duplex = 0; + capabilities->half_duplex = 0;//get_half_duplex(i); //TODO: Set intra-frame hopping flag - capabilities->has_intra_sf_hopping = 1; + capabilities->has_intra_sf_hopping = 0; capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 - capabilities->has_type2_sb_1 = 1; + capabilities->has_type2_sb_1 = 0; capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category - capabilities->has_ue_category = 1; + capabilities->has_ue_category = 0; capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 - capabilities->has_res_alloc_type1 = 1; + capabilities->has_res_alloc_type1 = 0; capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the FLUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ ue_config[i]->has_ue_transmission_antenna = 1; ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); } - //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ ue_config[i]->has_tti_bundling = 1; ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); } - //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ ue_config[i]->has_max_harq_tx = 1; ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); } - //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_ack_index = 1; ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); } - //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_ri_index = 1; ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); } - //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_cqi_index = 1; ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); - } - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + } + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ ue_config[i]->has_ack_nack_simultaneous_trans = 1; ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); } - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ ue_config[i]->has_simultaneous_ack_nack_cqi = 1; ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set FLACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); @@ -1736,17 +1703,17 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra ue_config[i]->aperiodic_cqi_rep_mode = mode; } } - //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ ue_config[i]->has_tdd_ack_nack_feedback = 1; ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } - //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ ue_config[i]->has_ack_nack_repetition_factor = 1; ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } - //TODO: Set extended BSR size + if(get_extended_bsr_size(mod_id, i) != -1){ ue_config[i]->has_extended_bsr_size = 1; ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); @@ -1754,18 +1721,18 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; - //TODO: Set index of primary cell + 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 = 1; + 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 = 1; - ue_config[i]->scell_deactivation_timer = 1; + ue_config[i]->has_scell_deactivation_timer = 0; + ue_config[i]->scell_deactivation_timer = 0; } } ue_config_reply_msg->ue_config = ue_config; @@ -1871,26 +1838,26 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); protocol__flex_cell_config__init(cell_conf[i]); - //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); - //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; - //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - //TODO: Fill in with actual value + if(get_hopping_mode(enb_id,i) == 0){ cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; }else if(get_hopping_mode(enb_id,i) == 1){ cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; - //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of FLPR_ + if(get_phich_resource(enb_id,i) == 0){ cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 }else if (get_phich_resource(enb_id,i) == 1){ @@ -1901,7 +1868,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the FLPD_ values + if(get_phich_duration(enb_id,i) == 0){ cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; }else if(get_phich_duration(enb_id,i) == 1){ @@ -1910,7 +1877,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0; //TODO: Fill in with actual value /* Protocol__FlexSiConfig *si_config; */ /* si_config = malloc(sizeof(Protocol__FlexSiConfig)); */ @@ -1949,20 +1916,19 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr /* } */ /* cell_conf[i]->si_config = si_config; */ - //TODO: Fill in with actual value, the DL transmission bandwidth in RBs cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); cell_conf[i]->has_dl_bandwidth = 1; - //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of FLUCPL values + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of FLUCPL values + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ @@ -1970,10 +1936,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->has_dl_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, number of cell specific antenna ports + //TODO: Fill in with actual value, number of cell specific antenna ports. Currently single port support cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of FLDM values + if(get_duplex_mode(enb_id,i) == 1){ cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; }else if(get_duplex_mode(enb_id,i) == 0){ @@ -1982,10 +1948,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); - cell_conf[i]->has_subframe_assignment = 1; + cell_conf[i]->has_subframe_assignment = 0; //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); - cell_conf[i]->has_special_subframe_patterns = 1; + cell_conf[i]->has_special_subframe_patterns = 0; //TODO: Fill in with actual value, The MBSFN radio frame period cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; uint32_t *elem_rfperiod; @@ -2019,47 +1985,46 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); cell_conf[i]->has_prach_config_index = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); cell_conf[i]->has_prach_freq_offset = 1; - //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); cell_conf[i]->has_ra_response_window_size = 1; - //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); cell_conf[i]->has_mac_contention_resolution_timer = 1; - //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); cell_conf[i]->has_max_harq_msg3tx = 1; - //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); cell_conf[i]->has_n1pucch_an = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); cell_conf[i]->has_deltapucch_shift = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); cell_conf[i]->has_nrb_cqi = 1; - //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); cell_conf[i]->has_srs_subframe_config = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); cell_conf[i]->has_srs_bw_config = 1; - //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the FLEQ_ values + if(get_enable64QAM(enb_id,i) == 0){ cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; }else if(get_enable64QAM(enb_id,i) == 1){ cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; - //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } @@ -2088,6 +2053,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } + +/* + * timer primitives + */ + //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; int agent_timer_init = 0; @@ -2099,11 +2069,6 @@ err_code_t enb_agent_init_timer(void){ agent_timer_init = 1; } - /* - struct enb_agent_timer_element_s e; - memset(&e, 0, sizeof(enb_agent_timer_element_t)); - RB_INSERT(enb_agent_map, &agent_map, &e); - */ return PROTOCOL__FLEXRAN_ERR__NO_ERR; } @@ -2249,13 +2214,6 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); } -/* - int i =0; - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - printf("%d: %p\n", i, e); i++; - } -*/ - err_code_t enb_agent_stop_timer(long timer_id){ @@ -2283,39 +2241,3 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { return RB_FIND(enb_agent_map, &timer_instance.enb_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__FLEXRAN_ERR__TIMER_SETUP_FAILED; - } - - return 0; - -} - -*/ - diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index b5a35ec338..6664958ed9 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -73,54 +73,75 @@ typedef int (*enb_agent_message_destruction_callback)( * functions and generic handlers **********************************/ +/* Helper functions for message (de)serialization */ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); +/* Serialize message and then destroy the input flexran msg. Should be called when protocol + message is created dynamically */ void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); +/* Calls destructor of the given message */ err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); +/* Function to create the header for any FlexRAN protocol message */ int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); +/* Hello protocol message constructor and destructor */ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); +/* Echo request protocol message constructor and destructor */ int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); +/* Echo reply protocol message constructor and destructor */ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); +/* eNodeB configuration reply message constructor and destructor */ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); +/* UE configuration reply message constructor and destructor */ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); +/* Logical channel reply configuration message constructor and destructor */ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); +/* eNodeB configuration request message constructor and destructor */ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); +/* UE configuration request message constructor */ +/* TODO: Need to define and implement destructor */ int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); +/* Logical channel configuration request message constructor */ +/* TODO: Need to define and implement destructor */ int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); +/* UE state change message constructor and destructor */ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); +/* Control delegation message constructor and destructor */ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); +/* Policy reconfiguration message constructor and destructor */ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); +/* FlexRAN protocol message dispatcher function */ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); +/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); @@ -148,73 +169,113 @@ unsigned int get_current_subframe(mid_t mod_id); Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); +/* Return a future frame and subframe number that is ahead_of_time + subframes later in compact 16-bit format. Bits 0-3 subframe, + rest for frame */ uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); +/* Return the number of attached UEs */ int get_num_ues(mid_t mod_id); +/* Get the rnti of a UE with id ue_id */ int get_ue_crnti (mid_t mod_id, mid_t ue_id); +/* Get the RLC buffer status report of a ue for a designated + logical channel id */ int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); +/* Get power headroom of UE with id ue_id */ int get_ue_phr (mid_t mod_id, mid_t ue_id); +/* Get the UE wideband CQI */ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); +/* Get the transmission queue size for a UE with a channel_id logical channel id */ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +/* Return timing advance MAC control element for a designated cell and UE */ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); +/* Get the number of active component carriers for a specific UE */ int get_active_CC(mid_t mod_id, mid_t ue_id); +/* Get the rank indicator for a designated cell and UE */ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +/* See TS 36.213, section 10.1 */ int get_n1pucch_an(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.4 */ int get_nRB_CQI(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.4 */ int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.7.1 */ int get_prach_ConfigIndex(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.7.1 */ int get_prach_FreqOffset(mid_t mod_id, int CC_id); +/* See TS 36.321 */ int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); +/* Get the length of the UL cyclic prefix */ int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); +/* Get the length of the DL cyclic prefix */ int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); +/* Get the physical cell id of a cell */ int get_cell_id(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.5.3.2 */ int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); +/* See TS 36.211, table 5.5.3.3-1 and 2 */ int get_srs_SubframeConfig(mid_t mod_id, int CC_id); +/* Boolean value. See TS 36.211, + section 5.5.3.2. TDD only */ int get_srs_MaxUpPts(mid_t mod_id, int CC_id); +/* Get number of DL resource blocks */ int get_N_RB_DL(mid_t mod_id, int CC_id); +/* Get number of UL resource blocks */ int get_N_RB_UL(mid_t mod_id, int CC_id); +/* Get DL/UL subframe assignment. TDD only */ int get_subframe_assignment(mid_t mod_id, int CC_id); +/* TDD only. See TS 36.211, table 4.2.1 */ int get_special_subframe_assignment(mid_t mod_id, int CC_id); +/* Get the duration of the random access response window in subframes */ int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); +/* Get timer used for random access */ int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); +/* Get type of duplex mode (FDD/TDD) */ int get_duplex_mode(mid_t mod_id, int CC_id); +/* Get the SI window length */ long get_si_window_length(mid_t mod_id, int CC_id); +/* Get the number of PDCCH symbols configured for the cell */ int get_num_pdcch_symb(mid_t mod_id, int CC_id); +/* See TS 36.213, sec 5.1.1.1 */ int get_tpc(mid_t mod_id, mid_t ue_id); +/* Get the first available HARQ process for a specific cell and UE during + a designated frame and subframe. Returns 0 for success. The id and the + status of the HARQ process are stored in id and status respectively */ 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); +/* Reported values for uplink power control */ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); int get_p0_nominal_pucch(mid_t mod_id, int CC_id); @@ -225,54 +286,88 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id); * ************************************ */ +/* Get timer in subframes. Controls the synchronization + status of the UE, not the actual timing + advance procedure. See TS 36.321 */ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +/* Get measurement gap configuration. See TS 36.133 */ int get_meas_gap_config(mid_t mod_id, mid_t ue_id); +/* Get measurement gap configuration offset if applicable */ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +/* DL aggregated bit-rate of non-gbr bearer + per UE. See TS 36.413 */ int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); +/* UL aggregated bit-rate of non-gbr bearer + per UE. See TS 36.413 */ int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); +/* Only half-duplex support. FDD + operation. Boolean value */ int get_half_duplex(mid_t ue_id); +/* Support of intra-subframe hopping. + Boolean value */ int get_intra_sf_hopping(mid_t ue_id); +/* UE support for type 2 hopping with + n_sb>1 */ int get_type2_sb_1(mid_t ue_id); +/* Get the UE category */ int get_ue_category(mid_t ue_id); +/* UE support for resource allocation + type 1 */ int get_res_alloc_type1(mid_t ue_id); +/* Get UE transmission mode */ int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +/* Boolean value. See TS 36.321 */ int get_tti_bundling(mid_t mod_id, mid_t ue_id); +/* The max HARQ retransmission for UL. + See TS 36.321 */ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +/* Boolean. See TS36.213, Section 10.1 */ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +/* Boolean. See TS 36.213, Section 8.2 */ int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); +/* Get aperiodic CQI report mode */ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +/* Get ACK/NACK feedback mode. TDD only */ int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); +/* See TS36.213, section 10.1 */ int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +/* Boolean. Extended buffer status report size */ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +/* Get number of UE transmission antennas */ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +/* Get logical channel group of a channel with id lc_id */ int get_lcg(mid_t ue_id, mid_t lc_id); +/* Get direction of logical channel with id lc_id */ int get_direction(mid_t ue_id, mid_t lc_id); /******************* @@ -349,8 +444,11 @@ typedef struct enb_agent_timer_instance_s{ RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; }enb_agent_timer_instance_t; + err_code_t enb_agent_init_timer(void); +/* Create a timer for some agent related event with id xid. Will store the id + of the generated timer in timer_id */ err_code_t enb_agent_create_timer(uint32_t interval_sec, uint32_t interval_usec, agent_id_t agent_id, @@ -361,18 +459,28 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, void* timer_args, long *timer_id); +/* Destroy all existing timers */ err_code_t enb_agent_destroy_timers(void); + +/* Destroy the timer with the given timer_id */ err_code_t enb_agent_destroy_timer(long timer_id); + +/* Destroy the timer for task with id xid */ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); +/* Stop a timer */ err_code_t enb_agent_stop_timer(long timer_id); +/* Restart the given timer */ err_code_t enb_agent_restart_timer(long *timer_id); +/* Find the timer with the given timer_id */ struct enb_agent_timer_element_s * get_timer_entry(long timer_id); +/* Obtain the protocol message stored in the given expired timer */ Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +/* Comparator function comparing two timers. Decides the ordering of the timers */ int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); /*Specify a delay in nanoseconds to timespec and sleep until then*/ @@ -383,10 +491,3 @@ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_ #endif - - - - - - - diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 0dd7cfb90f..58f86dfe15 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,10 +44,13 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +/* full path of the local cache for storing VSFs */ extern char local_cache[40]; +/* 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]; #endif diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d040622a02..330dafad3a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -422,62 +422,55 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { - //TODO: Create a report for each LCG (4 elements). See flex_ue_stats_report of - // FlexRAN specifications for more details ue_report[i]->n_bsr = 4; uint32_t *elem; elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); if (elem == NULL) goto error; for (j = 0; j++; j < ue_report[i]->n_bsr) { - // Set the actual BSR for LCG j of the current UE // NN: we need to know the cc_id here, consider the first one - elem[j] = get_ue_bsr (enb_id, i, j); //eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + elem[j] = get_ue_bsr (enb_id, i, j); } ue_report[i]->bsr = elem; } /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { - // TODO: Fill in the actual power headroom value for the RNTI ue_report[i]->phr = 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; } /* Check flag for creation of RLC buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { - // TODO: Fill in the actual RLC buffer status reports - ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE + ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs Protocol__FlexRlcBsr ** rlc_reports; rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; - // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); if (rlc_reports[j] == NULL) goto error; protocol__flex_rlc_bsr__init(rlc_reports[j]); - //TODO:Set logical channel id rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; - //TODO:Set tx queue size in bytes rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; + //TODO:Set tx queue head of line delay in ms rlc_reports[j]->tx_queue_hol_delay = 100; - rlc_reports[j]->has_tx_queue_hol_delay = 1; + rlc_reports[j]->has_tx_queue_hol_delay = 0; //TODO:Set retransmission queue size in bytes rlc_reports[j]->retransmission_queue_size = 10; - rlc_reports[j]->has_retransmission_queue_size = 1; + rlc_reports[j]->has_retransmission_queue_size = 0; //TODO:Set retransmission queue head of line delay in ms rlc_reports[j]->retransmission_queue_hol_delay = 100; - rlc_reports[j]->has_retransmission_queue_hol_delay = 1; + rlc_reports[j]->has_retransmission_queue_hol_delay = 0; //TODO:Set current size of the pending message in bytes rlc_reports[j]->status_pdu_size = 100; - rlc_reports[j]->has_status_pdu_size = 1; + rlc_reports[j]->has_status_pdu_size = 0; } // Add RLC buffer status reports to the full report if (ue_report[i]->n_rlc_report > 0) @@ -502,12 +495,13 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if (dl_report == NULL) goto error; protocol__flex_dl_cqi_report__init(dl_report); - //TODO:Set the SFN and SF of the last report held in the agent. + dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; - //TODO:Set the number of DL CQI reports for this UE. One for each CC + //Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = get_active_CC(enb_id,i); - //TODO:Create the actual CSI reports. + + //Create the actual CSI reports. Protocol__FlexDlCsi **csi_reports; csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) @@ -517,14 +511,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if (csi_reports[j] == NULL) goto error; protocol__flex_dl_csi__init(csi_reports[j]); - //TODO: the servCellIndex for this report + //The servCellIndex for this report csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; - //TODO: the rank indicator value for this cc + //The rank indicator value for this cc csi_reports[j]->ri = get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE - //For this example we use type P10, which only needs a wideband value + //For now we only support type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and //in the FlexRAN specifications csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; @@ -598,16 +592,16 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller p_info[j]->paging_index = 10; - p_info[j]->has_paging_index = 1; + p_info[j]->has_paging_index = 0; //TODO:Set the paging message size p_info[j]->paging_message_size = 100; - p_info[j]->has_paging_message_size = 1; + p_info[j]->has_paging_message_size = 0; //TODO: Set the paging subframe p_info[j]->paging_subframe = 10; - p_info[j]->has_paging_subframe = 1; + p_info[j]->has_paging_subframe = 0; //TODO: Set the carrier index for the pending paging message p_info[j]->carrier_index = 0; - p_info[j]->has_carrier_index = 1; + p_info[j]->has_carrier_index = 0; } //Add all paging info to the paging buffer rerport paging_report->paging_info = p_info; @@ -645,7 +639,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, ul_report[j]->has_type = 1; //TODO:Set the number of SINR measurements based on the report type //See struct flex_ul_cqi in FlexRAN specification for more details - ul_report[j]->n_sinr = 100; + ul_report[j]->n_sinr = 0; uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); if (sinr_meas == NULL) @@ -712,12 +706,12 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Current frame and subframe number ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; - // Received interference power in dbm + //TODO:Received interference power in dbm ni_report->rip = 0; - ni_report->has_rip = 1; - // Thermal noise power in dbm + ni_report->has_rip = 0; + //TODO:Thermal noise power in dbm ni_report->tnp = 0; - ni_report->has_tnp = 1; + ni_report->has_tnp = 0; ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); ni_report->has_p0_nominal_pucch = 1; @@ -988,13 +982,13 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran protocol__flex_dl_info__init(dl_info[i]); dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; - /*TODO: fill in the right id of this round's HARQ process for this UE*/ + /*Fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; - /*TODO: fill in the status of the HARQ process (2 TBs)*/ + /* Fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { @@ -1004,7 +998,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran else if (harq_status == 1) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } - /*TODO: fill in the serving cell index for this UE */ + /*Fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); dl_info[i]->has_serv_cell_index = 1; } @@ -1012,8 +1006,8 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran sf_trigger_msg->dl_info = dl_info; - /*TODO: Fill in the number of UL reception status related info, based on the number of currently - *transmitting UEs + /* Fill in the number of UL reception status related info, based on the number of currently + * transmitting UEs */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); @@ -1031,7 +1025,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran protocol__flex_ul_info__init(ul_info[i]); ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; - /*TODO: fill in the Tx power control command for this UE (if available)*/ + /*Fill in the Tx power control command for this UE (if available)*/ if(get_tpc(mod_id,i) != 1){ ul_info[i]->tpc = get_tpc(mod_id,i); ul_info[i]->has_tpc = 1; @@ -1042,7 +1036,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ - ul_info[i]->n_ul_reception = 11; + ul_info[i]->n_ul_reception = 0; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); for (j = 0; j < ul_info[i]->n_ul_reception; j++) { ul_info[i]->ul_reception[j] = 100; @@ -1050,7 +1044,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran /*TODO: Fill in the reception status for each UEs data*/ ul_info[i]->reception_status = PROTOCOL__FLEX_RECEPTION_STATUS__FLRS_OK; ul_info[i]->has_reception_status = 1; - /*TODO: fill in the serving cell index for this UE */ + /*Fill in the serving cell index for this UE */ ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); ul_info[i]->has_serv_cell_index = 1; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index a6b9a0fe80..c5b257394b 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -81,24 +81,24 @@ void enb_agent_init_mac_agent(mid_t mod_id); int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +/* Statistics request protocol message constructor and destructor */ int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); +/* Statistics reply protocol message constructor and destructor */ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); +/* Scheduling request information protocol message constructor and estructor */ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); +/* Subframe trigger protocol msssage constructor and destructor */ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); +/* int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h index ab42bdc34f..2a2268dc80 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/enb_agent_net_comm.h @@ -57,7 +57,6 @@ typedef struct enb_agent_channel_instance_s{ /*Send and receive messages using the channel registered for a specific agent*/ int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); - int enb_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 From 0cee514c7316dbe7706e18ecd96e5bc61ea7e2f0 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 13:19:08 +0200 Subject: [PATCH 144/182] Fixed problem with comment causing a bug in compilation --- openair2/ENB_APP/enb_agent_mac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index c5b257394b..0716b739e5 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -97,7 +97,7 @@ int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); -/* +/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); From 8baf3e7e5786039e9c10e4c6579de15d13bf7b35 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:28:04 +0200 Subject: [PATCH 145/182] Changed naming convention for flexran related calls --- cmake_targets/CMakeLists.txt | 42 +- openair1/SCHED/phy_procedures_lte_eNb.c | 8 +- openair2/COMMON/tasks_def.h | 2 +- openair2/ENB_APP/enb_app.c | 8 +- openair2/ENB_APP/enb_config.c | 56 +- openair2/ENB_APP/enb_config.h | 8 +- .../ENB_APP/{enb_agent.c => flexran_agent.c} | 138 +-- .../ENB_APP/{enb_agent.h => flexran_agent.h} | 16 +- ...nb_agent_async.c => flexran_agent_async.c} | 34 +- ...nb_agent_async.h => flexran_agent_async.h} | 20 +- ..._agent_common.c => flexran_agent_common.c} | 920 +++++++++--------- ..._agent_common.h => flexran_agent_common.h} | 276 +++--- ...rnal.c => flexran_agent_common_internal.c} | 6 +- ...rnal.h => flexran_agent_common_internal.h} | 8 +- ...{enb_agent_defs.h => flexran_agent_defs.h} | 58 +- ..._agent_extern.h => flexran_agent_extern.h} | 12 +- ...gent_handler.c => flexran_agent_handler.c} | 110 +-- .../{enb_agent_mac.c => flexran_agent_mac.c} | 246 ++--- .../{enb_agent_mac.h => flexran_agent_mac.h} | 52 +- ...nt_mac_defs.h => flexran_agent_mac_defs.h} | 32 +- ...nternal.c => flexran_agent_mac_internal.c} | 12 +- ...nternal.h => flexran_agent_mac_internal.h} | 26 +- ...nt_net_comm.c => flexran_agent_net_comm.c} | 90 +- ...nt_net_comm.h => flexran_agent_net_comm.h} | 56 +- ...manager.c => flexran_agent_task_manager.c} | 75 +- ...manager.h => flexran_agent_task_manager.h} | 53 +- openair2/LAYER2/MAC/eNB_scheduler.c | 546 +++++------ ..._mac_proto.h => flexran_agent_mac_proto.h} | 24 +- ....c => flexran_agent_scheduler_dataplane.c} | 30 +- ...e.c => flexran_agent_scheduler_dlsch_ue.c} | 22 +- ...flexran_agent_scheduler_dlsch_ue_remote.c} | 30 +- ...flexran_agent_scheduler_dlsch_ue_remote.h} | 14 +- openair2/LAYER2/MAC/flexran_dci_conversions.h | 2 +- openair2/RRC/LITE/rrc_eNB.c | 6 +- openair2/UTIL/LOG/log.c | 14 +- openair2/UTIL/LOG/log.h | 2 +- .../enb.band5.flexran.50PRB.usrpb210.conf | 182 ++++ .../CONF/enb.band5.flexran.usrpb210.conf | 182 ++++ .../enb.band7.flexran.50PRB.usrpb210.conf | 8 +- .../CONF/enb.band7.flexran.usrpb210.conf | 8 +- targets/SIMU/USER/oaisim.c | 8 +- 41 files changed, 1898 insertions(+), 1544 deletions(-) rename openair2/ENB_APP/{enb_agent.c => flexran_agent.c} (56%) rename openair2/ENB_APP/{enb_agent.h => flexran_agent.h} (83%) rename openair2/ENB_APP/{enb_agent_async.c => flexran_agent_async.c} (70%) rename openair2/ENB_APP/{enb_agent_async.h => flexran_agent_async.h} (75%) rename openair2/ENB_APP/{enb_agent_common.c => flexran_agent_common.c} (64%) rename openair2/ENB_APP/{enb_agent_common.h => flexran_agent_common.h} (51%) rename openair2/ENB_APP/{enb_agent_common_internal.c => flexran_agent_common_internal.c} (98%) rename openair2/ENB_APP/{enb_agent_common_internal.h => flexran_agent_common_internal.h} (94%) rename openair2/ENB_APP/{enb_agent_defs.h => flexran_agent_defs.h} (70%) rename openair2/ENB_APP/{enb_agent_extern.h => flexran_agent_extern.h} (87%) rename openair2/ENB_APP/{enb_agent_handler.c => flexran_agent_handler.c} (54%) rename openair2/ENB_APP/{enb_agent_mac.c => flexran_agent_mac.c} (84%) rename openair2/ENB_APP/{enb_agent_mac.h => flexran_agent_mac.h} (64%) rename openair2/ENB_APP/{enb_agent_mac_defs.h => flexran_agent_mac_defs.h} (75%) rename openair2/ENB_APP/{enb_agent_mac_internal.c => flexran_agent_mac_internal.c} (98%) rename openair2/ENB_APP/{enb_agent_mac_internal.h => flexran_agent_mac_internal.h} (82%) rename openair2/ENB_APP/{enb_agent_net_comm.c => flexran_agent_net_comm.c} (52%) rename openair2/ENB_APP/{enb_agent_net_comm.h => flexran_agent_net_comm.h} (54%) rename openair2/ENB_APP/{enb_agent_task_manager.c => flexran_agent_task_manager.c} (74%) rename openair2/ENB_APP/{enb_agent_task_manager.h => flexran_agent_task_manager.h} (68%) rename openair2/LAYER2/MAC/{enb_agent_mac_proto.h => flexran_agent_mac_proto.h} (68%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dataplane.c => flexran_agent_scheduler_dataplane.c} (96%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue.c => flexran_agent_scheduler_dlsch_ue.c} (98%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue_remote.c => flexran_agent_scheduler_dlsch_ue_remote.c} (86%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue_remote.h => flexran_agent_scheduler_dlsch_ue_remote.h} (85%) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 196baf166b..8f696ed653 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -621,7 +621,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(ENB_AGENT_SB_IF True "enable eNB agent to inteface with a SDN contrller") +add_boolean_option(FLEXRAN_AGENT_SB_IF True "enable FlexRAN agent to inteface with a SDN contrller") ######################## # Include order @@ -838,7 +838,7 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ -if (ENB_AGENT_SB_IF) +if (FLEXRAN_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) @@ -899,18 +899,18 @@ if (ENB_AGENT_SB_IF) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) - add_library(ENB_AGENT - ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_common_internal.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac_internal.c + add_library(FLEXRAN_AGENT + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac_internal.c ) - set(ENB_AGENT_LIB ENB_AGENT) + set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) set(PROTOBUF_LIB "protobuf-c") @@ -1184,9 +1184,9 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c - ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c - ${MAC_DIR}/eNB_agent_scheduler_dataplane.c - ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c + ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c + ${MAC_DIR}/flexran_agent_scheduler_dataplane.c + ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c ) set (ENB_APP_SRC @@ -1201,8 +1201,8 @@ add_library(L2 # ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -add_library(default_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c) -add_library(remote_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c) +add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c) +add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c) # L3 Libs ########################## @@ -1757,7 +1757,7 @@ 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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + 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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) @@ -1791,7 +1791,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 PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1936,7 +1936,7 @@ 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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index c9eaa0d4af..b5fd7efd70 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -63,9 +63,9 @@ //Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "ENB_APP/flexran_agent_extern.h" +#include "ENB_APP/flexran_agent_mac.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" //#define DIAG_PHY @@ -1372,7 +1372,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, #ifndef DISABLE_SF_TRIGGER //Send subframe trigger to the controller if (mac_agent_registered[eNB->Mod_id]) { - agent_mac_xface[eNB->Mod_id]->enb_agent_send_sf_trigger(eNB->Mod_id); + agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id); } #endif diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 7d093c4400..c9e210fd1f 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -56,7 +56,7 @@ TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) /// eNB APP task TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200) /// eNB Agent task -TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200) +TASK_DEF(TASK_FLEXRAN_AGENT, TASK_PRIORITY_MED, 200) // UE tasks and sub-tasks: //// Layer 2 and Layer 1 sub-tasks diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index ce3b288388..3734bc4a2b 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -49,8 +49,8 @@ # include "gtpv1u_eNB_task.h" # endif -#if defined(ENB_AGENT_SB_IF) -# include "enb_agent.h" +#if defined(FLEXRAN_AGENT_SB_IF) +# include "flexran_agent.h" #endif extern unsigned char NB_eNB_INST; @@ -314,11 +314,11 @@ void *eNB_app_task(void *args_p) configure_rrc(enb_id, enb_properties_p); } -#if defined (ENB_AGENT_SB_IF) +#if defined (FLEXRAN_AGENT_SB_IF) for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { printf("\n start enb agent %d\n", enb_id); - enb_agent_start(enb_id, enb_properties_p); + flexran_agent_start(enb_id, enb_properties_p); } #endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 92eefce7b0..fdf953597e 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -191,10 +191,10 @@ #define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U" #define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" -#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" -#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" -#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" -#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME "FLEXRAN_AGENT_INTERFACE_NAME" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS "FLEXRAN_AGENT_IPV4_ADDRESS" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT "FLEXRAN_AGENT_PORT" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE "FLEXRAN_AGENT_CACHE" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" @@ -341,12 +341,12 @@ void enb_config_display(void) } } -#if defined(ENB_AGENT_SB_IF) - printf( "\nENB AGENT CONFIG : \n\n"); - printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); - printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); - printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); - printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache); +#if defined(FLEXRAN_AGENT_SB_IF) + printf( "\nFLEXRAN AGENT CONFIG : \n\n"); + printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->flexran_agent_interface_name); + printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->flexran_agent_ipv4_address); + printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->flexran_agent_port); + printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->flexran_agent_cache); #endif @@ -674,10 +674,10 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *address = NULL; char *cidr = NULL; char *astring = NULL; - char* enb_agent_interface_name = NULL; - char* enb_agent_ipv4_address = NULL; - libconfig_int enb_agent_port = 0; - char* enb_agent_cache = NULL; + char* flexran_agent_interface_name = NULL; + char* flexran_agent_ipv4_address = NULL; + libconfig_int flexran_agent_port = 0; + char* flexran_agent_cache = NULL; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2481,26 +2481,26 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) if (subsetting != NULL) { if ( ( - config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME, - (const char **)&enb_agent_interface_name) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS, - (const char **)&enb_agent_ipv4_address) - && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, - &enb_agent_port) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE, - (const char **)&enb_agent_cache) + 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.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); - cidr = enb_agent_ipv4_address; + enb_properties.properties[enb_properties_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name); + cidr = flexran_agent_ipv4_address; address = strtok(cidr, "/"); - enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address = strdup(address); + enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address = strdup(address); /* if (address) { - IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); }*/ - enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; - enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache); + enb_properties.properties[enb_properties_index]->flexran_agent_port = flexran_agent_port; + enb_properties.properties[enb_properties_index]->flexran_agent_cache = strdup(flexran_agent_cache); } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 594db77a1f..fd53395311 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -228,10 +228,10 @@ typedef struct Enb_properties_s { char *enb_interface_name_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME; - char *enb_agent_interface_name; - in_addr_t enb_agent_ipv4_address; - tcp_udp_port_t enb_agent_port; - char *enb_agent_cache; + char *flexran_agent_interface_name; + in_addr_t flexran_agent_ipv4_address; + tcp_udp_port_t flexran_agent_port; + char *flexran_agent_cache; /* Nb of RRH to connect to */ uint8_t nb_rrh_gw; diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/flexran_agent.c similarity index 56% rename from openair2/ENB_APP/enb_agent.c rename to openair2/ENB_APP/flexran_agent.c index 179392b3a2..8984e39971 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -27,28 +27,28 @@ *******************************************************************************/ -/*! \file enb_agent.h - * \brief top level enb agent receive thread and itti task +/*! \file flexran_agent.h + * \brief top level flexran agent receive thread and itti task * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_common.h" +#include "flexran_agent_common.h" #include "log.h" -#include "enb_agent.h" -#include "enb_agent_mac_defs.h" +#include "flexran_agent.h" +#include "flexran_agent_mac_defs.h" -#include "enb_agent_extern.h" +#include "flexran_agent_extern.h" #include "assertions.h" -#include "enb_agent_net_comm.h" -#include "enb_agent_async.h" +#include "flexran_agent_net_comm.h" +#include "flexran_agent_async.h" //#define TEST_TIMER -enb_agent_instance_t enb_agent[NUM_MAX_ENB]; +flexran_agent_instance_t flexran_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; @@ -57,7 +57,7 @@ char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -Protocol__FlexranMessage *enb_agent_timeout(void* args); +Protocol__FlexranMessage *flexran_agent_timeout(void* args); int agent_task_created = 0; @@ -65,9 +65,9 @@ int agent_task_created = 0; * 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 *enb_agent_task(void *args){ +void *flexran_agent_task(void *args){ - //enb_agent_instance_t *d = (enb_agent_instance_t *) args; + //flexran_agent_instance_t *d = (flexran_agent_instance_t *) args; Protocol__FlexranMessage *msg; void *data; int size; @@ -78,13 +78,13 @@ void *enb_agent_task(void *args){ const char *msg_name = NULL; instance_t instance; int result; - struct enb_agent_timer_element_s * elem = NULL; + struct flexran_agent_timer_element_s * elem = NULL; - itti_mark_task_ready(TASK_ENB_AGENT); + itti_mark_task_ready(TASK_FLEXRAN_AGENT); do { // Wait for a message - itti_receive_msg (TASK_ENB_AGENT, &msg_p); + itti_receive_msg (TASK_FLEXRAN_AGENT, &msg_p); DevAssert(msg_p != NULL); msg_name = ITTI_MSG_NAME (msg_p); instance = ITTI_MSG_INSTANCE (msg_p); @@ -95,25 +95,25 @@ void *enb_agent_task(void *args){ break; case MESSAGE_TEST: - LOG_I(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); + LOG_I(FLEXRAN_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; case TIMER_HAS_EXPIRED: - msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); + msg = flexran_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ - data=enb_agent_pack_message(msg,&size); + data=flexran_agent_pack_message(msg,&size); elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); - if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(elem->agent_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); } break; default: - LOG_E(ENB_AGENT, "Received unexpected message %s\n", msg_name); + LOG_E(FLEXRAN_AGENT, "Received unexpected message %s\n", msg_name); break; } @@ -121,7 +121,7 @@ void *enb_agent_task(void *args){ AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); continue; error: - LOG_E(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"flexran_agent_task: error %d occured\n",err_code); } while (1); return NULL; @@ -129,7 +129,7 @@ void *enb_agent_task(void *args){ void *receive_thread(void *args) { - enb_agent_instance_t *d = args; + flexran_agent_instance_t *d = args; void *data; int size; int priority; @@ -139,25 +139,25 @@ void *receive_thread(void *args) { while (1) { - while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { + while (flexran_agent_msg_recv(d->enb_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) { - LOG_D(ENB_AGENT,"received message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size); // Invoke the message handler - msg=enb_agent_handle_message(d->enb_id, data, size); + msg=flexran_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=enb_agent_pack_message(msg,&size); + data=flexran_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(d->enb_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); } } } @@ -165,7 +165,7 @@ void *receive_thread(void *args) { return NULL; error: - LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"receive_thread: error %d occured\n",err_code); return NULL; } @@ -203,37 +203,37 @@ pthread_t new_thread(void *(*f)(void *), void *b) { } int channel_container_init = 0; -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ +int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - set_enb_vars(mod_id, RAN_LTE_OAI); - enb_agent[mod_id].enb_id = mod_id; + flexran_set_enb_vars(mod_id, RAN_LTE_OAI); + flexran_agent[mod_id].enb_id = mod_id; /* * check the configuration */ - if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) { - strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache)); + if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache)); local_cache[sizeof(local_cache) - 1] = 0; } else { - strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE); + strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE); } - if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { - strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); + if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->flexran_agent_ipv4_address, sizeof(in_ip) ); in_ip[sizeof(in_ip) - 1] = 0; // terminate string } else { - strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS ); + strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS ); } - if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) { - in_port = enb_properties->properties[mod_id]->enb_agent_port; + if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->flexran_agent_port; } else { - in_port = DEFAULT_ENB_AGENT_PORT ; + in_port = DEFAULT_FLEXRAN_AGENT_PORT ; } - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].enb_id, + LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + flexran_agent[mod_id].enb_id, in_ip, in_port); @@ -241,87 +241,87 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * Initialize the channel container */ if (!channel_container_init) { - enb_agent_init_channel_container(); + flexran_agent_init_channel_container(); channel_container_init = 1; } /*Create the async channel info*/ - enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); + flexran_agent_instance_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); /*Create a channel using the async channel info*/ - channel_id = enb_agent_create_channel((void *) channel_info, - enb_agent_async_msg_send, - enb_agent_async_msg_recv, - enb_agent_async_release); + channel_id = flexran_agent_create_channel((void *) channel_info, + flexran_agent_async_msg_send, + flexran_agent_async_msg_recv, + flexran_agent_async_release); if (channel_id <= 0) { goto error; } - enb_agent_channel_t *channel = get_channel(channel_id); + flexran_agent_channel_t *channel = get_channel(channel_id); if (channel == NULL) { goto error; } - /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ - enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); + /*Register the channel for all underlying agents (use FLEXRAN_AGENT_MAX)*/ + flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAX); /*Example of registration for a specific agent(MAC): - *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); + *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC); */ /*Initialize the continuous MAC stats update mechanism*/ - enb_agent_init_cont_mac_stats_update(mod_id); + flexran_agent_init_cont_mac_stats_update(mod_id); - new_thread(receive_thread, &enb_agent[mod_id]); + new_thread(receive_thread, &flexran_agent[mod_id]); /*Initialize and register the mac xface. Must be modified later *for more flexibility in agent management */ AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); - enb_agent_register_mac_xface(mod_id, mac_agent_xface); + flexran_agent_register_mac_xface(mod_id, mac_agent_xface); /* * initilize a timer */ - enb_agent_init_timer(); + flexran_agent_init_timer(); /* * Initialize the mac agent */ - enb_agent_init_mac_agent(mod_id); + flexran_agent_init_mac_agent(mod_id); /* * start the enb agent task for tx and interaction with the underlying network function */ if (!agent_task_created) { - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { - LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) { + LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n"); return -1; } agent_task_created = 1; } - LOG_I(ENB_AGENT,"client ends\n"); + LOG_I(FLEXRAN_AGENT,"client ends\n"); return 0; error: - LOG_I(ENB_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT,"there was an error\n"); return 1; } -Protocol__FlexranMessage *enb_agent_timeout(void* args){ +Protocol__FlexranMessage *flexran_agent_timeout(void* args){ - // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); + // flexran_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); - enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; - LOG_I(ENB_AGENT, "enb_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); + LOG_I(FLEXRAN_AGENT, "flexran_agent %d timeout\n", timer_args->mod_id); + //LOG_I(FLEXRAN_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); + //LOG_I(FLEXRAN_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); return NULL; } diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/flexran_agent.h similarity index 83% rename from openair2/ENB_APP/enb_agent.h rename to openair2/ENB_APP/flexran_agent.h index a75790d8b0..beed4b9885 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -28,28 +28,28 @@ *******************************************************************************/ -/*! \file enb_agent.h - * \brief top level enb agent +/*! \file flexran_agent.h + * \brief top level flexran agent * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_H_ -#define ENB_AGENT_H_ +#ifndef FLEXRAN_AGENT_H_ +#define FLEXRAN_AGENT_H_ #include "enb_config.h" // for enb properties -#include "enb_agent_common.h" +#include "flexran_agent_common.h" /* Initiation and termination of the eNodeB agent */ -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); -int enb_agent_stop(mid_t mod_id); +int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); +int flexran_agent_stop(mid_t mod_id); /* * 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 *enb_agent_task(void *args); +void *flexran_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c similarity index 70% rename from openair2/ENB_APP/enb_agent_async.c rename to openair2/ENB_APP/flexran_agent_async.c index a626566a8d..ae0273a668 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -27,22 +27,22 @@ *******************************************************************************/ -/*! \file enb_agent_async.c +/*! \file flexran_agent_async.c * \brief channel implementation for async interface * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#include "enb_agent_async.h" -#include "enb_agent_defs.h" +#include "flexran_agent_async.h" +#include "flexran_agent_defs.h" #include "log.h" -enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t)); + flexran_agent_async_channel_t *channel; + channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); if (channel == NULL) goto error; @@ -52,7 +52,7 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst channel->link = new_link_client(dst_ip, dst_port); if (channel->link == NULL) goto error; - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", channel->enb_id, dst_ip, dst_port); @@ -75,27 +75,27 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst return channel; error: - LOG_I(ENB_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT,"there was an error\n"); return 1; } -int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_channel_t *)channel_info; +int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { + flexran_agent_async_channel_t *channel; + channel = (flexran_agent_channel_t *)channel_info; return message_put(channel->send_queue, data, size, priority); } -int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_async_channel_t *)channel_info; +int flexran_agent_async_msg_recv(void **data, int *size, 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); } -void enb_agent_async_release(enb_agent_channel_t *channel) { - enb_agent_async_channel_t *channel_info; - channel_info = (enb_agent_async_channel_t *) channel->channel_info; +void flexran_agent_async_release(flexran_agent_channel_t *channel) { + flexran_agent_async_channel_t *channel_info; + channel_info = (flexran_agent_async_channel_t *) channel->channel_info; destroy_link_manager(channel_info->manager); diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h similarity index 75% rename from openair2/ENB_APP/enb_agent_async.h rename to openair2/ENB_APP/flexran_agent_async.h index a8c4ae90fe..3e5c21463a 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/flexran_agent_async.h @@ -27,17 +27,17 @@ *******************************************************************************/ -/*! \file enb_agent_async.h +/*! \file flexran_agent_async.h * \brief channel implementation for async interface * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_ASYNC_H_ -#define ENB_AGENT_ASYNC_H_ +#ifndef FLEXRAN_AGENT_ASYNC_H_ +#define FLEXRAN_AGENT_ASYNC_H_ -#include "enb_agent_net_comm.h" +#include "flexran_agent_net_comm.h" typedef struct { mid_t enb_id; @@ -45,19 +45,19 @@ typedef struct { message_queue_t *send_queue; message_queue_t *receive_queue; link_manager_t *manager; -} enb_agent_async_channel_t; +} flexran_agent_async_channel_t; /* Create a new channel for a given destination ip and destination port */ -enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); /* Send a message to the given channel */ -int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); +int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info); /* Receive a message from a given channel */ -int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); /* Release a channel */ -void enb_agent_async_release(enb_agent_channel_t *channel); +void flexran_agent_async_release(flexran_agent_channel_t *channel); -#endif /*ENB_AGENT_ASYNC_H_*/ +#endif /*FLEXRAN_AGENT_ASYNC_H_*/ diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c similarity index 64% rename from openair2/ENB_APP/enb_agent_common.c rename to openair2/ENB_APP/flexran_agent_common.c index 51ade8d851..302c792771 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common.c +/*! \file flexran_agent_common.c * \brief common primitives for all agents * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 @@ -37,9 +37,9 @@ #include #include -#include "enb_agent_common.h" -#include "enb_agent_common_internal.h" -#include "enb_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_common_internal.h" +#include "flexran_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -56,7 +56,7 @@ void * enb_rrc[NUM_MAX_ENB]; * message primitives */ -int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { +int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { *size = protocol__flexran_message__get_packed_size(msg); @@ -69,7 +69,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int * return 0; error: - LOG_E(ENB_AGENT, "an error occured\n"); // change the com + LOG_E(FLEXRAN_AGENT, "an error occured\n"); // change the com return -1; } @@ -77,7 +77,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int * /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ -int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { +int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { *msg = protocol__flexran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; @@ -91,7 +91,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage -int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { +int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { *header = malloc(sizeof(Protocol__FlexHeader)); if(*header == NULL) @@ -108,17 +108,17 @@ int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; /*TODO: Need to set random xid or xid from received hello message*/ xid_t xid = 1; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) goto error; Protocol__FlexHello *hello_msg; @@ -146,12 +146,12 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage * free(hello_msg); if(*msg != NULL) free(*msg); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG) goto error; @@ -162,16 +162,16 @@ int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { +int flexran_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; /*TODO: Need to set a random xid*/ xid_t xid = 1; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) goto error; Protocol__FlexEchoRequest *echo_request_msg; @@ -202,7 +202,7 @@ int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMe } -int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) goto error; @@ -212,13 +212,13 @@ int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -226,7 +226,7 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess xid = (echo_req->header)->xid; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) goto error; Protocol__FlexEchoReply *echo_reply_msg; @@ -253,12 +253,12 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess free(echo_reply_msg); if(*msg != NULL) free(*msg); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; @@ -268,19 +268,19 @@ int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { +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++){ + 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); @@ -299,11 +299,11 @@ int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; free(msg->ue_config_reply_msg->header); @@ -320,11 +320,11 @@ int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; @@ -342,11 +342,11 @@ int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { free(msg); return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { +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); @@ -360,7 +360,7 @@ int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; free(msg->enb_config_request_msg->header); @@ -369,16 +369,16 @@ int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated UE config message */ return 0; } -int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated LC config message */ return 0; } @@ -398,7 +398,7 @@ long timer_end(struct timespec start_time){ return diffInNanos; } -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg; @@ -429,11 +429,11 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Fle return -1; } -int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; @@ -443,7 +443,7 @@ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__Flexra return 0; } -int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } @@ -452,7 +452,7 @@ int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { * get generic info from RAN */ -void set_enb_vars(mid_t mod_id, ran_name_t ran){ +void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran){ switch (ran){ case RAN_LTE_OAI : @@ -467,10 +467,10 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ return; error: - LOG_E(ENB_AGENT, "unknown RAN name %d\n", ran); + LOG_E(FLEXRAN_AGENT, "unknown RAN name %d\n", ran); } -int get_current_time_ms (mid_t mod_id, int subframe_flag){ +int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag){ if (subframe_flag == 1){ return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe; @@ -480,31 +480,31 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } -unsigned int get_current_frame (mid_t mod_id) { +unsigned int flexran_get_current_frame (mid_t mod_id) { #warning "SFN will not be in [0-1023] when oaisim is used" return ((eNB_MAC_INST *)enb[mod_id])->frame; } -unsigned int get_current_system_frame_num(mid_t mod_id) { - return (get_current_frame(mod_id) %1024); +unsigned int flexran_get_current_system_frame_num(mid_t mod_id) { + return (flexran_get_current_frame(mod_id) %1024); } -unsigned int get_current_subframe (mid_t mod_id) { +unsigned int flexran_get_current_subframe (mid_t mod_id) { return ((eNB_MAC_INST *)enb[mod_id])->subframe; } -uint16_t get_sfn_sf (mid_t mod_id) { +uint16_t flexran_get_sfn_sf (mid_t mod_id) { frame_t frame; sub_frame_t subframe; uint16_t sfn_sf, frame_mask, sf_mask; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); frame_mask = ((1<<12) - 1); sf_mask = ((1<<4) - 1); sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); @@ -512,14 +512,14 @@ uint16_t get_sfn_sf (mid_t mod_id) { return sfn_sf; } -uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { +uint16_t flexran_get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { frame_t frame; sub_frame_t subframe; uint16_t sfn_sf, frame_mask, sf_mask; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); subframe = ((subframe + ahead_of_time) % 10); @@ -527,7 +527,7 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { frame = frame + full_frames_ahead; - if (subframe < get_current_subframe(mod_id)) { + if (subframe < flexran_get_current_subframe(mod_id)) { frame++; } @@ -538,40 +538,40 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { return sfn_sf; } -int get_num_ues (mid_t mod_id){ +int flexran_get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; } -int get_ue_crnti (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id) { return UE_RNTI(mod_id, ue_id); } -int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { +int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid]; } -int get_ue_phr (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info; } -int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } -int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) -{ - rnti_t rnti = get_ue_crnti(mod_id,ue_id); - uint16_t frame = (uint16_t) get_current_frame(mod_id); + +int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); return rlc_status.bytes_in_buffer; } -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); if (eNB_UE_stats == NULL) { @@ -611,15 +611,15 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) return 0; } -int get_active_CC(mid_t mod_id, mid_t ue_id) { +int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; } -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { +int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -630,13 +630,13 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { return eNB_UE_stats[CC_id].rank; } -int get_tpc(mid_t mod_id, mid_t ue_id) { +int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int32_t normalized_rx_power, target_rx_power; int tpc = 1; int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); @@ -660,7 +660,7 @@ int get_tpc(mid_t mod_id, mid_t ue_id) { return tpc; } -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) { //flag_id_status = 0 then id, else status +int flexran_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) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ @@ -669,7 +669,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i uint8_t round; - uint16_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id); mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); @@ -683,9 +683,9 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { +int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; - uint32_t rnti = get_ue_crnti(mod_id,ue_id); + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); @@ -693,15 +693,14 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { return -1; } - if(eNB_UE_stats->Po_PUCCH_update == 1) - { + if(eNB_UE_stats->Po_PUCCH_update == 1) { return eNB_UE_stats->Po_PUCCH_dBm; } else return -1; } -int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { +int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) { int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); return pucch_rx_received; } @@ -713,42 +712,42 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { * ************************************ */ -int get_hopping_offset(mid_t mod_id, int CC_id) { +int flexran_get_hopping_offset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.pusch_HoppingOffset; } -int get_hopping_mode(mid_t mod_id, int CC_id) { +int flexran_get_hopping_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.hoppingMode; } -int get_n_SB(mid_t mod_id, int CC_id) { +int flexran_get_n_SB(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.n_SB; } -int get_enable64QAM(mid_t mod_id, int CC_id) { +int flexran_get_enable64QAM(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.enable64QAM; } -int get_phich_duration(mid_t mod_id, int CC_id) { +int flexran_get_phich_duration(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->phich_config_common.phich_duration; } -int get_phich_resource(mid_t mod_id, int CC_id) { +int flexran_get_phich_resource(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -764,131 +763,131 @@ int get_phich_resource(mid_t mod_id, int CC_id) { return -1; } -int get_n1pucch_an(mid_t mod_id, int CC_id) { +int flexran_get_n1pucch_an(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.n1PUCCH_AN; } -int get_nRB_CQI(mid_t mod_id, int CC_id) { +int flexran_get_nRB_CQI(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.nRB_CQI; } -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { +int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.deltaPUCCH_Shift; } -int get_prach_ConfigIndex(mid_t mod_id, int CC_id) { +int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; } -int get_prach_FreqOffset(mid_t mod_id, int CC_id) { +int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; } -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { +int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->maxHARQ_Msg3Tx; } -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { +int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp_UL; } -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { +int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp; } -int get_cell_id(mid_t mod_id, int CC_id) { +int flexran_get_cell_id(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Nid_cell; } -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { +int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; } -int get_srs_SubframeConfig(mid_t mod_id, int CC_id) { +int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; } -int get_srs_MaxUpPts(mid_t mod_id, int CC_id) { +int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; } -int get_N_RB_DL(mid_t mod_id, int CC_id) { +int flexran_get_N_RB_DL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_DL; } -int get_N_RB_UL(mid_t mod_id, int CC_id) { +int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_UL; } -int get_subframe_assignment(mid_t mod_id, int CC_id) { +int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config; } -int get_special_subframe_assignment(mid_t mod_id, int CC_id) { +int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config_S; } -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { +int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; } -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { +int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; } -int get_duplex_mode(mid_t mod_id, int CC_id) { +int flexran_get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -900,15 +899,15 @@ int get_duplex_mode(mid_t mod_id, int CC_id) { return -1; } -long get_si_window_length(mid_t mod_id, int CC_id) { +long flexran_get_si_window_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; } -int get_sib1_length(mid_t mod_id, int CC_id) { +int flexran_get_sib1_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; } -int get_num_pdcch_symb(mid_t mod_id, int CC_id) { +int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id) { /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ return 0; //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); @@ -923,27 +922,26 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) { */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { +int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL) - return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL) + return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; } else - return -1; + return -1; } -int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { +int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { - if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig != NULL) { if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; @@ -959,9 +957,9 @@ 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 flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); @@ -979,15 +977,15 @@ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; } -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; } -int get_half_duplex(mid_t ue_id) { +int flexran_get_half_duplex(mid_t ue_id) { // TODO //int halfduplex = 0; //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; @@ -998,65 +996,63 @@ int get_half_duplex(mid_t ue_id) { //return halfduplex; } -int get_intra_sf_hopping(mid_t ue_id) { +int flexran_get_intra_sf_hopping(mid_t ue_id) { //TODO:Get proper value //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (0 & ( 1 << (31))); } -int get_type2_sb_1(mid_t ue_id) { +int flexran_get_type2_sb_1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (11))); } -int get_ue_category(mid_t ue_id) { +int flexran_get_ue_category(mid_t ue_id) { //TODO:Get proper value //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } -int get_res_alloc_type1(mid_t ue_id) { +int flexran_get_res_alloc_type1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (30))); } -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; + } } else - return -1; + return -1; } -int get_tti_bundling(mid_t mod_id, mid_t ue_id) { +int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; + } } else - return -1; + return -1; } -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { +int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1067,54 +1063,51 @@ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { return -1; } -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; + } } else - return -1; + return -1; } -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; + } } else - return -1; + return -1; } -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; + } } else - return -1; + return -1; } -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { +int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1127,13 +1120,13 @@ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { +int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { +int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); @@ -1145,41 +1138,39 @@ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { return -1; } -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { +int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; + } } else - return -1; + return -1; } -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { +int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; + } } else - return -1; + return -1; } -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { +int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { //TODO: need to double check struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1195,28 +1186,27 @@ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) - return 2; - else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) - return 1; - else - return 0; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; + } } else - return -1; + return -1; } -int get_lcg(mid_t ue_id, mid_t lc_id) { +int flexran_get_lcg(mid_t ue_id, mid_t lc_id) { if (UE_mac_inst == NULL) { return -1; } @@ -1227,15 +1217,15 @@ int get_lcg(mid_t ue_id, mid_t lc_id) { } } -int get_direction(mid_t ue_id, mid_t lc_id) { +int flexran_get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ - if(lc_id == DCCH | lc_id == DCCH1) - return 2; - else if(lc_id == DTCH) - return 1; + if(lc_id == DCCH | lc_id == DCCH1) + return 2; + else if(lc_id == DTCH) + return 1; } -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { +int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { int size; Protocol__FlexranMessage *msg; Protocol__FlexHeader *header; @@ -1245,7 +1235,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int xid = 0; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) goto error; Protocol__FlexUeStateChange *ue_state_change_msg; @@ -1269,20 +1259,20 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) 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); - config->has_rnti = 1; - config->rnti = rnti; - if(get_time_alignment_timer(mod_id,i) != -1){ - config->time_alignment_timer = get_time_alignment_timer(mod_id,i); + 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); config->has_time_alignment_timer = 1; } - if(get_meas_gap_config(mod_id,i) != -1){ - config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + if(flexran_get_meas_gap_config(mod_id,i) != -1){ + config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i); 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 = get_meas_gap_config_offset(mod_id,i); + config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -1294,15 +1284,15 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(get_ue_transmission_mode(mod_id,i) != -1){ - config->transmission_mode = get_ue_transmission_mode(mod_id,i); + if(flexran_get_ue_transmission_mode(mod_id,i) != -1) { + config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); config->has_transmission_mode = 1; } - config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + 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 = get_ue_aggregated_max_bitrate_dl(mod_id,i); + 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 @@ -1311,85 +1301,85 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) protocol__flex_ue_capabilities__init(c_capabilities); //TODO: Set half duplex (FDD operation) c_capabilities->has_half_duplex = 0; - c_capabilities->half_duplex = 1;//get_half_duplex(i); + 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;//get_intra_sf_hopping(i); + 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;//get_type2_sb_1(i); + 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;//get_ue_category(i); + 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;//get_res_alloc_type1(i); + c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - if(get_ue_transmission_antenna(mod_id,i) != -1){ - config->has_ue_transmission_antenna = 1; - config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + config->has_ue_transmission_antenna = 1; + config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); } - if(get_tti_bundling(mod_id,i) != -1){ - config->has_tti_bundling = 1; - config->tti_bundling = get_tti_bundling(mod_id,i); + if(flexran_get_tti_bundling(mod_id,i) != -1) { + config->has_tti_bundling = 1; + config->tti_bundling = flexran_get_tti_bundling(mod_id,i); } - if(get_maxHARQ_TX(mod_id,i) != -1){ - config->has_max_harq_tx = 1; - config->max_harq_tx = get_maxHARQ_TX(mod_id,i); + if(flexran_get_maxHARQ_TX(mod_id,i) != -1){ + config->has_max_harq_tx = 1; + config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); } - if(get_beta_offset_ack_index(mod_id,i) != -1){ - config->has_beta_offset_ack_index = 1; - config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) { + config->has_beta_offset_ack_index = 1; + config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i); } - if(get_beta_offset_ri_index(mod_id,i) != -1){ - config->has_beta_offset_ri_index = 1; - config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) { + config->has_beta_offset_ri_index = 1; + config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i); } - if(get_beta_offset_cqi_index(mod_id,i) != -1){ - config->has_beta_offset_cqi_index = 1; - config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) { + config->has_beta_offset_cqi_index = 1; + config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i); } - if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ - config->has_ack_nack_simultaneous_trans = 1; - config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + if(flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) { + config->has_ack_nack_simultaneous_trans = 1; + config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i); } - if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ - config->has_simultaneous_ack_nack_cqi = 1; - config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) { + config->has_simultaneous_ack_nack_cqi = 1; + config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i); } - if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ - config->has_aperiodic_cqi_rep_mode = 1; - int mode = 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; - } + if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -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; + } } - if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ - config->has_tdd_ack_nack_feedback = 1; - config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + if(flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) { + config->has_tdd_ack_nack_feedback = 1; + config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i); } - if(get_ack_nack_repetition_factor(mod_id, i) != -1){ - config->has_ack_nack_repetition_factor = 1; - config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { + config->has_ack_nack_repetition_factor = 1; + config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); } - if(get_extended_bsr_size(mod_id, i) != -1){ - config->has_extended_bsr_size = 1; - config->extended_bsr_size = get_extended_bsr_size(mod_id,i); + if(flexran_get_extended_bsr_size(mod_id, i) != -1) { + config->has_extended_bsr_size = 1; + config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); } config->has_pcell_carrier_index = 1; @@ -1398,15 +1388,15 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) 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; + //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 @@ -1422,22 +1412,22 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; msg->ue_state_change_msg = ue_state_change_msg; - data = enb_agent_pack_message(msg, &size); + data = flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; error: - LOG_D(ENB_AGENT, "Could not send UE state message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send UE state message\n"); } -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1446,7 +1436,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra int i, j; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) goto error; Protocol__FlexLcConfigReply *lc_config_reply_msg; @@ -1456,7 +1446,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; - lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); + lc_config_reply_msg->n_lc_ue_config = flexran_get_num_ues(mod_id); Protocol__FlexLcUeConfig **lc_ue_config; if (lc_config_reply_msg->n_lc_ue_config > 0) { @@ -1470,12 +1460,12 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_ue_config__init(lc_ue_config[i]); lc_ue_config[i]->has_rnti = 1; - lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); + 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, get_ue_crnti(mod_id, i)); + status = mac_eNB_get_rrc_status(mod_id, flexran_get_ue_crnti(mod_id, i)); if (status < RRC_CONNECTED) { lc_ue_config[i]->n_lc_config = 0; } else if (status == RRC_CONNECTED) { @@ -1497,14 +1487,14 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; - int lcg = get_lcg(i, j+1); + int lcg = flexran_get_lcg(i, j+1); if (lcg >= 0 && lcg <= 3) { lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = get_lcg(i,j+1); + lc_config[j]->lcg = flexran_get_lcg(i,j+1); } lc_config[j]->has_direction = 1; - lc_config[j]->direction = get_direction(i,j+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; @@ -1551,7 +1541,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra free(lc_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -1561,7 +1551,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra * ************************************ */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1571,7 +1561,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra int i; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) goto error; Protocol__FlexUeConfigReply *ue_config_reply_msg; @@ -1581,7 +1571,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = flexran_get_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { @@ -1593,24 +1583,24 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - ue_config[i]->rnti = get_ue_crnti(mod_id,i); + ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - if(get_time_alignment_timer(mod_id,i) != -1){ - ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + if (flexran_get_time_alignment_timer(mod_id,i) != -1) { + ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i); ue_config[i]->has_time_alignment_timer = 1; - } + } - if(get_meas_gap_config(mod_id,i) != -1){ - ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + 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); ue_config[i]->has_meas_gap_config_pattern = 1; - } + } - if(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 = get_meas_gap_config_offset(mod_id,i); + ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); ue_config[i]->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -1622,15 +1612,15 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(get_ue_transmission_mode(mod_id,i) != -1){ - ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); - ue_config[i]->has_transmission_mode = 1; - } + if (flexran_get_ue_transmission_mode(mod_id,i) != -1) { + ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + } - ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + 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 = get_ue_aggregated_max_bitrate_dl(mod_id,i); + 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; @@ -1638,85 +1628,85 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 0; - capabilities->half_duplex = 0;//get_half_duplex(i); + capabilities->half_duplex = 0;//flexran_get_half_duplex(i); //TODO: Set intra-frame hopping flag capabilities->has_intra_sf_hopping = 0; - capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); + capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 capabilities->has_type2_sb_1 = 0; - capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); + capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i); //TODO: Set ue category capabilities->has_ue_category = 0; - capabilities->ue_category = 1;//get_ue_category(i); + capabilities->ue_category = 1;//flexran_get_ue_category(i); //TODO: Set UE support for resource allocation type 1 capabilities->has_res_alloc_type1 = 0; - capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); + capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - if(get_ue_transmission_antenna(mod_id,i) != -1){ - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); - } + if (flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); + } - if(get_tti_bundling(mod_id,i) != -1){ - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); - } + if (flexran_get_tti_bundling(mod_id,i) != -1) { + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id,i); + } - if(get_maxHARQ_TX(mod_id,i) != -1){ - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); - } + if (flexran_get_maxHARQ_TX(mod_id,i) != -1) { + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); + } - if(get_beta_offset_ack_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); - } + if (flexran_get_beta_offset_ack_index(mod_id,i) != -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); + } - if(get_beta_offset_ri_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); - } + if (flexran_get_beta_offset_ri_index(mod_id,i) != -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); + } - if(get_beta_offset_cqi_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if (flexran_get_beta_offset_cqi_index(mod_id,i) != -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); } - if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); - } - - if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); - } - - if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - int mode = 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; - } + if (flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -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); } - if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ + if (flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -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); + } + + if (flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -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; + } + } + + if (flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) { ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i); } - if(get_ack_nack_repetition_factor(mod_id, i) != -1){ + if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); } - if(get_extended_bsr_size(mod_id, i) != -1){ + if (flexran_get_extended_bsr_size(mod_id, i) != -1) { ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; @@ -1754,7 +1744,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra free(ue_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -1765,25 +1755,25 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra * ************************************ */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { +int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; xid_t xid = 1; - if(flex_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) - goto error; + if(flexran_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + goto error; Protocol__FlexEnbConfigRequest *enb_config_request_msg; enb_config_request_msg = malloc(sizeof(Protocol__FlexEnbConfigRequest)); if(enb_config_request_msg == NULL) - goto error; + goto error; protocol__flex_enb_config_request__init(enb_config_request_msg); enb_config_request_msg->header = header; *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) - goto error; + goto error; protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; @@ -1803,7 +1793,7 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Fle return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1815,10 +1805,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr int enb_id = mod_id; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) goto error; - Protocol__FlexEnbConfigReply *enb_config_reply_msg; + Protocol__FlexEnbConfigReply *enb_config_reply_msg; enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); if(enb_config_reply_msg == NULL) goto error; @@ -1840,43 +1830,43 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr protocol__flex_cell_config__init(cell_conf[i]); cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(enb_id,i); cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; - cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - if(get_hopping_mode(enb_id,i) == 0){ - cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; - }else if(get_hopping_mode(enb_id,i) == 1){ + if (flexran_get_hopping_mode(enb_id,i) == 0) { + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; + } else if(flexran_get_hopping_mode(enb_id,i) == 1) { cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; - cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->n_sb = flexran_get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - if(get_phich_resource(enb_id,i) == 0){ + if (flexran_get_phich_resource(enb_id,i) == 0) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 - }else if (get_phich_resource(enb_id,i) == 1){ + } else if (flexran_get_phich_resource(enb_id,i) == 1) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 - }else if (get_phich_resource(enb_id,i) == 2){ + } else if (flexran_get_phich_resource(enb_id,i) == 2) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 - }else if (get_phich_resource(enb_id,i) == 3){ + } else if (flexran_get_phich_resource(enb_id,i) == 3) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - if(get_phich_duration(enb_id,i) == 0){ + if (flexran_get_phich_duration(enb_id,i) == 0) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; - }else if(get_phich_duration(enb_id,i) == 1){ + } else if(flexran_get_phich_duration(enb_id,i) == 1) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 - cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0; //TODO: Fill in with actual value /* Protocol__FlexSiConfig *si_config; */ @@ -1916,23 +1906,23 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr /* } */ /* cell_conf[i]->si_config = si_config; */ - cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(enb_id,i); cell_conf[i]->has_dl_bandwidth = 1; - cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; - }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + if (flexran_get_ul_cyclic_prefix_length(enb_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(enb_id, i) == 1) { cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; - }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; + if (flexran_get_ul_cyclic_prefix_length(enb_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(enb_id,i) == 1) { + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; } cell_conf[i]->has_dl_cyclic_prefix_length = 1; @@ -1940,20 +1930,20 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - if(get_duplex_mode(enb_id,i) == 1){ + if (flexran_get_duplex_mode(enb_id,i) == 1) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; - }else if(get_duplex_mode(enb_id,i) == 0){ + } else if(flexran_get_duplex_mode(enb_id,i) == 0) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only - cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(enb_id, i); cell_conf[i]->has_subframe_assignment = 0; //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 - cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); + cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(enb_id,i); cell_conf[i]->has_special_subframe_patterns = 0; //TODO: Fill in with actual value, The MBSFN radio frame period - cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; + 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) @@ -1964,7 +1954,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr 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 = 5; + 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) @@ -1975,7 +1965,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr 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 = 5; + 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) @@ -1985,46 +1975,46 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(enb_id,i); cell_conf[i]->has_prach_config_index = 1; - cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(enb_id,i); cell_conf[i]->has_prach_freq_offset = 1; - cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(enb_id,i); cell_conf[i]->has_ra_response_window_size = 1; - cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(enb_id,i); cell_conf[i]->has_mac_contention_resolution_timer = 1; - cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(enb_id,i); cell_conf[i]->has_max_harq_msg3tx = 1; - cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(enb_id,i); cell_conf[i]->has_n1pucch_an = 1; - cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(enb_id,i); cell_conf[i]->has_deltapucch_shift = 1; - cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(enb_id,i); cell_conf[i]->has_nrb_cqi = 1; - cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(enb_id,i); cell_conf[i]->has_srs_subframe_config = 1; - cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(enb_id,i); cell_conf[i]->has_srs_bw_config = 1; - cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - if(get_enable64QAM(enb_id,i) == 0){ + if (flexran_get_enable64QAM(enb_id,i) == 0) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; - }else if(get_enable64QAM(enb_id,i) == 1){ + } else if(flexran_get_enable64QAM(enb_id,i) == 1) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; - + cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } @@ -2048,7 +2038,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr free(enb_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -2058,24 +2048,24 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr * timer primitives */ -//struct enb_agent_map agent_map; -enb_agent_timer_instance_t timer_instance; +//struct flexran_agent_map agent_map; +flexran_agent_timer_instance_t timer_instance; int agent_timer_init = 0; -err_code_t enb_agent_init_timer(void){ +err_code_t flexran_agent_init_timer(void){ - LOG_I(ENB_AGENT, "init RB tree\n"); + LOG_I(FLEXRAN_AGENT, "init RB tree\n"); if (!agent_timer_init) { - RB_INIT(&timer_instance.enb_agent_head); + RB_INIT(&timer_instance.flexran_agent_head); agent_timer_init = 1; } return PROTOCOL__FLEXRAN_ERR__NO_ERR; } -RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); +RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); /* The timer_id might not be the best choice for the comparison */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ +int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){ if (a->timer_id < b->timer_id) return -1; if (a->timer_id > b->timer_id) return 1; @@ -2084,17 +2074,17 @@ int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agen return 0; } -err_code_t enb_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, - enb_agent_timer_callback_t cb, - void* timer_args, - long *timer_id){ +err_code_t flexran_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, + flexran_agent_timer_callback_t cb, + void* timer_args, + long *timer_id){ - struct enb_agent_timer_element_s *e = calloc(1, sizeof(*e)); + struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e)); DevAssert(e != NULL); //uint32_t timer_id; @@ -2103,13 +2093,13 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, if ((interval_sec == 0) && (interval_usec == 0 )) return TIMER_NULL; - if (timer_type >= ENB_AGENT_TIMER_TYPE_MAX) + if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) return TIMER_TYPE_INVALIDE; - if (timer_type == ENB_AGENT_TIMER_TYPE_ONESHOT){ + if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){ ret = timer_setup(interval_sec, interval_usec, - TASK_ENB_AGENT, + TASK_FLEXRAN_AGENT, instance, TIMER_ONE_SHOT, timer_args, @@ -2117,10 +2107,10 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->type = TIMER_ONE_SHOT; } - else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ + else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){ ret = timer_setup(interval_sec, interval_usec, - TASK_ENB_AGENT, + TASK_FLEXRAN_AGENT, instance, TIMER_PERIODIC, timer_args, @@ -2135,27 +2125,27 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->agent_id = agent_id; e->instance = instance; - e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + e->state = FLEXRAN_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(enb_agent_map, &timer_instance.enb_agent_head, e); + RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e); - LOG_I(ENB_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", + LOG_I(FLEXRAN_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 enb_agent_destroy_timer(long timer_id){ +err_code_t flexran_agent_destroy_timer(long timer_id){ - struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_flexran_message(e->timer_args->msg); + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2165,18 +2155,18 @@ err_code_t enb_agent_destroy_timer(long timer_id){ return 0; error: - LOG_E(ENB_AGENT, "timer can't be removed\n"); + LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); return TIMER_REMOVED_FAILED ; } -err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { - struct enb_agent_timer_element_s *e = NULL; +err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) { + struct flexran_agent_timer_element_s *e = NULL; long timer_id; - RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { if (e->xid == xid) { timer_id = e->timer_id; - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_flexran_message(e->timer_args->msg); + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); if (timer_remove(timer_id) < 0 ) { goto error; @@ -2186,18 +2176,18 @@ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { return 0; error: - LOG_E(ENB_AGENT, "timer can't be removed\n"); + LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); return TIMER_REMOVED_FAILED ; } -err_code_t enb_agent_destroy_timers(void){ +err_code_t flexran_agent_destroy_timers(void){ - struct enb_agent_timer_element_s *e = NULL; + struct flexran_agent_timer_element_s *e = NULL; - RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); timer_remove(e->timer_id); - enb_agent_destroy_flexran_message(e->timer_args->msg); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2205,7 +2195,7 @@ err_code_t enb_agent_destroy_timers(void){ } -void enb_agent_sleep_until(struct timespec *ts, int delay) { +void flexran_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; @@ -2215,17 +2205,17 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { } -err_code_t enb_agent_stop_timer(long timer_id){ +err_code_t flexran_agent_stop_timer(long timer_id){ - struct enb_agent_timer_element_s *e=NULL; - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + struct flexran_agent_timer_element_s *e=NULL; + struct flexran_agent_timer_element_s search; + memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); search.timer_id = timer_id; - e = RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); + e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); if (e != NULL ) { - e->state = ENB_AGENT_TIMER_STATE_STOPPED; + e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED; } timer_remove(timer_id); @@ -2233,11 +2223,11 @@ err_code_t enb_agent_stop_timer(long timer_id){ return 0; } -struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { +struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + struct flexran_agent_timer_element_s search; + memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); search.timer_id = timer_id; - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); + return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h similarity index 51% rename from openair2/ENB_APP/enb_agent_common.h rename to openair2/ENB_APP/flexran_agent_common.h index 6664958ed9..2156d50a0d 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common.h +/*! \file flexran_agent_common.h * \brief common message primitves and utilities * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 @@ -36,8 +36,8 @@ -#ifndef ENB_AGENT_COMMON_H_ -#define ENB_AGENT_COMMON_H_ +#ifndef FLEXRAN_AGENT_COMMON_H_ +#define FLEXRAN_AGENT_COMMON_H_ #include @@ -46,7 +46,7 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" -# include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "enb_config.h" #include "LAYER2/MAC/extern.h" @@ -58,13 +58,13 @@ #define FLEXRAN_VERSION 0 -typedef int (*enb_agent_message_decoded_callback)( +typedef int (*flexran_agent_message_decoded_callback)( mid_t mod_id, const void *params, Protocol__FlexranMessage **msg ); -typedef int (*enb_agent_message_destruction_callback)( +typedef int (*flexran_agent_message_destruction_callback)( Protocol__FlexranMessage *msg ); @@ -74,75 +74,75 @@ typedef int (*enb_agent_message_destruction_callback)( **********************************/ /* Helper functions for message (de)serialization */ -int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); -int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); +int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); +int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); /* Serialize message and then destroy the input flexran msg. Should be called when protocol message is created dynamically */ -void * enb_agent_pack_message(Protocol__FlexranMessage *msg, +void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); /* Calls destructor of the given message */ -err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); +err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); /* Function to create the header for any FlexRAN protocol message */ -int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); +int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); /* Hello protocol message constructor and destructor */ -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); +int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg); /* Echo request protocol message constructor and destructor */ -int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); +int flexran_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg); /* Echo reply protocol message constructor and destructor */ -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); +int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); /* eNodeB configuration reply message constructor and destructor */ -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); /* UE configuration reply message constructor and destructor */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); /* Logical channel reply configuration message constructor and destructor */ -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); /* eNodeB configuration request message constructor and destructor */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); /* UE configuration request message constructor */ /* TODO: Need to define and implement destructor */ -int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); /* Logical channel configuration request message constructor */ /* TODO: Need to define and implement destructor */ -int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); /* UE state change message constructor and destructor */ -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); -int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); +int 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); /* Control delegation message constructor and destructor */ -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); +int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); /* Policy reconfiguration message constructor and destructor */ -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); +int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); /* FlexRAN protocol message dispatcher function */ -Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); /* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ -Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); +Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args); @@ -151,134 +151,134 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); * get generic info from RAN ****************************/ -void set_enb_vars(mid_t mod_id, ran_name_t ran); +void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran); -int get_current_time_ms (mid_t mod_id, int subframe_flag); +int flexran_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); +unsigned int flexran_get_current_frame(mid_t mod_id); /*Return the current SFN (0-1023)*/ -unsigned int get_current_system_frame_num(mid_t mod_id); +unsigned int flexran_get_current_system_frame_num(mid_t mod_id); -unsigned int get_current_subframe(mid_t mod_id); +unsigned int flexran_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 FlexRAN protocol*/ -uint16_t get_sfn_sf (mid_t mod_id); +uint16_t flexran_get_sfn_sf (mid_t mod_id); /* Return a future frame and subframe number that is ahead_of_time subframes later in compact 16-bit format. Bits 0-3 subframe, rest for frame */ -uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); +uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time); /* Return the number of attached UEs */ -int get_num_ues(mid_t mod_id); +int flexran_get_num_ues(mid_t mod_id); /* Get the rnti of a UE with id ue_id */ -int get_ue_crnti (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id); /* Get the RLC buffer status report of a ue for a designated logical channel id */ -int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); +int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); /* Get power headroom of UE with id ue_id */ -int get_ue_phr (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id); /* Get the UE wideband CQI */ -int get_ue_wcqi (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Get the transmission queue size for a UE with a channel_id logical channel id */ -int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); /* Return timing advance MAC control element for a designated cell and UE */ -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); /* Get the number of active component carriers for a specific UE */ -int get_active_CC(mid_t mod_id, mid_t ue_id); +int flexran_get_active_CC(mid_t mod_id, mid_t ue_id); /* Get the rank indicator for a designated cell and UE */ -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); /* See TS 36.213, section 10.1 */ -int get_n1pucch_an(mid_t mod_id, int CC_id); +int flexran_get_n1pucch_an(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.4 */ -int get_nRB_CQI(mid_t mod_id, int CC_id); +int flexran_get_nRB_CQI(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.4 */ -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); +int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.7.1 */ -int get_prach_ConfigIndex(mid_t mod_id, int CC_id); +int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.7.1 */ -int get_prach_FreqOffset(mid_t mod_id, int CC_id); +int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id); /* See TS 36.321 */ -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); +int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); /* Get the length of the UL cyclic prefix */ -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); +int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); /* Get the length of the DL cyclic prefix */ -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); +int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); /* Get the physical cell id of a cell */ -int get_cell_id(mid_t mod_id, int CC_id); +int flexran_get_cell_id(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.5.3.2 */ -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); +int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id); /* See TS 36.211, table 5.5.3.3-1 and 2 */ -int get_srs_SubframeConfig(mid_t mod_id, int CC_id); +int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id); /* Boolean value. See TS 36.211, section 5.5.3.2. TDD only */ -int get_srs_MaxUpPts(mid_t mod_id, int CC_id); +int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id); /* Get number of DL resource blocks */ -int get_N_RB_DL(mid_t mod_id, int CC_id); +int flexran_get_N_RB_DL(mid_t mod_id, int CC_id); /* Get number of UL resource blocks */ -int get_N_RB_UL(mid_t mod_id, int CC_id); +int flexran_get_N_RB_UL(mid_t mod_id, int CC_id); /* Get DL/UL subframe assignment. TDD only */ -int get_subframe_assignment(mid_t mod_id, int CC_id); +int flexran_get_subframe_assignment(mid_t mod_id, int CC_id); /* TDD only. See TS 36.211, table 4.2.1 */ -int get_special_subframe_assignment(mid_t mod_id, int CC_id); +int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id); /* Get the duration of the random access response window in subframes */ -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); +int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); /* Get timer used for random access */ -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); +int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); /* Get type of duplex mode (FDD/TDD) */ -int get_duplex_mode(mid_t mod_id, int CC_id); +int flexran_get_duplex_mode(mid_t mod_id, int CC_id); /* Get the SI window length */ -long get_si_window_length(mid_t mod_id, int CC_id); +long flexran_get_si_window_length(mid_t mod_id, int CC_id); /* Get the number of PDCCH symbols configured for the cell */ -int get_num_pdcch_symb(mid_t mod_id, int CC_id); +int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id); /* See TS 36.213, sec 5.1.1.1 */ -int get_tpc(mid_t mod_id, mid_t ue_id); +int flexran_get_tpc(mid_t mod_id, mid_t ue_id); /* Get the first available HARQ process for a specific cell and UE during a designated frame and subframe. Returns 0 for success. The id and the status of the HARQ process are stored in id and status respectively */ -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); +int flexran_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); /* Reported values for uplink power control */ -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); -int get_p0_nominal_pucch(mid_t mod_id, int CC_id); +int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id); /* * ************************************ @@ -289,86 +289,86 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id); /* Get timer in subframes. Controls the synchronization status of the UE, not the actual timing advance procedure. See TS 36.321 */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id); /* Get measurement gap configuration. See TS 36.133 */ -int get_meas_gap_config(mid_t mod_id, mid_t ue_id); +int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id); /* Get measurement gap configuration offset if applicable */ -int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); /* DL aggregated bit-rate of non-gbr bearer per UE. See TS 36.413 */ -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); /* UL aggregated bit-rate of non-gbr bearer per UE. See TS 36.413 */ -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); /* Only half-duplex support. FDD operation. Boolean value */ -int get_half_duplex(mid_t ue_id); +int flexran_get_half_duplex(mid_t ue_id); /* Support of intra-subframe hopping. Boolean value */ -int get_intra_sf_hopping(mid_t ue_id); +int flexran_get_intra_sf_hopping(mid_t ue_id); /* UE support for type 2 hopping with n_sb>1 */ -int get_type2_sb_1(mid_t ue_id); +int flexran_get_type2_sb_1(mid_t ue_id); /* Get the UE category */ -int get_ue_category(mid_t ue_id); +int flexran_get_ue_category(mid_t ue_id); /* UE support for resource allocation type 1 */ -int get_res_alloc_type1(mid_t ue_id); +int flexran_get_res_alloc_type1(mid_t ue_id); /* Get UE transmission mode */ -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); /* Boolean value. See TS 36.321 */ -int get_tti_bundling(mid_t mod_id, mid_t ue_id); +int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id); /* The max HARQ retransmission for UL. See TS 36.321 */ -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); /* Boolean. See TS36.213, Section 10.1 */ -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); /* Boolean. See TS 36.213, Section 8.2 */ -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); +int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); /* Get aperiodic CQI report mode */ -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); /* Get ACK/NACK feedback mode. TDD only */ -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); +int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); /* See TS36.213, section 10.1 */ -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); /* Boolean. Extended buffer status report size */ -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id); /* Get number of UE transmission antennas */ -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); /* Get logical channel group of a channel with id lc_id */ -int get_lcg(mid_t ue_id, mid_t lc_id); +int flexran_get_lcg(mid_t ue_id, mid_t lc_id); /* Get direction of logical channel with id lc_id */ -int get_direction(mid_t ue_id, mid_t lc_id); +int flexran_get_direction(mid_t ue_id, mid_t lc_id); /******************* * timer primitves @@ -382,51 +382,51 @@ int get_direction(mid_t ue_id, mid_t lc_id); /* Type of the callback executed when the timer expired */ -typedef Protocol__FlexranMessage *(*enb_agent_timer_callback_t)(void*); +typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ - ENB_AGENT_TIMER_TYPE_ONESHOT = 0x0, + FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0, /* periodic timer */ - ENB_AGENT_TIMER_TYPE_PERIODIC = 0x1, + FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, + FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, /* Max number of states available */ - ENB_AGENT_TIMER_TYPE_MAX, -} eNB_agent_timer_type_t; + FLEXRAN_AGENT_TIMER_TYPE_MAX, +} flexran_agent_timer_type_t; typedef enum { /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_INACTIVE = 0x0, + FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_ACTIVE = 0x1, + FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_STOPPED = 0x2, + FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2, /* Max number of states available */ - ENB_AGENT_TIMER_STATE_MAX, -} eNB_agent_timer_state_t; + FLEXRAN_AGENT_TIMER_STATE_MAX, +} flexran_agent_timer_state_t; -typedef struct enb_agent_timer_args_s{ +typedef struct flexran_agent_timer_args_s{ mid_t mod_id; Protocol__FlexranMessage *msg; -} enb_agent_timer_args_t; +} flexran_agent_timer_args_t; -typedef struct enb_agent_timer_element_s{ - RB_ENTRY(enb_agent_timer_element_s) entry; +typedef struct flexran_agent_timer_element_s{ + RB_ENTRY(flexran_agent_timer_element_s) entry; agent_id_t agent_id; instance_t instance; - eNB_agent_timer_type_t type; - eNB_agent_timer_state_t state; + flexran_agent_timer_type_t type; + flexran_agent_timer_state_t state; uint32_t interval_sec; uint32_t interval_usec; @@ -435,59 +435,59 @@ typedef struct enb_agent_timer_element_s{ xid_t xid; /*The id of the task as received by the controller message*/ - enb_agent_timer_callback_t cb; - enb_agent_timer_args_t *timer_args; + flexran_agent_timer_callback_t cb; + flexran_agent_timer_args_t *timer_args; -} enb_agent_timer_element_t; +} flexran_agent_timer_element_t; -typedef struct enb_agent_timer_instance_s{ - RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; -}enb_agent_timer_instance_t; +typedef struct flexran_agent_timer_instance_s{ + RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head; +}flexran_agent_timer_instance_t; -err_code_t enb_agent_init_timer(void); +err_code_t flexran_agent_init_timer(void); /* Create a timer for some agent related event with id xid. Will store the id of the generated timer in timer_id */ -err_code_t enb_agent_create_timer(uint32_t interval_sec, +err_code_t flexran_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, - enb_agent_timer_callback_t cb, + flexran_agent_timer_callback_t cb, void* timer_args, long *timer_id); /* Destroy all existing timers */ -err_code_t enb_agent_destroy_timers(void); +err_code_t flexran_agent_destroy_timers(void); /* Destroy the timer with the given timer_id */ -err_code_t enb_agent_destroy_timer(long timer_id); +err_code_t flexran_agent_destroy_timer(long timer_id); /* Destroy the timer for task with id xid */ -err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); +err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid); /* Stop a timer */ -err_code_t enb_agent_stop_timer(long timer_id); +err_code_t flexran_agent_stop_timer(long timer_id); /* Restart the given timer */ -err_code_t enb_agent_restart_timer(long *timer_id); +err_code_t flexran_agent_restart_timer(long *timer_id); /* Find the timer with the given timer_id */ -struct enb_agent_timer_element_s * get_timer_entry(long timer_id); +struct flexran_agent_timer_element_s * get_timer_entry(long timer_id); /* Obtain the protocol message stored in the given expired timer */ -Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args); /* Comparator function comparing two timers. Decides the ordering of the timers */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); +int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b); /*Specify a delay in nanoseconds to timespec and sleep until then*/ -void enb_agent_sleep_until(struct timespec *ts, int delay); +void flexran_agent_sleep_until(struct timespec *ts, int delay); /* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); +RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); #endif diff --git a/openair2/ENB_APP/enb_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c similarity index 98% rename from openair2/ENB_APP/enb_agent_common_internal.c rename to openair2/ENB_APP/flexran_agent_common_internal.c index ca61a96609..f35cd8666f 100644 --- a/openair2/ENB_APP/enb_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common_internal.c +/*! \file flexran_agent_common_internal.c * \brief internal functions for common message primitves and utilities * \author Xenofon Foukas * \date 2016 @@ -37,8 +37,8 @@ #include #include -#include "enb_agent_common_internal.h" -#include "enb_agent_mac_internal.h" +#include "flexran_agent_common_internal.h" +#include "flexran_agent_mac_internal.h" int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { diff --git a/openair2/ENB_APP/enb_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h similarity index 94% rename from openair2/ENB_APP/enb_agent_common_internal.h rename to openair2/ENB_APP/flexran_agent_common_internal.h index 30fd51c5c8..45f4a73ffb 100644 --- a/openair2/ENB_APP/enb_agent_common_internal.h +++ b/openair2/ENB_APP/flexran_agent_common_internal.h @@ -27,19 +27,19 @@ *******************************************************************************/ -/*! \file enb_agent_common_internal.h +/*! \file flexran_agent_common_internal.h * \brief internal agent functions for common message primitves and utilities * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_COMMON_INTERNAL_H_ -#define ENB_AGENT_COMMON_INTERNAL_H_ +#ifndef FLEXRAN_AGENT_COMMON_INTERNAL_H_ +#define FLEXRAN_AGENT_COMMON_INTERNAL_H_ #include -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length); diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h similarity index 70% rename from openair2/ENB_APP/enb_agent_defs.h rename to openair2/ENB_APP/flexran_agent_defs.h index 8d71aa2db3..7da0487120 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -27,14 +27,14 @@ *******************************************************************************/ -/*! \file enb_agent_defs.h - * \brief enb agent common definitions +/*! \file flexran_agent_defs.h + * \brief FlexRAN agent common definitions * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_DEFS_H_ -#define ENB_AGENT_DEFS_H_ +#ifndef FLEXRAN_AGENT_DEFS_H_ +#define FLEXRAN_AGENT_DEFS_H_ #include #include @@ -45,54 +45,54 @@ #define NUM_MAX_ENB 2 #define NUM_MAX_UE 2048 -#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" -#define DEFAULT_ENB_AGENT_PORT 2210 -#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache" +#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1" +#define DEFAULT_FLEXRAN_AGENT_PORT 2210 +#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache" typedef enum { - ENB_AGENT_DEFAULT=0, + FLEXRAN_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, + FLEXRAN_AGENT_PHY=1, + FLEXRAN_AGENT_MAC=2, + FLEXRAN_AGENT_RLC=3, + FLEXRAN_AGENT_PDCP=4, + FLEXRAN_AGENT_RRC=5, + FLEXRAN_AGENT_S1AP=6, + FLEXRAN_AGENT_GTP=7, + FLEXRAN_AGENT_X2AP=8, - ENB_AGENT_MAX=9, + FLEXRAN_AGENT_MAX=9, } agent_id_t; typedef enum { /* no action */ - ENB_AGENT_ACTION_NONE = 0x0, + FLEXRAN_AGENT_ACTION_NONE = 0x0, /* send action */ - ENB_AGENT_ACTION_SEND = 0x1, + FLEXRAN_AGENT_ACTION_SEND = 0x1, /* apply action */ - ENB_AGENT_ACTION_APPLY = 0x2, + FLEXRAN_AGENT_ACTION_APPLY = 0x2, /* clear action */ - ENB_AGENT_ACTION_CLEAR = 0x4, + FLEXRAN_AGENT_ACTION_CLEAR = 0x4, /* write action */ - ENB_AGENT_ACTION_WRITE = 0x8, + FLEXRAN_AGENT_ACTION_WRITE = 0x8, /* filter action */ - ENB_AGENT_ACTION_FILTER = 0x10, + FLEXRAN_AGENT_ACTION_FILTER = 0x10, /* preprocess action */ - ENB_AGENT_ACTION_PREPROCESS = 0x20, + FLEXRAN_AGENT_ACTION_PREPROCESS = 0x20, /* meter action */ - ENB_AGENT_ACTION_METER = 0x40, + FLEXRAN_AGENT_ACTION_METER = 0x40, /* Max number of states available */ - ENB_AGENT_ACTION_MAX = 0x7f, + FLEXRAN_AGENT_ACTION_MAX = 0x7f, } agent_action_t; @@ -122,12 +122,12 @@ typedef struct { uint32_t rx_msg[NUM_MAX_ENB]; uint32_t tx_msg[NUM_MAX_ENB]; -}enb_agent_info_t; +} flexran_agent_info_t; typedef struct { mid_t enb_id; - enb_agent_info_t agent_info; + flexran_agent_info_t agent_info; -}enb_agent_instance_t; +} flexran_agent_instance_t; #endif diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h similarity index 87% rename from openair2/ENB_APP/enb_agent_extern.h rename to openair2/ENB_APP/flexran_agent_extern.h index 58f86dfe15..602b1d6ce3 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -28,21 +28,21 @@ *******************************************************************************/ /*! \file ENB_APP/extern.h - * \brief enb agent - mac interface primitives + * \brief FlexRAN agent - mac interface primitives * \author Xenofon Foukas * \date 2016 * \version 0.1 * \mail x.foukas@sms.ed.ac.uk */ -#ifndef __ENB_AGENT_EXTERN_H__ -#define __ENB_AGENT_EXTERN_H__ +#ifndef __FLEXRAN_AGENT_EXTERN_H__ +#define __FLEXRAN_AGENT_EXTERN_H__ -#include "enb_agent_defs.h" -#include "enb_agent_mac_defs.h" +#include "flexran_agent_defs.h" +#include "flexran_agent_mac_defs.h" -//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; /* full path of the local cache for storing VSFs */ extern char local_cache[40]; diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c similarity index 54% rename from openair2/ENB_APP/enb_agent_handler.c rename to openair2/ENB_APP/flexran_agent_handler.c index 46459f98bc..c077827c66 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -27,61 +27,61 @@ *******************************************************************************/ -/*! \file enb_agent_handler.c - * \brief enb agent tx and rx message handler +/*! \file flexran_agent_handler.c + * \brief FlexRAN agent tx and rx message handler * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_common.h" -#include "enb_agent_mac.h" +#include "flexran_agent_common.h" +#include "flexran_agent_mac.h" #include "log.h" #include "assertions.h" -enb_agent_message_decoded_callback agent_messages_callback[][3] = { - {enb_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ +flexran_agent_message_decoded_callback agent_messages_callback[][3] = { + {flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ + {flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ - {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {flexran_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ - {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {flexran_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ - {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {flexran_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {flexran_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ - {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ + {flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ + {flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; -enb_agent_message_destruction_callback message_destruction_callback[] = { - enb_agent_destroy_hello, - enb_agent_destroy_echo_request, - enb_agent_destroy_echo_reply, - enb_agent_mac_destroy_stats_request, - enb_agent_mac_destroy_stats_reply, - enb_agent_mac_destroy_sf_trigger, - enb_agent_mac_destroy_sr_info, - enb_agent_destroy_enb_config_request, - enb_agent_destroy_enb_config_reply, - enb_agent_destroy_ue_config_request, - enb_agent_destroy_ue_config_reply, - enb_agent_destroy_lc_config_request, - enb_agent_destroy_lc_config_reply, - enb_agent_mac_destroy_dl_config, - enb_agent_destroy_ue_state_change, - enb_agent_destroy_control_delegation, - enb_agent_destroy_agent_reconfiguration, +flexran_agent_message_destruction_callback message_destruction_callback[] = { + flexran_agent_destroy_hello, + flexran_agent_destroy_echo_request, + flexran_agent_destroy_echo_reply, + flexran_agent_mac_destroy_stats_request, + flexran_agent_mac_destroy_stats_reply, + flexran_agent_mac_destroy_sf_trigger, + flexran_agent_mac_destroy_sr_info, + flexran_agent_destroy_enb_config_request, + flexran_agent_destroy_enb_config_reply, + flexran_agent_destroy_ue_config_request, + flexran_agent_destroy_ue_config_reply, + flexran_agent_destroy_lc_config_request, + flexran_agent_destroy_lc_config_reply, + flexran_agent_mac_destroy_dl_config, + flexran_agent_destroy_ue_state_change, + flexran_agent_destroy_control_delegation, + flexran_agent_destroy_agent_reconfiguration, }; -static const char *enb_agent_direction2String[] = { +static const char *flexran_agent_direction2String[] = { "", /* not_set */ "originating message", /* originating message */ "successfull outcome", /* successfull outcome */ @@ -89,23 +89,23 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, - uint8_t *data, - uint32_t size){ +Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, + uint8_t *data, + uint32_t size){ Protocol__FlexranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); - if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { + if (flexran_agent_deserialize_message(data, size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; goto error; } - if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; - goto error; + goto error; } if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { @@ -123,20 +123,20 @@ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, return reply_message; error: - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -void * enb_agent_pack_message(Protocol__FlexranMessage *msg, - uint32_t * size){ +void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, + uint32_t * size){ void * buffer; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__NO_ERR; - if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { + if (flexran_agent_serialize_message(msg, &buffer, size) < 0 ) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENCODING; goto error; } @@ -147,23 +147,23 @@ void * enb_agent_pack_message(Protocol__FlexranMessage *msg, DevAssert(buffer !=NULL); - LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); + LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); return buffer; error : - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { +Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args) { err_code_t err_code; - enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; Protocol__FlexranMessage *timed_task, *reply_message; timed_task = timer_args->msg; - err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -171,27 +171,27 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { return reply_message; error: - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -Protocol__FlexranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* timer_args){ - struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); + struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id); if (found == NULL ) goto error; - LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); + LOG_I(FLEXRAN_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(ENB_AGENT,"null timer args\n"); + LOG_W(FLEXRAN_AGENT,"null timer args\n"); return found->cb(timer_args); error: - LOG_E(ENB_AGENT, "can't get the timer element\n"); + LOG_E(FLEXRAN_AGENT, "can't get the timer element\n"); return TIMER_ELEMENT_NOT_FOUND; } -err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { +err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { return ((*message_destruction_callback[msg->msg_case-1])(msg)); } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/flexran_agent_mac.c similarity index 84% rename from openair2/ENB_APP/enb_agent_mac.c rename to openair2/ENB_APP/flexran_agent_mac.c index 330dafad3a..c85ec6c4eb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/flexran_agent_mac.c @@ -27,21 +27,21 @@ *******************************************************************************/ -/*! \file enb_agent_mac.c - * \brief enb agent message handler for MAC layer +/*! \file flexran_agent_mac.c + * \brief FlexRAN agent message handler for MAC layer * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_mac.h" -#include "enb_agent_extern.h" -#include "enb_agent_common.h" -#include "enb_agent_mac_internal.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_mac_internal.h" #include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" -#include "LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h" #include "liblfds700.h" @@ -61,7 +61,7 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ +int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -97,8 +97,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) { /*Disable both periodic and continuous updates*/ - enb_agent_disable_cont_mac_stats_update(mod_id); - enb_agent_destroy_timer_by_task_id(xid); + flexran_agent_disable_cont_mac_stats_update(mod_id); + flexran_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; } else { //One-off, periodical or continuous reporting @@ -108,7 +108,7 @@ int enb_agent_mac_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 = get_num_ues(mod_id); //eNB_UE_list->num_UEs + report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs 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 @@ -116,7 +116,7 @@ int enb_agent_mac_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 = 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_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_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs @@ -153,12 +153,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.ue_report_type[0].ue_report_flags = ue_flags; } request_config.config = &report_config; - enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); + flexran_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ long timer_id = 0; - enb_agent_timer_args_t *timer_args; - timer_args = malloc(sizeof(enb_agent_timer_args_t)); - memset (timer_args, 0, sizeof(enb_agent_timer_args_t)); + 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*/ @@ -169,11 +169,11 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr sec_interval = usec_interval/(1000*1000); usec_interval = usec_interval%(1000*1000); } - enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + 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*/ - enb_agent_disable_cont_mac_stats_update(mod_id); + flexran_agent_disable_cont_mac_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; @@ -191,7 +191,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.ue_report_type[0].ue_report_flags = ue_flags; } request_config.config = &report_config; - enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); + flexran_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -236,7 +236,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } - if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ + if (flexran_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } @@ -247,18 +247,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr return 0; error : - LOG_E(ENB_AGENT, "errno %d occured\n", err_code); + LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); return err_code; } -int enb_agent_mac_stats_request(mid_t mod_id, - xid_t xid, - const stats_request_config_t *report_config, - Protocol__FlexranMessage **msg) { +int flexran_agent_mac_stats_request(mid_t mod_id, + xid_t xid, + const stats_request_config_t *report_config, + Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) goto error; Protocol__FlexStatsRequest *stats_request_msg; @@ -358,7 +358,7 @@ int enb_agent_mac_stats_request(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) goto error; free(msg->stats_request_msg->header); @@ -377,10 +377,10 @@ int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_stats_reply(mid_t mod_id, - xid_t xid, - const report_config_t *report_config, - Protocol__FlexranMessage **msg) { +int flexran_agent_mac_stats_reply(mid_t mod_id, + xid_t xid, + const report_config_t *report_config, + Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i, j, k; int cc_id = 0; @@ -389,7 +389,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //UE_list_t *eNB_UE_list= &eNB->UE_list; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) goto error; Protocol__FlexStatsReply *stats_reply_msg; @@ -429,14 +429,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; for (j = 0; j++; j < ue_report[i]->n_bsr) { // NN: we need to know the cc_id here, consider the first one - elem[j] = get_ue_bsr (enb_id, i, j); + elem[j] = flexran_get_ue_bsr (enb_id, i, j); } ue_report[i]->bsr = elem; } /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { - ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + 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; } @@ -456,7 +456,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_rlc_bsr__init(rlc_reports[j]); rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; - rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); + rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; //TODO:Set tx queue head of line delay in ms @@ -480,7 +480,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__FLEX_CE_TYPE__FLPCET_ values found in stats_common.pb-c.h. See flex_ce_type in FlexRAN specification */ @@ -496,10 +496,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_dl_cqi_report__init(dl_report); - dl_report->sfn_sn = get_sfn_sf(enb_id); + dl_report->sfn_sn = flexran_get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //Set the number of DL CQI reports for this UE. One for each CC - dl_report->n_csi_report = get_active_CC(enb_id,i); + dl_report->n_csi_report = flexran_get_active_CC(enb_id,i); //Create the actual CSI reports. Protocol__FlexDlCsi **csi_reports; @@ -515,7 +515,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; //The rank indicator value for this cc - csi_reports[j]->ri = get_current_RI(enb_id,i,j); + csi_reports[j]->ri = flexran_get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE //For now we only support type P10, which only needs a wideband value @@ -532,7 +532,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id - csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; csi10->has_wb_cqi = 1; //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; @@ -618,7 +618,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = get_sfn_sf(enb_id); + full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex @@ -664,8 +664,8 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; full_ul_report->pucch_dbm[j]->serv_cell_index = j; - if(get_p0_pucch_dbm(enb_id,i, j) != -1){ - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + if(flexran_get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j); full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; } } @@ -704,7 +704,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number - ni_report->sfn_sf = get_sfn_sf(enb_id); + ni_report->sfn_sf = flexran_get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; //TODO:Received interference power in dbm ni_report->rip = 0; @@ -713,7 +713,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, ni_report->tnp = 0; ni_report->has_tnp = 0; - ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); + 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; } @@ -743,7 +743,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { +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; @@ -860,11 +860,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i; const int xid = *((int *)params); - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) goto error; Protocol__FlexUlSrInfo *ul_sr_info_msg; @@ -876,7 +876,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; - ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); + ul_sr_info_msg->sfn_sf = flexran_get_sfn_sf(mod_id); /*TODO: Set the number of UEs that sent an SR */ ul_sr_info_msg->n_rnti = 1; ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t)); @@ -912,7 +912,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes return -1; } -int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG) goto error; @@ -927,11 +927,11 @@ int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i,j; const int xid = *((int *)params); - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) goto error; Protocol__FlexSfTrigger *sf_trigger_msg; @@ -946,8 +946,8 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran int ahead_of_time = 1; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); subframe = ((subframe + ahead_of_time) % 10); @@ -955,18 +955,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran frame = frame + full_frames_ahead; - if (subframe < get_current_subframe(mod_id)) { + if (subframe < flexran_get_current_subframe(mod_id)) { frame++; } sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; - sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1); + sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 1); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs */ - sf_trigger_msg->n_dl_info = get_num_ues(mod_id); + sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id); Protocol__FlexDlInfo **dl_info = NULL; @@ -980,12 +980,12 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran if(dl_info[i] == NULL) goto error; protocol__flex_dl_info__init(dl_info[i]); - dl_info[i]->rnti = get_ue_crnti(mod_id, i); + dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*Fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; - get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); + flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /* Fill in the status of the HARQ process (2 TBs)*/ @@ -1009,7 +1009,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran /* Fill in the number of UL reception status related info, based on the number of currently * transmitting UEs */ - sf_trigger_msg->n_ul_info = get_num_ues(mod_id); + sf_trigger_msg->n_ul_info = flexran_get_num_ues(mod_id); Protocol__FlexUlInfo **ul_info = NULL; @@ -1023,15 +1023,15 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran if(ul_info[i] == NULL) goto error; protocol__flex_ul_info__init(ul_info[i]); - ul_info[i]->rnti = get_ue_crnti(mod_id, i); + ul_info[i]->rnti = flexran_get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*Fill in the Tx power control command for this UE (if available)*/ - if(get_tpc(mod_id,i) != 1){ - ul_info[i]->tpc = get_tpc(mod_id,i); + if(flexran_get_tpc(mod_id,i) != 1){ + ul_info[i]->tpc = flexran_get_tpc(mod_id,i); ul_info[i]->has_tpc = 1; } else{ - ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->tpc = flexran_get_tpc(mod_id,i); ul_info[i]->has_tpc = 0; } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the @@ -1081,7 +1081,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran return -1; } -int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { int i; if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; @@ -1107,11 +1107,11 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { int xid = 0; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) goto error; Protocol__FlexDlMacConfig *dl_mac_config_msg; @@ -1123,7 +1123,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; - dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); + dl_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -1139,7 +1139,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage return -1; } -int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { int i,j, k; if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) goto error; @@ -1202,7 +1202,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { return -1; } -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { +void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; @@ -1214,7 +1214,7 @@ void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage } } -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; enum lfds700_misc_flag overwrite_occurred_flag; @@ -1233,7 +1233,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { // Delete unmanaged dl_config - enb_agent_mac_destroy_dl_config(overwritten_dl_config); + flexran_agent_mac_destroy_dl_config(overwritten_dl_config); } *msg = NULL; return 2; @@ -1243,7 +1243,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco return -1; } -void enb_agent_init_mac_agent(mid_t mod_id) { +void flexran_agent_init_mac_agent(mid_t mod_id) { lfds700_misc_library_init_valid_on_current_logical_core(); lfds700_misc_prng_init(&ps[mod_id]); int num_elements = RINGBUFFER_SIZE + 1; @@ -1253,10 +1253,10 @@ void enb_agent_init_mac_agent(mid_t mod_id) { } /*********************************************** - * eNB agent - technology mac API implementation + * FlexRAN agent - technology mac API implementation ***********************************************/ -void enb_agent_send_sr_info(mid_t mod_id) { +void flexran_agent_send_sr_info(mid_t mod_id) { int size; Protocol__FlexranMessage *msg; void *data; @@ -1266,27 +1266,27 @@ void enb_agent_send_sr_info(mid_t mod_id) { int xid = 0; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + err_code = flexran_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + data=flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sr message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id) { +void flexran_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__FlexranMessage *msg; void *data; @@ -1296,27 +1296,27 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { int xid = 0; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); + err_code = flexran_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + data=flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); } -void enb_agent_send_update_mac_stats(mid_t mod_id) { +void flexran_agent_send_update_mac_stats(mid_t mod_id) { Protocol__FlexranMessage *current_report = NULL, *msg; void *data; @@ -1333,7 +1333,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { if (mac_stats_context[mod_id].cont_update == 1) { /*Create a fresh report with the required flags*/ - err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + err_code = flexran_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); if (err_code < 0) { goto error; } @@ -1343,10 +1343,10 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { /* *respecting the thresholds. Otherwise send the new report*\/ */ /* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */ - /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ + /* msg = flexran_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ /* /\*Destroy the old stats*\/ */ - /* enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ /* } */ /* /\*Use the current report for future comparissons*\/ */ /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ @@ -1357,34 +1357,34 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } if (current_report != NULL){ - data=enb_agent_pack_message(current_report, &size); + data=flexran_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); } -int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { +int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { if (mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); return -1; } //xface->agent_ctxt = &shared_ctxt[mod_id]; - xface->enb_agent_send_sr_info = enb_agent_send_sr_info; - xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; - xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; - xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; - xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; + xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info; + xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger; + xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats; + xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_default; + //xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_remote; + xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config; + xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change; xface->dl_scheduler_loaded_lib = NULL; @@ -1394,15 +1394,15 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return 0; } -int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { +int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { //xface->agent_ctxt = NULL; - xface->enb_agent_send_sr_info = NULL; - xface->enb_agent_send_sf_trigger = NULL; - xface->enb_agent_send_update_mac_stats = NULL; - xface->enb_agent_schedule_ue_spec = NULL; - xface->enb_agent_get_pending_dl_mac_config = NULL; - xface->enb_agent_notify_ue_state_change = NULL; + xface->flexran_agent_send_sr_info = NULL; + xface->flexran_agent_send_sf_trigger = NULL; + xface->flexran_agent_send_update_mac_stats = NULL; + xface->flexran_agent_schedule_ue_spec = NULL; + xface->flexran_agent_get_pending_dl_mac_config = NULL; + xface->flexran_agent_notify_ue_state_change = NULL; xface->dl_scheduler_loaded_lib = NULL; @@ -1414,10 +1414,10 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { /****************************************************** - *Implementations of enb_agent_mac_internal.h functions + *Implementations of flexran_agent_mac_internal.h functions ******************************************************/ -err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id) { /*Initialize the Mac stats update structure*/ /*Initially the continuous update is set to false*/ @@ -1437,12 +1437,12 @@ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { return -1; } -err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].is_initialized = 0; - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); mac_agent_registered[mod_id] = NULL; @@ -1450,8 +1450,8 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { } -err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, - xid_t xid, stats_request_config_t *stats_req) { +err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { /*Enable the continuous updates for the MAC*/ if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1459,7 +1459,7 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, Protocol__FlexranMessage *req_msg; - enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + flexran_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; mac_stats_context[mod_id].prev_stats_reply = NULL; @@ -1472,11 +1472,11 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, return 0; error: - LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; } -err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1484,10 +1484,10 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].xid = 0; if (mac_stats_context[mod_id].stats_req != NULL) { - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); } if (mac_stats_context[mod_id].prev_stats_reply != NULL) { - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); } if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1495,7 +1495,7 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { return 0; error: - LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/flexran_agent_mac.h similarity index 64% rename from openair2/ENB_APP/enb_agent_mac.h rename to openair2/ENB_APP/flexran_agent_mac.h index 0716b739e5..fbb13ceca9 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/flexran_agent_mac.h @@ -27,23 +27,23 @@ *******************************************************************************/ -/*! \file enb_agent_mac.h - * \brief enb agent message handler APIs for MAC layer +/*! \file flexran_agent_mac.h + * \brief FlexRAN agent message handler APIs for MAC layer * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_MAC_H_ -#define ENB_AGENT_MAC_H_ +#ifndef FLEXRAN_AGENT_MAC_H_ +#define FLEXRAN_AGENT_MAC_H_ #include "header.pb-c.h" #include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" -#include "enb_agent_common.h" -#include "enb_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_extern.h" /* These types will be used to give instructions for the type of stats reports @@ -77,54 +77,54 @@ typedef struct stats_request_config_s{ } stats_request_config_t; /* Initialization function for the agent structures etc */ -void enb_agent_init_mac_agent(mid_t mod_id); +void flexran_agent_init_mac_agent(mid_t mod_id); -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /* Statistics request protocol message constructor and destructor */ -int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); +int flexran_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); /* Statistics reply protocol message constructor and destructor */ -int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); +int flexran_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); /* Scheduling request information protocol message constructor and estructor */ -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); +int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); /* Subframe trigger protocol msssage constructor and destructor */ -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); +int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); +int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /********************************** - * eNB agent - technology mac API + * FlexRAN agent - technology mac API **********************************/ /*Inform controller about received scheduling requests during a subframe*/ -void enb_agent_send_sr_info(mid_t mod_id); +void flexran_agent_send_sr_info(mid_t mod_id); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_sf_trigger(mid_t mod_id); +void flexran_agent_send_sf_trigger(mid_t mod_id); /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration -void enb_agent_send_update_mac_stats(mid_t mod_id); +void flexran_agent_send_update_mac_stats(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); +void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); /*Register technology specific interface callbacks*/ -int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); +int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); /*Unregister technology specific callbacks*/ -int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); +int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/flexran_agent_mac_defs.h similarity index 75% rename from openair2/ENB_APP/enb_agent_mac_defs.h rename to openair2/ENB_APP/flexran_agent_mac_defs.h index cf473cae7d..e42847c371 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/flexran_agent_mac_defs.h @@ -27,52 +27,52 @@ *******************************************************************************/ -/*! \file enb_agent_mac_defs.h - * \brief enb agent - mac interface primitives +/*! \file flexran_agent_mac_defs.h + * \brief FlexRAN agent - mac interface primitives * \author Xenofon Foukas * \date 2016 * \version 0.1 * \mail x.foukas@sms.ed.ac.uk */ -#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__ -#define __ENB_AGENT_MAC_PRIMITIVES_H__ +#ifndef __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ +#define __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "flexran.pb-c.h" #include "header.pb-c.h" #define RINGBUFFER_SIZE 100 -/* ENB AGENT-MAC Interface */ +/* FLEXRAN AGENT-MAC Interface */ typedef struct { //msg_context_t *agent_ctxt; /// Inform the controller about the scheduling requests received during the subframe - void (*enb_agent_send_sr_info)(mid_t mod_id); + void (*flexran_agent_send_sr_info)(mid_t mod_id); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_sf_trigger)(mid_t mod_id); + void (*flexran_agent_send_sf_trigger)(mid_t mod_id); /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration - void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + void (*flexran_agent_send_update_mac_stats)(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message - void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, - Protocol__FlexranMessage **msg); + void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id, + Protocol__FlexranMessage **msg); /// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that /// dl_info is already initialized as flex_dl_mac_config and fills the /// flex_dl_data part of it - void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info); - + void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); + /// Notify the controller for a state change of a particular UE, by sending the proper /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) - void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, - uint32_t state_change); + void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, + uint32_t state_change); void *dl_scheduler_loaded_lib; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/flexran_agent_mac_internal.c similarity index 98% rename from openair2/ENB_APP/enb_agent_mac_internal.c rename to openair2/ENB_APP/flexran_agent_mac_internal.c index b42b3ac79b..7bfed81b48 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/flexran_agent_mac_internal.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_mac_internal.c +/*! \file flexran_agent_mac_internal.c * \brief Helper functions for the MAC agent * \author Xenofon Foukas * \date 2016 @@ -37,10 +37,10 @@ #include #include -#include "enb_agent_mac_internal.h" +#include "flexran_agent_mac_internal.h" -Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, - Protocol__FlexranMessage *old_message) { +Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, + Protocol__FlexranMessage *old_message) { int i, j; @@ -131,7 +131,7 @@ Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Fl /*Create header*/ int xid = old_report->header->xid; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); @@ -780,7 +780,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { void *loaded_scheduler = dlsym(lib, function_name); if (loaded_scheduler) { if (mac_agent_registered[mod_id]) { - agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler; if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); } diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/flexran_agent_mac_internal.h similarity index 82% rename from openair2/ENB_APP/enb_agent_mac_internal.h rename to openair2/ENB_APP/flexran_agent_mac_internal.h index 86a021f946..e7a922d503 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/flexran_agent_mac_internal.h @@ -27,23 +27,23 @@ *******************************************************************************/ -/*! \file enb_agent_mac_internal.h - * \brief Implementation specific definitions for the eNB MAC agent +/*! \file flexran_agent_mac_internal.h + * \brief Implementation specific definitions for the FlexRAN MAC agent * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_MAC_INTERNAL_H_ -#define ENB_AGENT_MAC_INTERNAL_H_ +#ifndef FLEXRAN_AGENT_MAC_INTERNAL_H_ +#define FLEXRAN_AGENT_MAC_INTERNAL_H_ #include #include -#include "enb_agent_mac.h" -#include "enb_agent_common.h" -#include "enb_agent_defs.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_common.h" +#include "flexran_agent_defs.h" /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe @@ -64,18 +64,18 @@ mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ -err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id); -err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id); /*Enable/Disable the continuous stats update service for the MAC*/ -err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, +err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req); -err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id); -Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, +Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, Protocol__FlexranMessage *old_report); Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original); @@ -111,4 +111,4 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); int load_dl_scheduler_function(mid_t mod_id, const char *function_name); -#endif /*ENB_AGENT_MAC_INTERNAL_H_*/ +#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/ diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c similarity index 52% rename from openair2/ENB_APP/enb_agent_net_comm.c rename to openair2/ENB_APP/flexran_agent_net_comm.c index e180d7affd..986c819fb0 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -27,26 +27,26 @@ *******************************************************************************/ -/*! \file enb_agent_net_comm.c - * \brief enb agent network interface abstraction +/*! \file flexran_agent_net_comm.c + * \brief FlexRAN agent network interface abstraction * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#include "enb_agent_net_comm.h" +#include "flexran_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; -enb_agent_channel_instance_t channel_instance; -int enb_agent_channel_id = 0; +flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; +flexran_agent_channel_instance_t channel_instance; +int flexran_agent_channel_id = 0; -int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { +int flexran_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) { + if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { goto error; } - enb_agent_channel_t *channel; + flexran_agent_channel_t *channel; channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ @@ -57,16 +57,16 @@ int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, return channel->msg_send(data, size, priority, channel->channel_info); error: - LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); return -1; } -int enb_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 *size, int *priority) { /*Check if agent id is valid*/ - if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { goto error; } - enb_agent_channel_t *channel; + flexran_agent_channel_t *channel; channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ @@ -77,19 +77,19 @@ int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size return channel->msg_recv(data, size, priority, channel->channel_info); error: - LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); return -1; } -int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) { +int flexran_agent_register_channel(mid_t mod_id, flexran_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++) { + if (agent_id == FLEXRAN_AGENT_MAX) { + for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { agent_channel[mod_id][i] = channel; } } else { @@ -98,11 +98,11 @@ int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent return 0; } -void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { +void flexran_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++) { + if (agent_id == FLEXRAN_AGENT_MAX) { + for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { agent_channel[mod_id][i] = NULL; } } else { @@ -110,13 +110,13 @@ void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { } } -int enb_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)(enb_agent_channel_t *channel)) { +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), + void (*release)(flexran_agent_channel_t *channel)) { - int channel_id = ++enb_agent_channel_id; - enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_agent_channel_t)); + int channel_id = ++flexran_agent_channel_id; + flexran_agent_channel_t *channel = (flexran_agent_channel_t *) malloc(sizeof(flexran_agent_channel_t)); channel->channel_id = channel_id; channel->channel_info = channel_info; channel->msg_send = msg_send; @@ -124,22 +124,22 @@ int enb_agent_create_channel(void *channel_info, channel->release = release; /*element should be a real pointer*/ - RB_INSERT(enb_agent_channel_map, &channel_instance.enb_agent_head, channel); + RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel); - LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); return channel_id; } -int enb_agent_destroy_channel(int channel_id) { +int flexran_agent_destroy_channel(int channel_id) { int i, j; /*Check to see if channel exists*/ - struct enb_agent_channel_s *e = NULL; - struct enb_agent_channel_s search; - memset(&search, 0, sizeof(struct enb_agent_channel_s)); + struct flexran_agent_channel_s *e = NULL; + struct flexran_agent_channel_s search; + memset(&search, 0, sizeof(struct flexran_agent_channel_s)); - e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + e = RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); if (e == NULL) { return -1; @@ -147,7 +147,7 @@ int enb_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++) { + for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { if (agent_channel[i][j] != NULL) { if (agent_channel[i][j]->channel_id == e->channel_id) { agent_channel[i][j] == NULL; @@ -157,21 +157,21 @@ int enb_agent_destroy_channel(int channel_id) { } /*Remove the channel from the tree and free memory*/ - RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e); + RB_REMOVE(flexran_agent_channel_map, &channel_instance.flexran_agent_head, e); e->release(e); free(e); return 0; } -err_code_t enb_agent_init_channel_container(void) { +err_code_t flexran_agent_init_channel_container(void) { int i, j; - LOG_I(ENB_AGENT, "init RB tree for channel container\n"); + LOG_I(FLEXRAN_AGENT, "init RB tree for channel container\n"); - RB_INIT(&channel_instance.enb_agent_head); + RB_INIT(&channel_instance.flexran_agent_head); for (i = 0; i < NUM_MAX_ENB; i++) { - for (j = 0; j < ENB_AGENT_MAX; j++) { + for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { agent_channel[i][j] == NULL; } } @@ -179,9 +179,9 @@ err_code_t enb_agent_init_channel_container(void) { return 0; } -RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel); +RB_GENERATE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); -int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b) { +int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b) { if (a->channel_id < b->channel_id) return -1; if (a->channel_id > b->channel_id) return 1; @@ -189,12 +189,12 @@ int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_ch return 0; } -enb_agent_channel_t * get_channel(int channel_id) { +flexran_agent_channel_t * get_channel(int channel_id) { - struct enb_agent_channel_s search; - memset(&search, 0, sizeof(struct enb_agent_channel_s)); + struct flexran_agent_channel_s search; + memset(&search, 0, sizeof(struct flexran_agent_channel_s)); search.channel_id = channel_id; - return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + return RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); } diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h similarity index 54% rename from openair2/ENB_APP/enb_agent_net_comm.h rename to openair2/ENB_APP/flexran_agent_net_comm.h index 2a2268dc80..ca26de7c16 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/flexran_agent_net_comm.h @@ -27,63 +27,63 @@ *******************************************************************************/ -/*! \file enb_agent_net_comm.h - * \brief enb agent network interface abstraction +/*! \file flexran_agent_net_comm.h + * \brief FlexRAN agent network interface abstraction * \autho Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_NET_COMM_H_ -#define ENB_AGENT_NET_COMM_H_ +#ifndef FLEXRAN_AGENT_NET_COMM_H_ +#define FLEXRAN_AGENT_NET_COMM_H_ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "tree.h" /*Channel related information used for Tx/Rx of protocol messages*/ -typedef struct enb_agent_channel_s { - RB_ENTRY(enb_agent_channel_s) entry; +typedef struct flexran_agent_channel_s { + RB_ENTRY(flexran_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 enb_agent_channel_s *channel); -} enb_agent_channel_t; +void (*release)(struct flexran_agent_channel_s *channel); +} flexran_agent_channel_t; -typedef struct enb_agent_channel_instance_s{ - RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head; -} enb_agent_channel_instance_t; +typedef struct flexran_agent_channel_instance_s{ + RB_HEAD(flexran_agent_channel_map, flexran_agent_channel_s) flexran_agent_head; +} flexran_agent_channel_instance_t; /*Send and receive messages using the channel registered for a specific agent*/ -int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); +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); -/*Register a channel to an agent. Use ENB_AGENT_MAX to register the +/*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the *same channel to all agents*/ -int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id); +int flexran_agent_register_channel(mid_t mod_id, flexran_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 enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); +/*Unregister the current channel of an agent. Use FLEXRAN_AGENT_MAX to unregister all channels*/ +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 enb_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)(enb_agent_channel_t *channel)); +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), + void (*release)(flexran_agent_channel_t *channel)); /*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ -int enb_agent_destroy_channel(int channel_id); +int flexran_agent_destroy_channel(int channel_id); /*Return an agent communication channel based on its id*/ -enb_agent_channel_t * get_channel(int channel_id); +flexran_agent_channel_t * get_channel(int channel_id); /*Should be called before performing any channel operations*/ -err_code_t enb_agent_init_channel_container(void); +err_code_t flexran_agent_init_channel_container(void); -int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b); +int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b); /* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel); +RB_PROTOTYPE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); -#endif /*ENB_AGENT_COMM_H_*/ +#endif /*FLEXRAN_AGENT_COMM_H_*/ diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c similarity index 74% rename from openair2/ENB_APP/enb_agent_task_manager.c rename to openair2/ENB_APP/flexran_agent_task_manager.c index 9b4be2ff6a..e278386ba4 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/flexran_agent_task_manager.c @@ -26,8 +26,8 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ -/*! \file enb_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the enb agent +/*! \file flexran_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas * \date January 2016 * \version 0.1 @@ -39,8 +39,8 @@ #include #include -#include "enb_agent_task_manager.h" -#include "enb_agent_common.c" +#include "flexran_agent_task_manager.h" +#include "flexran_agent_common.c" /* Util macros */ @@ -48,10 +48,10 @@ #define RIGHT(x) (2 * (x) + 2) #define PARENT(x) ((x - 1) / 2) -enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num) { - enb_agent_task_t *task = NULL; - task = malloc(sizeof(enb_agent_task_t)); +flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, + uint16_t frame_num, uint8_t subframe_num) { + flexran_agent_task_t *task = NULL; + task = malloc(sizeof(flexran_agent_task_t)); if (task == NULL) goto error; @@ -66,7 +66,7 @@ enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, return NULL; } -void enb_agent_task_destroy(enb_agent_task_t *task) { +void flexran_agent_task_destroy(flexran_agent_task_t *task) { if (task == NULL) return; @@ -75,26 +75,27 @@ void enb_agent_task_destroy(enb_agent_task_t *task) { free(task); } -enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { - enb_agent_task_queue_t *queue = NULL; +flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, + const flexran_agent_task_t *t2)) { + flexran_agent_task_queue_t *queue = NULL; - queue = malloc(sizeof(enb_agent_task_queue_t)); + queue = malloc(sizeof(flexran_agent_task_queue_t)); if (queue == NULL) goto error; /* If no comparator was given, use the default one */ if (cmp == NULL) - queue->cmp = _enb_agent_task_queue_cmp; + queue->cmp = _flexran_agent_task_queue_cmp; else queue->cmp = cmp; - + queue->mod_id = mod_id; queue->first_frame = 0; queue->first_subframe = 0; - queue->task = malloc(capacity * sizeof(enb_agent_task_t *)); + queue->task = malloc(capacity * sizeof(flexran_agent_task_t *)); if (queue->task == NULL) goto error; @@ -118,27 +119,27 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, return NULL; } -enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id) { - return enb_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); +flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id) { + return flexran_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); } -void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { +void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue) { int i; if (queue == NULL) return; for (i = 0; i < queue->count; i++) { - enb_agent_task_destroy(queue->task[i]); + flexran_agent_task_destroy(queue->task[i]); } free(queue->task); free(queue->mutex); free(queue); } -int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task) { +int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task) { size_t i; - enb_agent_task_t *tmp = NULL; + flexran_agent_task_t *tmp = NULL; int realloc_status, err_code; if (pthread_mutex_lock(queue->mutex)) { @@ -149,7 +150,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta if (queue->count >= queue->capacity) { /*TODO: need to call realloc heap*/ - realloc_status = _enb_agent_task_queue_realloc_heap(queue); + realloc_status = _flexran_agent_task_queue_realloc_heap(queue); if (realloc_status != HEAP_OK) { err_code = realloc_status; goto error; @@ -179,7 +180,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta } -int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { +int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task) { int err_code; if (pthread_mutex_lock(queue->mutex)) { @@ -195,8 +196,8 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age } /* Find current frame and subframe number */ - uint16_t curr_frame=get_current_frame(queue->mod_id); - uint8_t curr_subframe=get_current_subframe(queue->mod_id); + uint16_t curr_frame = flexran_get_current_frame(queue->mod_id); + uint8_t curr_subframe = flexran_get_current_subframe(queue->mod_id); /* If no task is scheduled for the current subframe, return without any task */ if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { @@ -208,7 +209,7 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age queue->task[0] = queue->task[queue->count-1]; queue->count--; /* Restore heap property */ - _enb_agent_task_queue_heapify(queue, 0); + _flexran_agent_task_queue_heapify(queue, 0); /*If queue has no element*/ if (queue->count < 1) { @@ -231,9 +232,9 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age } /*Warning: Internal function. Should not be called as API function. Not thread safe*/ -void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { +void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx) { /* left index, right index, largest */ - enb_agent_task_t *tmp = NULL; + flexran_agent_task_t *tmp = NULL; size_t l_idx, r_idx, lrg_idx; l_idx = LEFT(idx); @@ -258,32 +259,32 @@ void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { queue->task[lrg_idx] = queue->task[idx]; queue->task[idx] = tmp; /* Heapify again */ - _enb_agent_task_queue_heapify(queue, lrg_idx); + _flexran_agent_task_queue_heapify(queue, lrg_idx); } } /*Warning: Internal function. Should not be called as API function. Not thread safe*/ -int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { - enb_agent_task_t **resized_task_heap; +int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue) { + flexran_agent_task_t **resized_task_heap; if (queue->count >= queue->capacity) { - size_t task_size = sizeof(enb_agent_task_t); + size_t task_size = sizeof(flexran_agent_task_t); resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size); if (resized_task_heap != NULL) { queue->capacity *= 2; - queue->task = (enb_agent_task_t **) resized_task_heap; + queue->task = (flexran_agent_task_t **) resized_task_heap; return HEAP_OK; } else return HEAP_REALLOCERROR; } return HEAP_NOREALLOC; } -int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2) { +int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2) { if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) return 0; - uint16_t curr_frame = get_current_frame(mod_id); - uint8_t curr_subframe = get_current_subframe(mod_id); + uint16_t curr_frame = flexran_get_current_frame(mod_id); + uint8_t curr_subframe = flexran_get_current_subframe(mod_id); int f_offset, sf_offset, tmp1, tmp2; diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h similarity index 68% rename from openair2/ENB_APP/enb_agent_task_manager.h rename to openair2/ENB_APP/flexran_agent_task_manager.h index 0c458061cf..9faa0e3db7 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/flexran_agent_task_manager.h @@ -26,8 +26,8 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ -/*! \file enb_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the enb agent +/*! \file flexran_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas * \date January 2016 * \version 0.1 @@ -35,15 +35,15 @@ * @ingroup _mac */ -#ifndef ENB_AGENT_TASK_MANAGER_ -#define ENB_AGENT_TASK_MANAGER_ +#ifndef FLEXRAN_AGENT_TASK_MANAGER_ +#define FLEXRAN_AGENT_TASK_MANAGER_ #include #include #include "flexran.pb-c.h" -#include "enb_agent_common.h" +#include "flexran_agent_common.h" #ifdef __cplusplus extern "C" { @@ -54,19 +54,19 @@ extern "C" { /** * The structure containing the enb agent task to be executed */ -typedef struct enb_agent_task_s { +typedef struct flexran_agent_task_s { /* The frame in which the task needs to be executed */ uint16_t frame_num; /* The subframe in which the task needs to be executed */ uint8_t subframe_num; /* The task to be executed in the form of a Protocol__FlexranMessage */ Protocol__FlexranMessage *task; -} enb_agent_task_t; +} flexran_agent_task_t; /** * Priority Queue Structure for tasks */ -typedef struct enb_agent_task_queue_s { +typedef struct flexran_agent_task_queue_s { mid_t mod_id; /* The amount of allocated memory for agent tasks in the heap*/ volatile size_t capacity; @@ -77,11 +77,11 @@ typedef struct enb_agent_task_queue_s { /* The earliest subframe within the frame that has a pending task */ volatile uint8_t first_subframe; /* An array of prioritized tasks stored in a heap */ - enb_agent_task_t **task; + flexran_agent_task_t **task; /* A pointer to a comparator function, used to prioritize elements */ - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); pthread_mutex_t *mutex; -} enb_agent_task_queue_t; +} flexran_agent_task_queue_t; typedef enum { HEAP_OK = 0, @@ -95,56 +95,57 @@ typedef enum { /** * Allocate memory for a task in the queue */ -enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num); +flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, + uint16_t frame_num, uint8_t subframe_num); /** * Free memory for a task of the queue */ -void enb_agent_task_destroy(enb_agent_task_t *task); +void flexran_agent_task_destroy(flexran_agent_task_t *task); /** * Allocate initial memory for storing the tasks */ - enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, + const flexran_agent_task_t *t2)); /** * Allocate initial memory for storing the tasks using default parameters */ -enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id); +flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id); /** * De-allocate memory for the tasks queue */ -void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue); +void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue); /** * Insert task into the queue */ -int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task); +int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task); /** * Remove the task with the highest priority from the queue * task becomes NULL if there is no task for the current frame and subframe */ -int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task); +int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task); /** * Check if the top priority task is for a specific frame and subframe */ -int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue, - const uint16_t frame, const uint8_t subframe); +int flexran_agent_task_queue_has_upcoming_task (flexran_agent_task_queue_t *queue, + const uint16_t frame, const uint8_t subframe); /** * Restructure heap after modifications */ -void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx); +void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx); /** * Reallocate memory once the heap reaches max size */ -int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); +int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue); /** * Compare two agent tasks based on frame and subframe @@ -153,10 +154,10 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); * return positive value if t1 preceeds t2 * Need to give eNB id for the comparisson based on the current frame-subframe */ - int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); #ifdef __cplusplus } #endif -#endif /*ENB_AGENT_TASK_MANAGER_*/ +#endif /*FLEXRAN_AGENT_TASK_MANAGER_*/ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index b57f5e965b..d24ac7c5d9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -53,9 +53,9 @@ #include "pdcp.h" //Agent-related headers -#include "enb_agent_extern.h" -#include "enb_agent_mac.h" -#include "enb_agent_mac_proto.h" +#include "flexran_agent_extern.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -141,9 +141,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //mac_remove_ue(module_idP, i, frameP, subframeP); //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, - rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + agent_mac_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP, + rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } } else { @@ -330,7 +330,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, /* #ifndef DISABLE_SF_TRIGGER */ /* //Send subframe trigger to the controller */ /* if (mac_agent_registered[module_idP]) { */ -/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */ +/* agent_mac_xface[module_idP]->flexran_agent_send_sf_trigger(module_idP); */ /* } */ /* #endif */ @@ -392,19 +392,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -440,19 +440,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -470,19 +470,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -506,19 +506,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -534,20 +534,20 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); + } #endif } @@ -577,19 +577,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -606,19 +606,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -642,19 +642,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } else if ((mac_xface->frame_parms->tdd_config == 0) || // TDD Config 0 @@ -669,19 +669,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -721,19 +721,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -745,19 +745,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -772,19 +772,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -805,19 +805,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -828,19 +828,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -855,19 +855,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -893,19 +893,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -920,19 +920,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -952,19 +952,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -977,19 +977,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1002,19 +1002,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1027,19 +1027,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1054,19 +1054,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -1084,7 +1084,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, #ifndef DISABLE_CONT_STATS //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); + agent_mac_xface[module_idP]->flexran_agent_send_update_mac_stats(module_idP); } #endif diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h similarity index 68% rename from openair2/LAYER2/MAC/enb_agent_mac_proto.h rename to openair2/LAYER2/MAC/flexran_agent_mac_proto.h index 3c2d36e678..9e46e0904a 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h @@ -27,8 +27,8 @@ *******************************************************************************/ -/*! \file enb_agent_mac_proto.h - * \brief MAC functions for eNB agent +/*! \file flexran_agent_mac_proto.h + * \brief MAC functions for FlexRAN agent * \author Xenofon Foukas * \date 2016 * \email: x.foukas@sms.ed.ac.uk @@ -37,34 +37,34 @@ */ -#ifndef __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ -#define __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ +#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__ +#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "header.pb-c.h" #include "flexran.pb-c.h" /* * Default scheduler used by the eNB agent */ -void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info); +void flexran_schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ -void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__FlexranMessage *dl_scheduling_info); +void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + const Protocol__FlexranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler */ -void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); +void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); /* * Data plane function for filling the DCI structure */ -void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); +void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); #endif diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c similarity index 96% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c index a4d4d79250..aff196681e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dataplane.c +/*! \file flexran_agent_scheduler_dataplane.c * \brief data plane procedures related to eNB scheduling * \author Xenofon Foukas * \date 2016 @@ -44,7 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -65,11 +65,11 @@ #include "SIMULATION/TOOLS/defs.h" // for taus -void apply_dl_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - const Protocol__FlexranMessage *dl_scheduling_info) { +void flexran_apply_dl_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + const Protocol__FlexranMessage *dl_scheduling_info) { Protocol__FlexDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; @@ -85,19 +85,19 @@ void apply_dl_scheduling_decisions(mid_t mod_id, // Check if there is anything to schedule for the UEs if (mac_config->n_dl_ue_data > 0) { - apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, - mac_config->n_dl_ue_data, mac_config->dl_ue_data); + flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, + mac_config->n_dl_ue_data, mac_config->dl_ue_data); } } -void apply_ue_spec_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - uint32_t n_dl_ue_data, - const Protocol__FlexDlData **dl_ue_data) { +void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + uint32_t n_dl_ue_data, + const Protocol__FlexDlData **dl_ue_data) { uint8_t CC_id; int UE_id; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c similarity index 98% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index 4572e73def..cf033959d3 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue.c +/*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel * \author Xenofon Foukas * \date 2016 @@ -44,7 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -57,14 +57,14 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "ENB_APP/enb_agent_defs.h" +#include "ENB_APP/flexran_agent_defs.h" //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" #include "header.pb-c.h" #include "flexran.pb-c.h" -#include "enb_agent_mac.h" +#include "flexran_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -76,13 +76,11 @@ //------------------------------------------------------------------------------ void -schedule_ue_spec_default( - mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - Protocol__FlexranMessage **dl_info -) +flexran_schedule_ue_spec_default(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + Protocol__FlexranMessage **dl_info) //------------------------------------------------------------------------------ { uint8_t CC_id; @@ -127,7 +125,7 @@ schedule_ue_spec_default( uint8_t ue_has_transmission = 0; uint32_t ndi; - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); if (UE_list->head==-1) { return; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c similarity index 86% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c index b5882c84e3..78b093c27d 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue_remote.c +/*! \file flexran_agent_scheduler_dlsch_ue_remote.c * \brief procedures related to remote scheduling in the DLSCH transport channel * \author Xenofon Foukas * \date 2016 @@ -37,9 +37,9 @@ */ -#include "enb_agent_common_internal.h" +#include "flexran_agent_common_internal.h" -#include "eNB_agent_scheduler_dlsch_ue_remote.h" +#include "flexran_agent_scheduler_dlsch_ue_remote.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/extern.h" @@ -52,8 +52,8 @@ int queue_initialized = 0; //uint32_t period = 10; //uint32_t sched [] = {1, 2, 3}; -void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { +void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { //if ((subframe == skip_subframe) && (frame % period == 0)) { @@ -97,19 +97,19 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } else if (diff < 0) { //previous subframe , delete message and free memory LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); - enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); + flexran_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); eNB->eNB_stats[mod_id].sched_decisions++; eNB->eNB_stats[mod_id].missed_deadlines++; } else { // next subframe, nothing to do now LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } } //Done with the local cache. Now we need to check if something new arrived - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + flexran_agent_get_pending_dl_mac_config(mod_id, dl_info); while (*dl_info != NULL) { diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); @@ -119,9 +119,9 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, return; } else if (diff < 0) { LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); - enb_agent_mac_destroy_dl_config(*dl_info); + flexran_agent_mac_destroy_dl_config(*dl_info); *dl_info = NULL; - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + flexran_agent_get_pending_dl_mac_config(mod_id, dl_info); eNB->eNB_stats[mod_id].sched_decisions++; eNB->eNB_stats[mod_id].missed_deadlines++; } else { // Intended for future subframe. Store it in local cache @@ -129,22 +129,22 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); e->dl_info = *dl_info; TAILQ_INSERT_TAIL(&queue_head, e, configs); - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } } // We found no pending command, so we will simply pass an empty one - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); } int get_sf_difference(mid_t mod_id, uint32_t sfn_sf) { int diff_in_subframes; - uint16_t current_frame = get_current_system_frame_num(mod_id); - uint16_t current_subframe = get_current_subframe(mod_id); - uint32_t current_sfn_sf = get_sfn_sf(mod_id); + uint16_t current_frame = flexran_get_current_system_frame_num(mod_id); + uint16_t current_subframe = flexran_get_current_subframe(mod_id); + uint32_t current_sfn_sf = flexran_get_sfn_sf(mod_id); if (sfn_sf == current_sfn_sf) { return 0; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h similarity index 85% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h index 9ff750969b..2cfad85771 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue_remote.h +/*! \file flexran_agent_scheduler_dlsch_ue_remote.h * \brief Local stub for remote scheduler used by the controller * \author Xenofon Foukas * \date 2016 @@ -37,15 +37,15 @@ */ -#ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ -#define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ +#ifndef __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ +#define __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ #include "flexran.pb-c.h" #include "header.pb-c.h" -#include "ENB_APP/enb_agent_defs.h" -#include "enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "ENB_APP/flexran_agent_defs.h" +#include "flexran_agent_mac.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include @@ -63,7 +63,7 @@ TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); /* * Default scheduler used by the eNB agent */ -void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, +void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__FlexranMessage **dl_info); diff --git a/openair2/LAYER2/MAC/flexran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h index e9d9494a1a..038290d1b2 100644 --- a/openair2/LAYER2/MAC/flexran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file dci_conversions.h +/*! \file flexran_dci_conversions.h * \brief Conversion helpers from flexran messages to OAI formats DCI * \author Xenofon Foukas * \date 2016 diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 2b075a7ed3..3f8e7c5f83 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -93,7 +93,7 @@ #include "SIMULATION/TOOLS/defs.h" // for taus -#include "enb_agent_extern.h" +#include "flexran_agent_extern.h" #define XER_PRINT #ifdef PHY_EMUL @@ -4543,7 +4543,7 @@ rrc_eNB_decode_dcch( //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]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + agent_mac_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_UPDATED); } @@ -4644,7 +4644,7 @@ rrc_eNB_decode_dcch( 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 (mac_agent_registered[ctxt_pP->module_id]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + agent_mac_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); } diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 0a5b0a8ccd..49f00325f8 100644 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -325,13 +325,13 @@ int logInit (void) g_log->log_component[ENB_APP].filelog = 0; g_log->log_component[ENB_APP].filelog_name = ""; - g_log->log_component[ENB_AGENT].name = "ENB_AGENT"; - g_log->log_component[ENB_AGENT].level = LOG_DEBUG; - g_log->log_component[ENB_AGENT].flag = LOG_MED; - g_log->log_component[ENB_AGENT].interval = 1; - g_log->log_component[ENB_AGENT].fd = 0; - g_log->log_component[ENB_AGENT].filelog = 0; - g_log->log_component[ENB_AGENT].filelog_name = ""; + g_log->log_component[FLEXRAN_AGENT].name = "FLEXRAN_AGENT"; + g_log->log_component[FLEXRAN_AGENT].level = LOG_DEBUG; + g_log->log_component[FLEXRAN_AGENT].flag = LOG_MED; + g_log->log_component[FLEXRAN_AGENT].interval = 1; + g_log->log_component[FLEXRAN_AGENT].fd = 0; + g_log->log_component[FLEXRAN_AGENT].filelog = 0; + g_log->log_component[FLEXRAN_AGENT].filelog_name = ""; g_log->log_component[TMR].name = "TMR"; g_log->log_component[TMR].level = LOG_EMERG; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 442fbd749e..6a6569c1a5 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -270,7 +270,7 @@ typedef enum { RAL_ENB, RAL_UE, ENB_APP, - ENB_AGENT, + FLEXRAN_AGENT, TMR, USIM, LOCALIZE, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf new file mode 100644 index 0000000000..2e39b934e4 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf @@ -0,0 +1,182 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + 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 = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + 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 = 115; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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; + } + ); + + 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 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + 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"; + 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/enb.band5.flexran.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf new file mode 100644 index 0000000000..66e7ef433d --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf @@ -0,0 +1,182 @@ +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_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + 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 = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 115; + 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 = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + 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 = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + 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; + } + ); + + 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 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + 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"; + 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/enb.band7.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf index f73a78b3b0..7e68b5d84b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf @@ -155,10 +155,10 @@ eNBs = NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf index e5bd9455e3..4ee429f45e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf @@ -155,10 +155,10 @@ eNBs = NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 438f1f9efd..9253c2c50d 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -75,8 +75,8 @@ uint8_t config_smbv = 0; char smbv_ip[16]; #endif -#if defined(ENB_AGENT_SB_IF) -# include "enb_agent.h" +#if defined(FLEXRAN_AGENT_SB_IF) +# include "flexran_agent.h" #endif @@ -1301,8 +1301,8 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->frame_parms); #endif - /* #if defined (ENB_AGENT_SB_IF) - enb_agent_start(); + /* #if defined (FLEXRAN_AGENT_SB_IF) + flexran_agent_start(); #endif */ // add events to future event list: Currently not used From 92ef1739b1526c1af72b54198089b468b4ad99b8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:36:45 +0200 Subject: [PATCH 146/182] Restructured FlexRAN agent file hierarchy --- cmake_targets/CMakeLists.txt | 5 +++-- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- .../ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.c | 0 .../ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.h | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_defs.h | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.c | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.h | 0 7 files changed, 4 insertions(+), 3 deletions(-) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.c (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.h (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_defs.h (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.c (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.h (100%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8f696ed653..da90efdaee 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -817,6 +817,7 @@ 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") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") @@ -903,12 +904,12 @@ if (FLEXRAN_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac_internal.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c ) set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index b5fd7efd70..d6f5a40da7 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -64,7 +64,7 @@ //Agent-related headers #include "ENB_APP/flexran_agent_extern.h" -#include "ENB_APP/flexran_agent_mac.h" +#include "ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h" #include "LAYER2/MAC/flexran_agent_mac_proto.h" //#define DIAG_PHY diff --git a/openair2/ENB_APP/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac.c rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c diff --git a/openair2/ENB_APP/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h diff --git a/openair2/ENB_APP/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_defs.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h diff --git a/openair2/ENB_APP/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_internal.c rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c diff --git a/openair2/ENB_APP/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_internal.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h From 5864cc08cdad829039bb80465fe27603ba092626 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:49:39 +0200 Subject: [PATCH 147/182] Integrated scheduler to overall FlexRAN agent functionality --- openair2/LAYER2/MAC/eNB_scheduler.c | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index d24ac7c5d9..386efec596 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -63,7 +63,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 -#define ENABLE_ENB_AGENT_DL_SCHEDULER +//efine ENABLE_ENB_AGENT_DL_SCHEDULER //#define DISABLE_SF_TRIGGER //#define DISABLE_CONT_STATS @@ -387,7 +387,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, (mac_xface->frame_parms->tdd_config == 6)) { //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); } -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -418,14 +418,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 0: case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; @@ -435,7 +435,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,1,5); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -465,7 +465,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // FDD, normal UL/DLSCH if (mac_xface->frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,2,6); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -501,7 +501,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -529,7 +529,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,3,7); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -572,7 +572,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -601,7 +601,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else @@ -637,7 +637,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->frame_parms->frame_type == FDD) { schedule_RA(module_idP,frameP,subframeP,1); schedule_ulsch(module_idP,frameP,cooperation_flag,5,9); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -660,11 +660,11 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else if ((mac_xface->frame_parms->tdd_config == 0) || // TDD Config 0 (mac_xface->frame_parms->tdd_config == 6)) { // TDD Config 6 //schedule_ulsch(module_idP,cooperation_flag,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif } else { -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -701,7 +701,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; @@ -709,14 +709,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; case 5: schedule_RA(module_idP,frameP,subframeP,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -740,7 +740,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -767,7 +767,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,6,0); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -800,7 +800,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -823,7 +823,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -850,7 +850,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,7,1); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -888,7 +888,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -915,7 +915,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,8,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -947,7 +947,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -972,7 +972,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -997,7 +997,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4); //schedule_RA(module_idP,frameP,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -1022,7 +1022,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 2: case 5: //schedule_RA(module_idP,frameP,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -1049,7 +1049,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,9,3); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else From 83929d42f2a38f96d7f2f1af544fd982c410d5e9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 5 Nov 2016 14:09:48 +0200 Subject: [PATCH 148/182] Refactored local FlexRAN scheduler to make further use of FlexRAN API --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 2 +- openair2/ENB_APP/flexran_agent_common.c | 172 ++-- openair2/ENB_APP/flexran_agent_common.h | 15 +- .../MAC/flexran_agent_scheduler_dlsch_ue.c | 765 ++++++++++++++++-- 4 files changed, 819 insertions(+), 135 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 c85ec6c4eb..34b6ef345f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -995,7 +995,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle // TODO: This should be different per TB if(harq_status == 0) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK; - else if (harq_status == 1) + else if (harq_status > 0) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } /*Fill in the serving cell index for this UE */ diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 302c792771..00f938f4fb 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -569,46 +569,73 @@ int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t chann return rlc_status.bytes_in_buffer; } -int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) -{ - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); - - if (eNB_UE_stats == NULL) { - return 0; - } +int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) { + + UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id]; + int rnti; - int32_t time_advance; - switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) { - case 6: - time_advance = eNB_UE_stats->timing_advance_update; - break; + rnti = flexran_get_ue_crnti(mod_id, ue_id); + if (ue_sched_ctl->ta_timer == 0) { - case 15: - time_advance = eNB_UE_stats->timing_advance_update/2; - break; + // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ... + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY + switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) { + case 6: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update; + break; - case 25: - time_advance = eNB_UE_stats->timing_advance_update/4; - break; + case 15: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2; + break; - case 50: - time_advance = eNB_UE_stats->timing_advance_update/8; - break; + case 25: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4; + break; - case 75: - time_advance = eNB_UE_stats->timing_advance_update/12; - break; + case 50: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8; + break; - case 100: - time_advance = eNB_UE_stats->timing_advance_update/16; - break; - } + case 75: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12; + break; + + case 100: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16; + break; + } + // clear the update in case PHY does not have a new measurement after timer expiry + eNB_UE_stats->timing_advance_update = 0; + } + else { + ue_sched_ctl->ta_timer--; + ue_sched_ctl->ta_update = 0; // don't trigger a timing advance command + } + + return ue_sched_ctl->ta_update = 0; + +} + +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { + + UE_list_t *UE_list = &eNB_mac_inst[mod_id].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id]; + + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } + + if (ue_sched_ctl->ta_update == 0) { + return 1; + } else { + return 0; + } - if(time_advance > 0) - return 1; - else - return 0; } int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { @@ -616,12 +643,12 @@ int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { } int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { - LTE_eNB_UE_stats *eNB_UE_stats = NULL; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; - int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); if (eNB_UE_stats == NULL) { return 0; @@ -631,14 +658,14 @@ int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { } int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { - LTE_eNB_UE_stats *eNB_UE_stats = NULL; - int32_t normalized_rx_power, target_rx_power; - int tpc = 1; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + int32_t normalized_rx_power, target_rx_power; + int tpc = 1; - int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); @@ -651,36 +678,38 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { } if (normalized_rx_power>(target_rx_power+1)) { - tpc = 0; //-1 + tpc = 0; //-1 } else if (normalized_rx_power<(target_rx_power-1)) { - tpc = 2; //+1 + tpc = 2; //+1 } else { - tpc = 1; //0 + tpc = 1; //0 } return tpc; } -int flexran_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) { //flag_id_status = 0 then id, else status +int flexran_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 *round) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ uint8_t harq_pid; - uint8_t round; + uint8_t harq_round; uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL); *id = harq_pid; - if (round > 0) { - *status = 1; - } else { - *status = 0; - } + *round = harq_round; + /* if (round > 0) { */ + /* *status = 1; */ + /* } else { */ + /* *status = 0; */ + /* } */ - return 0; + /* return 0; */ + return round; } int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { @@ -705,6 +734,24 @@ int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) { return pucch_rx_received; } +int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id) { + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + return eNB_UE_stats->Po_PUCCH_update; +} + +int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id) { + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + eNB_UE_stats->Po_PUCCH_update = 0; + + return 0; +} + /* * ************************************ @@ -861,6 +908,13 @@ int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) { return frame_parms->N_RB_UL; } +int flexran_get_N_RBG(mid_t mod_id, int CC_id) { + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RBG; +} + int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; @@ -891,10 +945,10 @@ int flexran_get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); - if(frame_parms->frame_type == 0) - return 1; - else if (frame_parms->frame_type == 1) - return 0; + if(frame_parms->frame_type == TDD) + return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; + else if (frame_parms->frame_type == FDD) + return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; return -1; } diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 2156d50a0d..caa2eeb900 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -193,6 +193,9 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Get the transmission queue size for a UE with a channel_id logical channel id */ int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +/* Update the timing advance status (find out whether a timing advance command is required) */ +int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id); + /* Return timing advance MAC control element for a designated cell and UE */ int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); @@ -245,6 +248,9 @@ int flexran_get_N_RB_DL(mid_t mod_id, int CC_id); /* Get number of UL resource blocks */ int flexran_get_N_RB_UL(mid_t mod_id, int CC_id); +/* Get number of resource block groups */ +int flexran_get_N_RBG(mid_t mod_id, int CC_id); + /* Get DL/UL subframe assignment. TDD only */ int flexran_get_subframe_assignment(mid_t mod_id, int CC_id); @@ -273,13 +279,18 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id); a designated frame and subframe. Returns 0 for success. The id and the status of the HARQ process are stored in id and status respectively */ int flexran_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); + const int frame, const uint8_t subframe, int *id, int *round); -/* Reported values for uplink power control */ +/* Uplink power control management*/ int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id); +int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id); + +int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id); + + /* * ************************************ * Get Messages for UE Configuration Reply diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index cf033959d3..73d82507a5 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -29,7 +29,7 @@ /*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel - * \author Xenofon Foukas + * \author Xenofon Foukas, Navid Nikaein and Raymond Knopp * \date 2016 * \email: x.foukas@sms.ed.ac.uk * \version 0.1 @@ -59,7 +59,6 @@ #include "ENB_APP/flexran_agent_defs.h" -//#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" #include "header.pb-c.h" @@ -74,6 +73,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG + //------------------------------------------------------------------------------ void flexran_schedule_ue_spec_default(mid_t mod_id, @@ -88,22 +88,20 @@ flexran_schedule_ue_spec_default(mid_t mod_id, int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; - unsigned char header_len = 0, header_len_tmp = 0; + unsigned char header_len = 0, header_len_tmp = 0, ta_len = 0; uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; unsigned char harq_pid = 0; void *DLSCH_dci = NULL; - LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint16_t sdu_length_total = 0; int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + /* TODO: Must move the helper structs to scheduler implementation */ UE_list_t *UE_list = &eNB->UE_list; - LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; int32_t normalized_rx_power, target_rx_power; - int32_t tpc=1; + int32_t tpc = 1; static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; @@ -139,14 +137,13 @@ flexran_schedule_ue_spec_default(mid_t mod_id, for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); // get number of PRBs less those used by common channels - total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL; - for (i=0;iN_RB_DL;i++) - if (eNB->common_channels[CC_id].vrb_map[i]!=0) + total_nb_available_rb[CC_id] = flexran_get_N_RB_DL(mod_id, CC_id); + for (i=0;i < flexran_get_N_RB_DL(mod_id, CC_id); i++) + if (eNB->common_channels[CC_id].vrb_map[i] != 0) total_nb_available_rb[CC_id]--; - N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; + N_RBG[CC_id] = flexran_get_N_RBG(mod_id, CC_id); // store the global enb stats: eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; @@ -159,7 +156,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN); start_meas(&eNB->schedule_dlsch_preprocessor); - dlsch_scheduler_pre_processor(mod_id, + _dlsch_scheduler_pre_processor(mod_id, frame, subframe, N_RBG, @@ -174,25 +171,23 @@ flexran_schedule_ue_spec_default(mid_t mod_id, continue; for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { - rnti = UE_RNTI(mod_id, UE_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + rnti = flexran_get_ue_crnti(mod_id, UE_id); ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; if (rnti==NOT_A_RNTI) { - LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); + LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n", UE_id,UE_list->num_UEs); // mac_xface->macphy_exit("Cannot find rnti for UE_id"); continue; } - if (eNB_UE_stats==NULL) { - LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); + if (flexran_get_ue_crnti(mod_id, UE_id) == NOT_A_RNTI) { + LOG_D(MAC,"[eNB] Cannot find UE\n"); // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); continue; } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated - CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti) - ) { + CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti)) { LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) @@ -201,14 +196,14 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // break; } - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { set_ue_dai (subframe, - frame_parms[CC_id]->tdd_config, + flexran_get_subframe_assignment(mod_id, CC_id), UE_id, CC_id, UE_list); - // update UL DAI after DLSCH scheduling - set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); + //TODO: update UL DAI after DLSCH scheduling + //set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } channels_added = 0; @@ -223,38 +218,29 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->serv_cell_index = CC_id; nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; - harq_pid = ue_sched_ctl->harq_pid[CC_id]; - round = ue_sched_ctl->round[CC_id]; - + flexran_get_harq(mod_id, CC_id, UE_id, frame, subframe, &harq_pid, &round); sdu_length_total=0; - - /* - DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), - eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); - */ - - mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - // mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); + mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)]; #ifdef EXMIMO if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti) == 5) { - mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)]; mcs = cmin(mcs,16); } #endif // initializing the rb allocation indicator for each UE - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; rballoc_sub[j] = 0; } - LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", - mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, - eNB_UE_stats->DL_cqi[0], mcs, - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + /* LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", */ + /* mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, */ + /* eNB_UE_stats->DL_cqi[0], mcs, */ + /* UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); */ dl_dci = (Protocol__FlexDlDci*) malloc(sizeof(Protocol__FlexDlDci)); protocol__flex_dl_dci__init(dl_dci); @@ -270,7 +256,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if (round > 0) { - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", @@ -282,25 +268,26 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // get freq_allocation nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + /*TODO: Must add this to FlexRAN agent API */ dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { + while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if((j == frame_parms[CC_id]->N_RBG-1) && - ((frame_parms[CC_id]->N_RB_DL == 25)|| - (frame_parms[CC_id]->N_RB_DL == 50))) { + if((j == flexran_get_N_RBG(mod_id, CC_id) - 1) && + ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)|| + (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; } else { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; @@ -316,7 +303,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j=0; jN_RBG; j++) { + for(j=0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } @@ -360,8 +347,6 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; - header_len_dcch = 2; // 2 bytes DCCH SDU subheader - // TODO : Need to prioritize DRBs // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) for (j = 1; j < NB_RB_MAX; j++) { @@ -467,20 +452,20 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; LOG_D(MAC, "[TEST]Will only partially fill the bitmap\n"); - while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { + while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if ((j == frame_parms[CC_id]->N_RBG-1) && - ((frame_parms[CC_id]->N_RB_DL == 25)|| - (frame_parms[CC_id]->N_RB_DL == 50))) { - nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + if ((j == flexran_get_N_RBG(mod_id, CC_id) - 1) && + ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)|| + (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1; } else { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } @@ -492,7 +477,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } @@ -518,7 +503,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); //#warning only for 5MHz channel @@ -527,9 +512,8 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // do PUCCH power control // this is the normalized RX power - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); - normalized_rx_power = eNB_UE_stats->Po_PUCCH_dBm; - target_rx_power = mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; + normalized_rx_power = flexran_get_p0_pucch_dbm(mod_id,UE_id, CC_id); //eNB_UE_stats->Po_PUCCH_dBm; + target_rx_power = flexran_get_p0_nominal_pucch(mod_id, CC_id) + 10; //mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out @@ -537,11 +521,11 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if (((framex10psubframe+10)<=(frame*10+subframe)) || //normal case ((framex10psubframe>(frame*10+subframe)) && (((10240-framex10psubframe+frame*10+subframe)>=10)))) //frame wrap-around - if (eNB_UE_stats->Po_PUCCH_update == 1) { - eNB_UE_stats->Po_PUCCH_update = 0; - - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frame; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframe; + if (flexran_get_p0_pucch_status(mod_id, UE_id, CC_id) == 1) { + flexran_update_p0_pucch(mod_id, UE_id, CC_id); + + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frame; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframe; if (normalized_rx_power>(target_rx_power+1)) { tpc = 0; //-1 tpc_accumulated--; @@ -614,7 +598,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_tbs_size = 1; dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -648,7 +632,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -682,7 +666,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -712,7 +696,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_tbs_size = 1; dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -749,7 +733,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -762,8 +746,10 @@ flexran_schedule_ue_spec_default(mid_t mod_id, } } - if (frame_parms[CC_id]->frame_type == TDD) { - set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { + + /* TODO */ + //set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } } // UE_id loop } // CC_id loop @@ -778,3 +764,636 @@ flexran_schedule_ue_spec_default(mid_t mod_id, stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } + +// This function stores the downlink buffer for all the logical channels +void _store_dlsch_buffer (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframeP) +{ + + int UE_id,i; + rnti_t rnti; + mac_rlc_status_resp_t rlc_status; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + UE_TEMPLATE *UE_template; + + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + + UE_template = &UE_list->UE_template[UE_PCCID(Mod_id,UE_id)][UE_id]; + + // clear logical channel interface variables + UE_template->dl_buffer_total = 0; + UE_template->dl_pdus_total = 0; + + for(i=0; i< MAX_NUM_LCID; i++) { + UE_template->dl_buffer_info[i]=0; + UE_template->dl_pdus_in_buffer[i]=0; + UE_template->dl_buffer_head_sdu_creation_time[i]=0; + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i]=0; + } + + rnti = UE_RNTI(Mod_id,UE_id); + + for(i=0; i< MAX_NUM_LCID; i++) { // loop over all the logical channels + + rlc_status = mac_rlc_status_ind(Mod_id,rnti, Mod_id,frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 ); + UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel + UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer; + UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ; + UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max, + rlc_status.head_sdu_creation_time ); + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send; + UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented; + UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer + UE_template->dl_pdus_total += UE_template->dl_pdus_in_buffer[i]; + +#ifdef DEBUG_eNB_SCHEDULER + + /* note for dl_buffer_head_sdu_remaining_size_to_send[i] : + * 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent + */ + if (UE_template->dl_buffer_info[i]>0) + LOG_D(MAC, + "[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n", + Mod_id, frameP, subframeP, UE_id, + i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i], + UE_template->dl_buffer_head_sdu_creation_time[i], + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i], + UE_template->dl_buffer_head_sdu_is_segmented[i] + ); + +#endif + + } + + //#ifdef DEBUG_eNB_SCHEDULER + if ( UE_template->dl_buffer_total>0) + LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n", + Mod_id, frameP, subframeP, UE_id, + UE_template->dl_buffer_total, + UE_template->dl_pdus_total + ); + + //#endif + } +} + + +// This function returns the estimated number of RBs required by each UE for downlink scheduling +void _assign_rbs_required (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframe, + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + int min_rb_unit[MAX_NUM_CCs]) +{ + + + rnti_t rnti; + uint16_t TBS = 0; + LTE_eNB_UE_stats *eNB_UE_stats[MAX_NUM_CCs]; + int UE_id,n,i,j,CC_id,pCCid,tmp; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + // UE_TEMPLATE *UE_template; + + // clear rb allocations across all CC_ids + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + pCCid = UE_PCCID(Mod_id,UE_id); + rnti = UE_list->UE_template[pCCid][UE_id].rnti; + + //update CQI information across component carriers + for (n=0; nnumactiveCCs[UE_id]; n++) { + CC_id = UE_list->ordered_CCids[n][UE_id]; + eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti); + eNB_UE_stats[CC_id]->dlsch_mcs1=cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)]; + } + + // provide the list of CCs sorted according to MCS + for (i=0; inumactiveCCs[UE_id]; i++) { + for (j=i+1; jnumactiveCCs[UE_id]; j++) { + DevAssert( j < MAX_NUM_CCs ); + + if (eNB_UE_stats[UE_list->ordered_CCids[i][UE_id]]->dlsch_mcs1 > + eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]]->dlsch_mcs1) { + tmp = UE_list->ordered_CCids[i][UE_id]; + UE_list->ordered_CCids[i][UE_id] = UE_list->ordered_CCids[j][UE_id]; + UE_list->ordered_CCids[j][UE_id] = tmp; + } + } + } + + /* NN --> RK + * check the index of UE_template" + */ + if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total> 0) { + LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id); + + for (i=0; inumactiveCCs[UE_id]; i++) { + CC_id = UE_list->ordered_CCids[i][UE_id]; + eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti); + + if (eNB_UE_stats[CC_id]->dlsch_mcs1==0) { + nb_rbs_required[CC_id][UE_id] = 4; // don't let the TBS get too small + } else { + nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id]; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]); + + LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n", + UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total, + nb_rbs_required[CC_id][UE_id],eNB_UE_stats[CC_id]->dlsch_mcs1,TBS); + + /* calculating required number of RBs for each UE */ + while (TBS < UE_list->UE_template[pCCid][UE_id].dl_buffer_total) { + nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id]; + + if (nb_rbs_required[CC_id][UE_id] > flexran_get_N_RB_DL(Mod_id, CC_id)) { + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1, flexran_get_N_RB_DL(Mod_id, CC_id)); + nb_rbs_required[CC_id][UE_id] = flexran_get_N_RB_DL(Mod_id, CC_id); + break; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]); + } // end of while + + LOG_D(MAC,"[eNB %d] Frame %d: UE %d on CC %d: RB unit %d, nb_required RB %d (TBS %d, mcs %d)\n", + Mod_id, frameP,UE_id, CC_id, min_rb_unit[CC_id], nb_rbs_required[CC_id][UE_id], TBS, eNB_UE_stats[CC_id]->dlsch_mcs1); + } + } + } +} + +// This function scans all CC_ids for a particular UE to find the maximum round index of its HARQ processes +int _maxround(module_id_t Mod_id,uint16_t rnti,int frame,sub_frame_t subframe,uint8_t ul_flag ) +{ + + uint8_t round,round_max=0,UE_id; + int CC_id; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + + for (CC_id=0; CC_idUE_sched_ctrl[UE_id].round[CC_id]; + if (round > round_max) { + round_max = round; + } + } + + return round_max; +} + +// This function scans all CC_ids for a particular UE to find the maximum DL CQI +int _maxcqi(module_id_t Mod_id,int32_t UE_id) +{ + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + int CC_id,n; + int CQI = 0; + + for (n=0; nnumactiveCCs[UE_id]; n++) { + CC_id = UE_list->ordered_CCids[n][UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,UE_RNTI(Mod_id,UE_id)); + + if (eNB_UE_stats==NULL) { + mac_xface->macphy_exit("maxcqi: could not get eNB_UE_stats\n"); + return 0; // not reached + } + + if (eNB_UE_stats->DL_cqi[0] > CQI) { + CQI = eNB_UE_stats->DL_cqi[0]; + } + } + + return(CQI); +} + + +// This fuction sorts the UE in order their dlsch buffer and CQI +void _sort_UEs (module_id_t Mod_idP, + int frameP, + sub_frame_t subframeP) +{ + + + int UE_id1,UE_id2; + int pCC_id1,pCC_id2; + int cqi1,cqi2,round1,round2; + int i=0,ii=0;//,j=0; + rnti_t rnti1,rnti2; + + UE_list_t *UE_list = &eNB_mac_inst[Mod_idP].UE_list; + + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + + for(ii=UE_list->next[i]; ii>=0; ii=UE_list->next[ii]) { + + UE_id1 = i; + rnti1 = UE_RNTI(Mod_idP,UE_id1); + if(rnti1 == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1) + continue; + pCC_id1 = UE_PCCID(Mod_idP,UE_id1); + cqi1 = _maxcqi(Mod_idP,UE_id1); // + round1 = _maxround(Mod_idP,rnti1,frameP,subframeP,0); + + UE_id2 = ii; + rnti2 = UE_RNTI(Mod_idP,UE_id2); + if(rnti2 == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1) + continue; + cqi2 = _maxcqi(Mod_idP,UE_id2); + round2 = _maxround(Mod_idP,rnti2,frameP,subframeP,0); //mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0); + pCC_id2 = UE_PCCID(Mod_idP,UE_id2); + + if(round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (round2 == round1) { + // RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service. + + // first check the buffer status for SRB1 and SRB2 + if ( (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) < + (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2]) ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max < + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total < + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (cqi1 < cqi2) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } + } + } + } +} + +// This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done +void _dlsch_scheduler_pre_processor (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframeP, + int N_RBG[MAX_NUM_CCs], + int *mbsfn_flag) +{ + + unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], harq_pid=0, total_ue_count; + unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]; + int UE_id, i; + unsigned char round = 0; + uint16_t ii,j; + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t average_rbs_per_user[MAX_NUM_CCs] = {0}; + rnti_t rnti; + int min_rb_unit[MAX_NUM_CCs]; + uint16_t r1=0; + uint8_t CC_id; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs] = {0}; + + int transmission_mode = 0; + UE_sched_ctrl *ue_sched_ctl; + + for (CC_id=0; CC_id0) // If this CC is allocated for MBSFN skip it here + continue; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); + + + min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id); + + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + // Initialize scheduling information for all active UEs + + + _dlsch_scheduler_pre_processor_reset(Mod_id, + UE_id, + CC_id, + frameP, + subframeP, + N_RBG[CC_id], + nb_rbs_required, + nb_rbs_required_remaining, + rballoc_sub, + MIMO_mode_indicator); + + } + } + + // Store the DLSCH buffer for each logical channel + _store_dlsch_buffer (Mod_id,frameP,subframeP); + + // Calculate the number of RBs required by each UE on the basis of logical channel's buffer + _assign_rbs_required (Mod_id,frameP,subframeP,nb_rbs_required,min_rb_unit); + + // Sorts the user on the basis of dlsch logical channel buffer and CQI + _sort_UEs (Mod_id,frameP,subframeP); + + total_ue_count = 0; + + // loop over all active UEs + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + rnti = flexran_get_ue_crnti(Mod_id, i); + if(rnti == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1) + continue; + UE_id = i; + + // if there is no available harq_process, skip the UE + if (UE_list->UE_sched_ctrl[UE_id].harq_pid[CC_id]<0) + continue; + + for (ii=0; ii < UE_num_active_CC(UE_list,UE_id); ii++) { + CC_id = UE_list->ordered_CCids[ii][UE_id]; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round); + + average_rbs_per_user[CC_id]=0; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); + + // mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0); + + if(round>0) { + nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + } + + //nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id]; + if (nb_rbs_required[CC_id][UE_id] > 0) { + total_ue_count = total_ue_count + 1; + } + + + // hypotetical assignement + /* + * If schedule is enabled and if the priority of the UEs is modified + * The average rbs per logical channel per user will depend on the level of + * priority. Concerning the hypothetical assignement, we should assign more + * rbs to prioritized users. Maybe, we can do a mapping between the + * average rbs per user and the level of priority or multiply the average rbs + * per user by a coefficient which represents the degree of priority. + */ + + if (total_ue_count == 0) { + average_rbs_per_user[CC_id] = 0; + } else if( (min_rb_unit[CC_id] * total_ue_count) <= (frame_parms[CC_id]->N_RB_DL) ) { + average_rbs_per_user[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/total_ue_count); + } else { + average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE + } + } + } + + // note: nb_rbs_required is assigned according to total_buffer_dl + // extend nb_rbs_required to capture per LCID RB required + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + rnti = UE_RNTI(Mod_id,i); + + for (ii=0; iiordered_CCids[ii][i]; + + // control channel + if (mac_eNB_get_rrc_status(Mod_id,rnti) < RRC_RECONFIGURED) { + nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i]; + } else { + nb_rbs_required_remaining_1[CC_id][i] = cmin(average_rbs_per_user[CC_id],nb_rbs_required[CC_id][i]); + + } + } + } + + //Allocation to UEs is done in 2 rounds, + // 1st stage: average number of RBs allocated to each UE + // 2nd stage: remaining RBs are allocated to high priority UEs + for(r1=0; r1<2; r1++) { + + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + for (ii=0; iiordered_CCids[ii][i]; + + if(r1 == 0) { + nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i]; + } else { // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round + nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i]; + } + + if (nb_rbs_required[CC_id][i]> 0 ) + LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d, pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n", + r1, CC_id, i, + nb_rbs_required_remaining[CC_id][i], + nb_rbs_required_remaining_1[CC_id][i], + nb_rbs_required[CC_id][i], + UE_list->UE_sched_ctrl[i].pre_nb_available_rbs[CC_id], + N_RBG[CC_id], + min_rb_unit[CC_id]); + + } + } + + if (total_ue_count > 0 ) { + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + + for (ii=0; iiordered_CCids[ii][UE_id]; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round); + rnti = UE_RNTI(Mod_id,UE_id); + + // LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti ); + if(rnti == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) + continue; + + transmission_mode = mac_xface->get_transmission_mode(Mod_id,CC_id,rnti); + //rrc_status = mac_eNB_get_rrc_status(Mod_id,rnti); + /* 1st allocate for the retx */ + + // retransmission in data channels + // control channel in the 1st transmission + // data channel for all TM + LOG_T(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n "); + _dlsch_scheduler_pre_processor_allocate (Mod_id, + UE_id, + CC_id, + N_RBG[CC_id], + transmission_mode, + min_rb_unit[CC_id], + frame_parms[CC_id]->N_RB_DL, + nb_rbs_required, + nb_rbs_required_remaining, + rballoc_sub, + MIMO_mode_indicator); + } + } + } // total_ue_count + } // end of for for r1 and r2 + + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + for (ii=0; iiordered_CCids[ii][UE_id]; + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id]; + + if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0 ) { + LOG_D(MAC,"******************DL Scheduling Information for UE%d ************************\n",UE_id); + LOG_D(MAC,"dl power offset UE%d = %d \n",UE_id,ue_sched_ctl->dl_pow_off[CC_id]); + LOG_D(MAC,"***********RB Alloc for every subband for UE%d ***********\n",UE_id); + + for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i]; + LOG_D(MAC,"RB Alloc for UE%d and Subband%d = %d\n",UE_id,j,ue_sched_ctl->rballoc_sub_UE[CC_id][j]); + } + + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id]; + LOG_D(MAC,"Total RBs allocated for UE%d = %d\n",UE_id,ue_sched_ctl->pre_nb_available_rbs[CC_id]); + } + } + } +} + +#define SF05_LIMIT 1 + +void _dlsch_scheduler_pre_processor_reset (int module_idP, + int UE_id, + uint8_t CC_id, + int frameP, + int subframeP, + int N_RBG, + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], + unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]) { + int i,j; + UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + rnti_t rnti = UE_RNTI(module_idP,UE_id); + uint8_t *vrb_map = eNB_mac_inst[module_idP].common_channels[CC_id].vrb_map; + int RBGsize = PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.N_RB_DL/N_RBG; +#ifdef SF05_LIMIT + //int subframe05_limit=0; + int sf05_upper=-1,sf05_lower=-1; +#endif + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti); + + flexran_update_TA(module_idP, UE_id, CC_id); + + if (UE_id==0) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update); + } + nb_rbs_required[CC_id][UE_id]=0; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0; + ue_sched_ctl->dl_pow_off[CC_id] = 2; + nb_rbs_required_remaining[CC_id][UE_id] = 0; + +#ifdef SF05_LIMIT + switch (N_RBG) { + case 6: + sf05_lower=0; + sf05_upper=5; + break; + case 8: + sf05_lower=2; + sf05_upper=5; + break; + case 13: + sf05_lower=4; + sf05_upper=7; + break; + case 17: + sf05_lower=7; + sf05_upper=9; + break; + case 25: + sf05_lower=11; + sf05_upper=13; + break; + } +#endif + // Initialize Subbands according to VRB map + for (i=0; irballoc_sub_UE[CC_id][i] = 0; + rballoc_sub[CC_id][i] = 0; +#ifdef SF05_LIMIT + // for avoiding 6+ PRBs around DC in subframe 0-5 (avoid excessive errors) + + if ((subframeP==0 || subframeP==5) && + (i>=sf05_lower && i<=sf05_upper)) + rballoc_sub[CC_id][i]=1; +#endif + // for SI-RNTI,RA-RNTI and P-RNTI allocations + for (j=0;jUE_sched_ctrl[UE_id]; + + for(i=0; irballoc_sub_UE[CC_id][i] == 0) && + (nb_rbs_required_remaining[CC_id][UE_id]>0) && + (ue_sched_ctl->pre_nb_available_rbs[CC_id] < nb_rbs_required[CC_id][UE_id])) { + + // if this UE is not scheduled for TM5 + if (ue_sched_ctl->dl_pow_off[CC_id] != 0 ) { + + if ((i == N_RBG-1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) { + rballoc_sub[CC_id][i] = 1; + ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1; + MIMO_mode_indicator[CC_id][i] = 1; + if (transmission_mode == 5 ) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit+1; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit - 1; + } else { + if (nb_rbs_required_remaining[CC_id][UE_id] >= min_rb_unit){ + rballoc_sub[CC_id][i] = 1; + ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1; + MIMO_mode_indicator[CC_id][i] = 1; + if (transmission_mode == 5 ) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit; + } + } + } // dl_pow_off[CC_id][UE_id] ! = 0 + } + } +} From cf59e0d891fa0d940f2a7f8ba71b5b56f8c793d9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 8 Nov 2016 14:40:34 +0200 Subject: [PATCH 149/182] Added notification messages for control delegation in dl_scheduler VSF --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 7bfed81b48..04a90250eb 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 @@ -771,12 +771,15 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); strcpy(target, local_cache); strcat(target, lib_name); - + + LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target); lib = dlopen(target, RTLD_NOW); if (lib == NULL) { + LOG_I(FLEXRAN_AGENT, "Could not load library\n"); goto error; } + 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]) { @@ -785,8 +788,10 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); } agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; - LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); + LOG_I(FLEXRAN_AGENT, "New DL UE scheduler: %s\n", function_name); } + } else { + LOG_I(FLEXRAN_AGENT, "Scheduler could not be loaded\n"); } return 0; From 2078a9e57cedac81b105afa2814fb401a3dfafb2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:09:02 +0200 Subject: [PATCH 150/182] Added macros for enabling FlexRAN agent operation --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++++ openair2/LAYER2/MAC/eNB_scheduler.c | 9 +++++++++ openair2/RRC/LITE/rrc_eNB.c | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d6f5a40da7..dbc90b34d9 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -62,10 +62,12 @@ #endif +#if defined(FLEXRAN_AGENT_SB_IF) //Agent-related headers #include "ENB_APP/flexran_agent_extern.h" #include "ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h" #include "LAYER2/MAC/flexran_agent_mac_proto.h" +#endif //#define DIAG_PHY @@ -1369,11 +1371,13 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, eNB->dlsch_ra->active = 0; } +#if defined(FLEXRAN_AGENT_SB_IF) #ifndef DISABLE_SF_TRIGGER //Send subframe trigger to the controller if (mac_agent_registered[eNB->Mod_id]) { agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id); } +#endif #endif // Now scan UE specific DLSCH diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 386efec596..c5dc8c88b0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -52,10 +52,12 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +#if defined(FLEXRAN_AGENT_SB_IF) //Agent-related headers #include "flexran_agent_extern.h" #include "flexran_agent_mac.h" #include "flexran_agent_mac_proto.h" +#endif #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -103,7 +105,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, void *DLSCH_dci=NULL; int size_bits=0,size_bytes=0; +#if defined(FLEXRAN_AGENT_SB_IF) Protocol__FlexranMessage *msg; +#endif LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); @@ -137,14 +141,17 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, eNB_mac_inst[module_idP].UE_list.UE_sched_ctrl[i].cqi_req_timer++; + if (mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti)==NULL) { //mac_remove_ue(module_idP, i, frameP, subframeP); //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future +#if defined(FLEXRAN_AGENT_SB_IF) if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } +#endif } else { // check uplink failure @@ -1081,11 +1088,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_idflexran_agent_send_update_mac_stats(module_idP); } +#endif #endif /* diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 3f8e7c5f83..2ce94ba26c 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -93,7 +93,9 @@ #include "SIMULATION/TOOLS/defs.h" // for taus +#if defined(FLEXRAN_AGENT_SB_IF) #include "flexran_agent_extern.h" +#endif #define XER_PRINT #ifdef PHY_EMUL @@ -4541,12 +4543,14 @@ rrc_eNB_decode_dcch( ue_context_p, ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); +#if defined(FLEXRAN_AGENT_SB_IF) //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]) { agent_mac_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_UPDATED); } +#endif } #if defined(ENABLE_ITTI) # if defined(ENABLE_USE_MME) @@ -4642,12 +4646,15 @@ rrc_eNB_decode_dcch( 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)); + +#if defined(FLEXRAN_AGENT_SB_IF) //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]) { agent_mac_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); } +#endif } } From bb5b90eab0029cc273720516943cce490eaac376 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:09:44 +0200 Subject: [PATCH 151/182] Added compilation options for enabling/disabling FlexRAN agent --- cmake_targets/CMakeLists.txt | 15 +++++++++++++-- cmake_targets/build_oai | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index da90efdaee..b5279de5e2 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -621,7 +621,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(FLEXRAN_AGENT_SB_IF True "enable FlexRAN agent to inteface with a SDN contrller") +add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN agent to inteface with a SDN controller") ######################## # Include order @@ -1185,10 +1185,17 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c + ) + +if (FLEXRAN_AGENT_SB_IF) + +set (MAC_SRC ${MAC_SRC} ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c ${MAC_DIR}/flexran_agent_scheduler_dataplane.c ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c - ) +) + +endif() set (ENB_APP_SRC ${OPENAIR2_DIR}/ENB_APP/enb_app.c @@ -1201,10 +1208,14 @@ add_library(L2 ${ENB_APP_SRC}) # ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) +if (FLEXRAN_AGENT_SB_IF) + #Test for adding a shared library add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c) add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c) +endif() + # L3 Libs ########################## diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b77a9baa56..25e9a1ccc8 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -35,6 +35,7 @@ source $THIS_SCRIPT_PATH/tools/build_helper MSC_GEN="False" XFORMS="True" +FLEXRAN_AGENT_SB_IF="True" PRINT_STATS="False" VCD_TIMING="False" DEADLINE_SCHEDULER_FLAG_USER="False" @@ -83,6 +84,8 @@ Options Makes the UE specific parts (ue_ip, usim, nvram) --RRH Makes the RRH +-a | --agent + Enables agent for software-defined control of the eNB -r | --3gpp-release default is Rel10, Rel8 limits the implementation to 3GPP Release 8 version @@ -169,6 +172,10 @@ function main() { eNB=1 echo_info "Will compile eNB" shift;; + -a | --agent) + FLEXRAN_AGENT=1 + echo_info "Will compile eNB with agent support" + shift;; --UE) UE=1 echo_info "Will compile UE" @@ -439,6 +446,9 @@ function main() { echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file @@ -581,6 +591,9 @@ function main() { echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file @@ -649,6 +662,9 @@ function main() { cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file From 985dcdc38cbb7f03ddf12ba801e996355564a8a8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:11:26 +0200 Subject: [PATCH 152/182] Removed deprecated configuration files for FlexRAN agent --- .../CONF/enb.band5.agent.usrpb210.conf | 180 ----------- .../enb.band5.agent.usrpb210.epc.remote.conf | 176 ---------- .../CONF/enb.band7.agent.oaisim.2.enb.conf | 302 ------------------ .../enb.band7.agent.oaisim.local_no_mme.conf | 154 --------- .../enb.band7.agent.usrpb210.epc.remote.conf | 174 ---------- 5 files changed, 986 deletions(-) delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf deleted file mode 100644 index caf54b5541..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf +++ /dev/null @@ -1,180 +0,0 @@ -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_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 5; - downlink_frequency = 879000000L; - uplink_frequency_offset = -45000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -29; - 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 = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -96; - 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; - } - ); - - 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 = "192.168.100.101"; - ipv6 = "192:168:100::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - - 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"; - 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/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf deleted file mode 100644 index e8bb16f2c8..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ /dev/null @@ -1,176 +0,0 @@ -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_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "10"; - - mobile_country_code = "208"; - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 5; - downlink_frequency = 879000000L; - uplink_frequency_offset = -45000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 115; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - 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 = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - 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; - - } - ); - - - 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 = "192.168.100.102"; - ipv6="192:168:30::17"; - active="yes"; - preference="ipv4";}); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - 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 ="debug"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_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/enb.band7.agent.oaisim.2.enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf deleted file mode 100644 index c792961a18..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf +++ /dev/null @@ -1,302 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox1", "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0x00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - 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 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - 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 = 2; - rach_preambleInitialReceivedTargetPower = -100; - 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; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.100.102"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - }, - - { - ////////// Identification parameters: - eNB_ID = 0x01; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox1"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 10; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - 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 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - 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 = 2; - rach_preambleInitialReceivedTargetPower = -100; - 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; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.100.102"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:2"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.104/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:2"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.104/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf deleted file mode 100644 index f95cfd9389..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ /dev/null @@ -1,154 +0,0 @@ -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_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - 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 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - 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 = 2; - rach_preambleInitialReceivedTargetPower = -100; - 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; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "0.0.0.0"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "none"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "none"; - ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf deleted file mode 100644 index 939832af45..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf +++ /dev/null @@ -1,174 +0,0 @@ -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_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "10"; - - mobile_country_code = "208"; - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2660000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - 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 = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - 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 = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - 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; - } - ); - - 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 = "192.168.100.102"; - ipv6="192:168:30::17"; - active="yes"; - preference="ipv4";}); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - 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 ="debug"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - - } -); From c0ad88e537b457685cbeefab0c8771a27ce8893b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Nov 2016 16:12:30 +0200 Subject: [PATCH 153/182] Fixed bug in the creation of MAC PDUs in the local flexran scheduler --- openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index 73d82507a5..bc0187cd56 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -353,7 +353,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, header_len+=3; // Need to see if we have space for data from this channel - if (dci_tbs - ta_len - header_len > 0) { + if (dci_tbs - ta_len - header_len - sdu_length_total > 0) { LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, @@ -396,7 +396,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->n_rlc_pdu++; channels_added++; //Set this to the max value that we might request - sdu_length_total = data_to_request; + sdu_length_total += data_to_request; } else { //Take back the assumption of a header for this channel header_len -= 3; From 7f1bef9b650aa99ac6780d7c226c6b68f700a1b3 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Fri, 25 Nov 2016 10:53:26 +0100 Subject: [PATCH 154/182] minor fix to Google Protobuf logging in installation --- cmake_targets/tools/build_helper | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 7cde2811c8..448d54f334 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -164,6 +164,9 @@ compilations() { ############################################ install_protobuf_from_source(){ + protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt + echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " + ( cd /tmp echo "Downloading protobuf" rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 @@ -174,11 +177,14 @@ install_protobuf_from_source(){ 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 + ) >& $protobuf_install_log } install_protobuf_c_from_source(){ + protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt + echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " + ( cd /tmp echo "Downloading protobuf-c" rm -rf /tmp/protobuf-c @@ -189,8 +195,8 @@ install_protobuf_c_from_source(){ echo "Compiling protobuf-c" make -j`nproc` $SUDO make install - rm -rf /tmp/protobuf-c $SUDO ldconfig + ) >& $protobuf_c_install_log } check_install_usrp_uhd_driver(){ @@ -396,6 +402,7 @@ remove_nettle_from_source() { cd nettle-2.5/ ./configure --disable-openssl --enable-shared --prefix=/usr $SUDO make uninstall || true + $SUDO ldconfig ) >& $nettle_uninstall_log } @@ -419,6 +426,7 @@ remove_gnutls_from_source(){ cd gnutls-3.1.23/ ./configure --prefix=/usr $SUDO make uninstall || true + $SUDO ldconfig )>& $gnutls_uninstall_log } @@ -433,6 +441,7 @@ install_asn1c_from_source(){ make -j`nproc` $SUDO make install cd - + $SUDO ldconfig ) > $asn1_install_log 2>&1 } From 426e6cd74bd4de38095cc26ebeed42fbebbdab68 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Fri, 25 Nov 2016 16:55:35 +0100 Subject: [PATCH 155/182] bugfix for TDD: special subframe was not transmitted. --- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c | 5 ++--- targets/RT/USER/lte-softmodem.c | 14 +++++--------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 6d0bc53ac8..c868a1a733 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1119,7 +1119,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, #endif - if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_DL)) return; + if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); if (do_meas==1) start_meas(&eNB->phy_proc_tx); diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index f25c09acb1..75aa4d2622 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -876,11 +876,8 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) if (openair0_cfg[card].rx_freq[ant]>0) { p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter); - p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant]; - printf("openair0 : programming card %d RX antenna %d (freq %u, gain %d)\n",card,ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]); - switch (openair0_cfg[card].rxg_mode[ant]) { default: case max_gain: @@ -916,6 +913,8 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) } break; } + printf("openair0 : programming card %d RX antenna %d (freq %u, gain %d)\n",card,ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]); + } else { p_exmimo_config->rf.rf_mode[ant] = 0; p_exmimo_config->rf.do_autocal[ant] = 0; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index de5be6913c..6272fdb4eb 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1339,12 +1339,6 @@ void init_openair0() { else openair0_cfg[card].rx_freq[i]=0.0; - printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", - card,i, openair0_cfg[card].tx_gain[i], - openair0_cfg[card].rx_gain[i], - openair0_cfg[card].tx_freq[i], - openair0_cfg[card].rx_freq[i]); - openair0_cfg[card].autocal[i] = 1; openair0_cfg[card].tx_gain[i] = tx_gain[0][i]; if (UE_flag == 0) { @@ -1354,10 +1348,12 @@ void init_openair0() { openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off; } - + printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", + card,i, openair0_cfg[card].tx_gain[i], + openair0_cfg[card].rx_gain[i], + openair0_cfg[card].tx_freq[i], + openair0_cfg[card].rx_freq[i]); } - - } } From 956135f9a3cbc63c3a3830bad877fe1aabad7537 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 25 Nov 2016 17:14:40 +0100 Subject: [PATCH 156/182] T: add mechanisms to free filters --- common/utils/T/tracer/filter/filter.c | 31 ++++++++++++++++++++++++++- common/utils/T/tracer/filter/filter.h | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/common/utils/T/tracer/filter/filter.c b/common/utils/T/tracer/filter/filter.c index b09b01259d..d26dc25000 100644 --- a/common/utils/T/tracer/filter/filter.c +++ b/common/utils/T/tracer/filter/filter.c @@ -13,6 +13,7 @@ struct filter { } v; int (*eval)(struct filter *this, event e); + void (*free)(struct filter *this); }; /****************************************************************************/ @@ -52,7 +53,23 @@ int eval_evarg(struct filter *f, event e) } /****************************************************************************/ -/* filter construction functions */ +/* free memory functions */ +/****************************************************************************/ + +void free_op2(struct filter *f) +{ + free_filter(f->v.op2.a); + free_filter(f->v.op2.b); + free(f); +} + +void free_noop(struct filter *f) +{ + free(f); +} + +/****************************************************************************/ +/* filter construction/destruction functions */ /****************************************************************************/ filter *filter_and(filter *a, filter *b) @@ -60,6 +77,7 @@ filter *filter_and(filter *a, filter *b) struct filter *ret = calloc(1, sizeof(struct filter)); if (ret == NULL) abort(); ret->eval = eval_and; + ret->free = free_op2; ret->v.op2.a = a; ret->v.op2.b = b; return ret; @@ -70,6 +88,7 @@ filter *filter_eq(filter *a, filter *b) struct filter *ret = calloc(1, sizeof(struct filter)); if (ret == NULL) abort(); ret->eval = eval_eq; + ret->free = free_op2; ret->v.op2.a = a; ret->v.op2.b = b; return ret; @@ -80,6 +99,7 @@ filter *filter_int(int v) struct filter *ret = calloc(1, sizeof(struct filter)); if (ret == NULL) abort(); ret->eval = eval_int; + ret->free = free_noop; ret->v.v = v; return ret; } @@ -97,6 +117,7 @@ filter *filter_evarg(void *database, char *event_name, char *varname) f = get_format(database, event_id); ret->eval = eval_evarg; + ret->free = free_noop; ret->v.evarg.event_type = event_id; ret->v.evarg.arg_index = -1; @@ -114,6 +135,14 @@ filter *filter_evarg(void *database, char *event_name, char *varname) return ret; } +void free_filter(filter *_f) +{ + struct filter *f; + if (_f == NULL) return; + f = _f; + f->free(f); +} + /****************************************************************************/ /* eval function */ /****************************************************************************/ diff --git a/common/utils/T/tracer/filter/filter.h b/common/utils/T/tracer/filter/filter.h index eba02d7fb7..d45e0bdd86 100644 --- a/common/utils/T/tracer/filter/filter.h +++ b/common/utils/T/tracer/filter/filter.h @@ -12,4 +12,6 @@ filter *filter_evarg(void *database, char *event_name, char *varname); int filter_eval(filter *f, event e); +void free_filter(filter *f); + #endif /* _FILTER_H_ */ From 0bb875d9c2b98c01484653335c2cca9d59726a16 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 25 Nov 2016 17:15:25 +0100 Subject: [PATCH 157/182] T: free previous filter in logger_set_filter --- common/utils/T/tracer/logger/logger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/utils/T/tracer/logger/logger.c b/common/utils/T/tracer/logger/logger.c index ab6fb8bc62..ffba2d25c0 100644 --- a/common/utils/T/tracer/logger/logger.c +++ b/common/utils/T/tracer/logger/logger.c @@ -1,5 +1,6 @@ #include "logger.h" #include "logger_defs.h" +#include "filter/filter.h" #include void logger_add_view(logger *_l, view *v) @@ -13,5 +14,6 @@ void logger_add_view(logger *_l, view *v) void logger_set_filter(logger *_l, void *filter) { struct logger *l = _l; + free_filter(l->filter); l->filter = filter; } From 8eeebdaf982dce42cbf27e27576aab5a9a6d5eb2 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 25 Nov 2016 17:17:16 +0100 Subject: [PATCH 158/182] T: add function label_set_text --- common/utils/T/tracer/gui/gui.h | 1 + common/utils/T/tracer/gui/gui_defs.h | 2 +- common/utils/T/tracer/gui/label.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/common/utils/T/tracer/gui/gui.h b/common/utils/T/tracer/gui/gui.h index 27e6603042..0eebae91ba 100644 --- a/common/utils/T/tracer/gui/gui.h +++ b/common/utils/T/tracer/gui/gui.h @@ -39,6 +39,7 @@ widget *new_space(gui *gui, int width, int height); widget *new_image(gui *gui, unsigned char *data, int length); void label_set_clickable(gui *gui, widget *label, int clickable); +void label_set_text(gui *gui, widget *label, char *text); void container_set_child_growable(gui *_gui, widget *_this, widget *child, int growable); diff --git a/common/utils/T/tracer/gui/gui_defs.h b/common/utils/T/tracer/gui/gui_defs.h index ec72bb0e2b..938641178c 100644 --- a/common/utils/T/tracer/gui/gui_defs.h +++ b/common/utils/T/tracer/gui/gui_defs.h @@ -141,7 +141,7 @@ struct button_widget { struct label_widget { struct widget common; - const char *t; + char *t; int color; int width; /* as given by the graphic's backend */ int height; /* as given by the graphic's backend */ diff --git a/common/utils/T/tracer/gui/label.c b/common/utils/T/tracer/gui/label.c index f649fa5201..02efabfaf3 100644 --- a/common/utils/T/tracer/gui/label.c +++ b/common/utils/T/tracer/gui/label.c @@ -81,3 +81,21 @@ void label_set_clickable(gui *_g, widget *_this, int clickable) gunlock(g); } + +void label_set_text(gui *_g, widget *_this, char *text) +{ + struct gui *g = _g; + struct label_widget *this = _this; + + glock(g); + + free(this->t); + this->t = strdup(text); if (this->t == NULL) OOM; + + x_text_get_dimensions(g->x, DEFAULT_FONT, text, + &this->width, &this->height, &this->baseline); + + send_event(g, REPACK, this->common.id); + + gunlock(g); +} From 484cad24311b324d1dffe2c883e84b47638ac21b Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 25 Nov 2016 17:17:39 +0100 Subject: [PATCH 159/182] T: add function xy_plot_set_title --- common/utils/T/tracer/gui/gui.h | 1 + common/utils/T/tracer/gui/xy_plot.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/common/utils/T/tracer/gui/gui.h b/common/utils/T/tracer/gui/gui.h index 0eebae91ba..c61c2dc6c0 100644 --- a/common/utils/T/tracer/gui/gui.h +++ b/common/utils/T/tracer/gui/gui.h @@ -50,6 +50,7 @@ void xy_plot_set_range(gui *gui, widget *this, void xy_plot_set_points(gui *gui, widget *this, int plot, int npoints, float *x, float *y); void xy_plot_get_dimensions(gui *gui, widget *this, int *width, int *height); +void xy_plot_set_title(gui *gui, widget *this, char *label); void textlist_add(gui *gui, widget *this, const char *text, int position, int color); diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c index 7d20a027a1..9342a5a464 100644 --- a/common/utils/T/tracer/gui/xy_plot.c +++ b/common/utils/T/tracer/gui/xy_plot.c @@ -290,3 +290,22 @@ void xy_plot_get_dimensions(gui *_gui, widget *_this, int *width, int *height) gunlock(g); } + +void xy_plot_set_title(gui *_gui, widget *_this, char *label) +{ + struct gui *g = _gui; + struct xy_plot_widget *this = _this; + + glock(g); + + free(this->label); + this->label = strdup(label); if (this->label == NULL) OOM; + /* TODO: be sure calling X there is valid wrt "global model" (we are + * not in the "gui thread") */ + x_text_get_dimensions(g->x, DEFAULT_FONT, label, + &this->label_width, &this->label_height, &this->label_baseline); + + send_event(g, REPACK, this->common.id); + + gunlock(g); +} From ee934102b6c98acfe4fd2cdf3fa29c1f1bdbd9c8 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 25 Nov 2016 17:19:33 +0100 Subject: [PATCH 160/182] T: switch UE in enb tracer Just below the logo you see the current UE, eg. [UE 0], and near that you have two "buttons" [prev UE] and [next UE]. You click with left button of mouse on those and the various plots that depend on the UE are now done for the new UE (say UE 1 instead of UE 0 if you click on [next UE]). The plots are not cleared when you switch. Let's say it's a feature. --- common/utils/T/tracer/enb.c | 214 +++++++++++++++++++++++++++--------- 1 file changed, 160 insertions(+), 54 deletions(-) diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index f041f21871..5d785782ea 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -24,6 +24,26 @@ typedef struct { view *pdcpview; view *rrcview; view *legacy; + widget *current_ue_label; + widget *prev_ue_button; + widget *next_ue_button; + widget *pusch_iq_ue_xy_plot; + widget *ul_estimate_ue_xy_plot; + widget *pucch1_energy_ue_xy_plot; + widget *pucch_iq_ue_xy_plot; + widget *dl_ul_harq_ue_label; + logger *pusch_iq_ue_logger; + logger *ul_estimate_ue_logger; + logger *pucch1_energy_ue_threshold_logger; + logger *pucch1_energy_ue_energy_logger; + logger *pucch_iq_ue_logger; + logger *dl_dci_logger[8]; + logger *dl_ack_logger[8]; + logger *dl_nack_logger[8]; + logger *ul_dci_logger[8]; + logger *ul_dci_retransmission_logger[8]; + logger *ul_ack_logger[8]; + logger *ul_nack_logger[8]; } enb_gui; typedef struct { @@ -31,6 +51,9 @@ typedef struct { int *is_on; int nevents; pthread_mutex_t lock; + enb_gui *e; + int ue; /* what UE is displayed in the UE specific views */ + void *database; } enb_data; void is_on_changed(void *_d) @@ -86,18 +109,93 @@ static void *gui_thread(void *_g) return NULL; } -static filter *ticktime_filter(void *database, char *event, int i) +static filter *ticktime_filter(void *database, char *event, int i, int ue) { /* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */ return filter_and( filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)), filter_and( - filter_eq(filter_evarg(database, event, "UE_id"), filter_int(0)), + filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)), filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0)))); } -static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) +static void set_current_ue(gui *g, enb_data *e, int ue) +{ + int i; + char s[256]; + + sprintf(s, "[UE %d] ", ue); + label_set_text(g, e->e->current_ue_label, s); + sprintf(s, "PUSCH IQ [UE %d]", ue); + xy_plot_set_title(g, e->e->pusch_iq_ue_xy_plot, s); + sprintf(s, "UL estimated channel [UE %d]", ue); + xy_plot_set_title(g, e->e->ul_estimate_ue_xy_plot, s); + sprintf(s, "PUCCH1 energy (SR) [UE %d]", ue); + xy_plot_set_title(g, e->e->pucch1_energy_ue_xy_plot, s); + sprintf(s, "PUCCH IQ [UE %d]", ue); + xy_plot_set_title(g, e->e->pucch_iq_ue_xy_plot, s); + sprintf(s, "DL/UL HARQ (x8) [UE %d]", ue); + label_set_text(g, e->e->dl_ul_harq_ue_label, s); + + logger_set_filter(e->e->pusch_iq_ue_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_PUSCH_IQ", "UE_ID"), + filter_int(ue))); + logger_set_filter(e->e->ul_estimate_ue_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_UL_CHANNEL_ESTIMATE", "UE_ID"), + filter_int(ue))); + logger_set_filter(e->e->pucch1_energy_ue_threshold_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"), + filter_int(ue))); + logger_set_filter(e->e->pucch1_energy_ue_energy_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"), + filter_int(ue))); + logger_set_filter(e->e->pucch_iq_ue_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_PUCCH_1AB_IQ", "UE_ID"), + filter_int(ue))); + for (i = 0; i < 8; i++) { + logger_set_filter(e->e->dl_dci_logger[i], + ticktime_filter(e->database, "ENB_PHY_DLSCH_UE_DCI", i, ue)); + logger_set_filter(e->e->dl_ack_logger[i], + ticktime_filter(e->database, "ENB_PHY_DLSCH_UE_ACK", i, ue)); + logger_set_filter(e->e->dl_nack_logger[i], + ticktime_filter(e->database, "ENB_PHY_DLSCH_UE_NACK", i, ue)); + logger_set_filter(e->e->ul_dci_logger[i], + ticktime_filter(e->database, "ENB_PHY_ULSCH_UE_DCI", i, ue)); + logger_set_filter(e->e->ul_dci_retransmission_logger[i], + ticktime_filter(e->database, + "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i, ue)); + logger_set_filter(e->e->ul_ack_logger[i], + ticktime_filter(e->database, "ENB_PHY_ULSCH_UE_ACK", i, ue)); + logger_set_filter(e->e->ul_nack_logger[i], + ticktime_filter(e->database, "ENB_PHY_ULSCH_UE_NACK", i, ue)); + } +} + +static void click(void *private, gui *g, + char *notification, widget *w, void *notification_data) +{ + int *d = notification_data; + int button = d[0]; + enb_data *ed = private; + enb_gui *e = ed->e; + int ue = ed->ue; + + if (button != 1) return; + if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; } + if (w == e->next_ue_button) ue++; + + if (ue != ed->ue) set_current_ue(g, ed, ue); + ed->ue = ue; +} + +static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database, + enb_data *ed) { widget *main_window; widget *top_container; @@ -113,7 +211,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) widget *text; view *textview; int i; - widget *w; + widget *w, *w2; view *v; logger *l; @@ -124,7 +222,26 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) line = new_container(g, HORIZONTAL); widget_add_child(g, top_container, line, -1); logo = new_image(g, openair_logo_png, openair_logo_png_len); - widget_add_child(g, line, logo, -1); + + /* logo + prev/next UE buttons */ + col = new_container(g, VERTICAL); + widget_add_child(g, col, logo, -1); + w = new_container(g, HORIZONTAL); + widget_add_child(g, col, w, -1); + w2 = new_label(g, ""); + widget_add_child(g, w, w2, -1); + e->current_ue_label = w2; + /* TODO: use button widget, not label widget */ + w2 = new_label(g, " [prev UE] "); + widget_add_child(g, w, w2, -1); + label_set_clickable(g, w2, 1); + e->prev_ue_button = w2; + w2 = new_label(g, " [next UE] "); + widget_add_child(g, w, w2, -1); + label_set_clickable(g, w2, 1); + e->next_ue_button = w2; + widget_add_child(g, line, col, -1); + input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20); widget_add_child(g, line, input_signal_plot, -1); xy_plot_set_range(g, input_signal_plot, 0, 7680*10, 20, 70); @@ -138,21 +255,20 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) g, input_signal_plot, new_color(g, "#0c0c72"), XY_LOOP_MODE); logger_add_view(input_signal_log, input_signal_view); - /* UE 0 PUSCH IQ data */ - w = new_xy_plot(g, 55, 55, "PUSCH IQ [UE 0]", 50); + /* UE x PUSCH IQ data */ + w = new_xy_plot(g, 55, 55, "", 50); + e->pusch_iq_ue_xy_plot = w; widget_add_child(g, line, w, -1); xy_plot_set_range(g, w, -1000, 1000, -1000, 1000); l = new_iqlog(h, database, "ENB_PHY_PUSCH_IQ", "nb_rb", "N_RB_UL", "symbols_per_tti", "pusch_comp"); v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE); logger_add_view(l, v); - logger_set_filter(l, - filter_eq( - filter_evarg(database, "ENB_PHY_PUSCH_IQ", "UE_ID"), - filter_int(0))); + e->pusch_iq_ue_logger = l; - /* UE 0 estimated UL channel */ - w = new_xy_plot(g, 280, 55, "UL estimated channel [UE 0]", 50); + /* UE x estimated UL channel */ + w = new_xy_plot(g, 280, 55, "", 50); + e->ul_estimate_ue_xy_plot = w; widget_add_child(g, line, w, -1); xy_plot_set_range(g, w, 0, 512*10, -10, 80); l = new_framelog(h, database, @@ -161,43 +277,33 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) framelog_set_update_only_at_sf9(l, 0); v = new_view_xy(512*10, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE); logger_add_view(l, v); - logger_set_filter(l, - filter_eq( - filter_evarg(database, "ENB_PHY_UL_CHANNEL_ESTIMATE", "UE_ID"), - filter_int(0))); + e->ul_estimate_ue_logger = l; - /* UE 0 PUCCH energy */ - w = new_xy_plot(g, 128, 55, "PUCCH1 energy (SR) [UE 0]", 50); + /* UE x PUCCH energy */ + w = new_xy_plot(g, 128, 55, "", 50); + e->pucch1_energy_ue_xy_plot = w; widget_add_child(g, line, w, -1); xy_plot_set_range(g, w, 0, 1024*10, -10, 80); l = new_ttilog(h, database, "ENB_PHY_PUCCH_1_ENERGY", "frame", "subframe", "threshold", 0); v = new_view_tti(10, g, w, new_color(g, "#ff0000")); logger_add_view(l, v); - logger_set_filter(l, - filter_eq( - filter_evarg(database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"), - filter_int(0))); + e->pucch1_energy_ue_threshold_logger = l; l = new_ttilog(h, database, "ENB_PHY_PUCCH_1_ENERGY", "frame", "subframe", "energy", 1); v = new_view_tti(10, g, w, new_color(g, "#0c0c72")); logger_add_view(l, v); - logger_set_filter(l, - filter_eq( - filter_evarg(database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"), - filter_int(0))); + e->pucch1_energy_ue_energy_logger = l; - /* UE 0 PUCCH IQ data */ - w = new_xy_plot(g, 55, 55, "PUCCH IQ [UE 0]", 50); + /* UE x PUCCH IQ data */ + w = new_xy_plot(g, 55, 55, "", 50); + e->pucch_iq_ue_xy_plot = w; widget_add_child(g, line, w, -1); - xy_plot_set_range(g, w, -100, 100, -100, 100); + xy_plot_set_range(g, w, -2000, 2000, -2000, 2000); l = new_iqdotlog(h, database, "ENB_PHY_PUCCH_1AB_IQ", "I", "Q"); v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE); logger_add_view(l, v); - logger_set_filter(l, - filter_eq( - filter_evarg(database, "ENB_PHY_PUCCH_1AB_IQ", "UE_ID"), - filter_int(0))); + e->pucch_iq_ue_logger = l; /* downlink/uplink UE DCIs */ widget_add_child(g, top_container, @@ -250,8 +356,8 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) logger_add_view(timelog, subview); /* harq processes' ticktime view */ - widget_add_child(g, top_container, - new_label(g,"DL/UL HARQ (x8) [UE 0]"), -1); + e->dl_ul_harq_ue_label = new_label(g, ""); + widget_add_child(g, top_container, e->dl_ul_harq_ue_label, -1); line = new_container(g, HORIZONTAL); widget_add_child(g, top_container, line, -1); timeline_plot = new_timeline(g, 512, 2*8+2, 3); @@ -271,15 +377,14 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) /* tick on UL view */ subview = new_subview_ticktime(timeview, 9, new_color(g,"#bbb"), 3600*1000); logger_add_view(timelog, subview); - /* DL harq pids */ + /* DL DCI */ for (i = 0; i < 8; i++) { timelog = new_ticklog(h, database, "ENB_PHY_DLSCH_UE_DCI", "frame", "subframe"); subview = new_subview_ticktime(timeview, i+1, new_color(g,"#55f"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_DLSCH_UE_DCI", i)); + e->dl_dci_logger[i] = timelog; } /* DL ACK */ for (i = 0; i < 8; i++) { @@ -288,8 +393,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) subview = new_subview_ticktime(timeview, i+1, new_color(g,"#282"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_DLSCH_UE_ACK", i)); + e->dl_ack_logger[i] = timelog; } /* DL NACK */ for (i = 0; i < 8; i++) { @@ -298,10 +402,9 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) subview = new_subview_ticktime(timeview, i+1, new_color(g,"#f22"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_DLSCH_UE_NACK", i)); + e->dl_nack_logger[i] = timelog; } - /* UL harq pids */ + /* UL DCI/retransmission without DCI */ for (i = 0; i < 8; i++) { /* first transmission */ timelog = new_ticklog(h, database, "ENB_PHY_ULSCH_UE_DCI", @@ -309,17 +412,14 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) subview = new_subview_ticktime(timeview, i+9+1, new_color(g,"#55f"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_ULSCH_UE_DCI", i)); + e->ul_dci_logger[i] = timelog; /* retransmission */ timelog = new_ticklog(h, database, "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", "frame", "subframe"); subview = new_subview_ticktime(timeview, i+9+1, new_color(g,"#99f"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, - "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i)); + e->ul_dci_retransmission_logger[i] = timelog; } /* UL ACK */ for (i = 0; i < 8; i++) { @@ -328,8 +428,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) subview = new_subview_ticktime(timeview, i+9+1, new_color(g,"#282"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_ULSCH_UE_ACK", i)); + e->ul_ack_logger[i] = timelog; } /* UL NACK */ for (i = 0; i < 8; i++) { @@ -338,8 +437,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) subview = new_subview_ticktime(timeview, i+9+1, new_color(g,"#f22"), 3600*1000); logger_add_view(timelog, subview); - logger_set_filter(timelog, - ticktime_filter(database, "ENB_PHY_ULSCH_UE_NACK", i)); + e->ul_nack_logger[i] = timelog; } /* phy/mac/rlc/pdcp/rrc textlog */ @@ -416,6 +514,10 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database) widget_add_child(g, top_container, text, -1); container_set_child_growable(g, top_container, text, 1); e->legacy = new_view_textlist(10000, 10, g, text); + + set_current_ue(g, ed, 0); + register_notifier(g, "click", e->prev_ue_button, click, ed); + register_notifier(g, "click", e->next_ue_button, click, ed); } void view_add_log(view *v, char *log, event_handler *h, void *database, @@ -495,7 +597,11 @@ int main(int n, char **v) g = gui_init(); new_thread(gui_thread, g); - enb_main_gui(&eg, g, h, database); + enb_data.ue = 0; + enb_data.e = ⪚ + enb_data.database = database; + + enb_main_gui(&eg, g, h, database, &enb_data); for (i = 0; i < number_of_events; i++) { logger *textlog; From 860394244b13260f70417c673b3eaae545113af7 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 28 Nov 2016 18:28:10 +0100 Subject: [PATCH 161/182] T: bugfix: lock required When the user clicks on "next UE" or "prev UE" we change the filters of loggers. At the same time, the main thread of enb.c processes events received from the soft-modem and uses the filters, some of them maybe in the process of being changed. Changing the filters is not atomic and has to be protected. --- common/utils/T/tracer/enb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index 5d785782ea..07768763a5 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -190,8 +190,12 @@ static void click(void *private, gui *g, if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; } if (w == e->next_ue_button) ue++; - if (ue != ed->ue) set_current_ue(g, ed, ue); - ed->ue = ue; + if (pthread_mutex_lock(&ed->lock)) abort(); + if (ue != ed->ue) { + set_current_ue(g, ed, ue); + ed->ue = ue; + } + if (pthread_mutex_unlock(&ed->lock)) abort(); } static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database, @@ -745,7 +749,9 @@ restart: event e; e = get_event(enb_data.socket, v, database); if (e.type == -1) goto restart; + if (pthread_mutex_lock(&enb_data.lock)) abort(); handle_event(h, e); + if (pthread_mutex_unlock(&enb_data.lock)) abort(); } return 0; From 31541601ce3efcfe37fb50c72140e5492e64dcd8 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Tue, 29 Nov 2016 17:19:14 +0100 Subject: [PATCH 162/182] fixes for tdd (N_TA_offset was not initialized) + some other code cleanup tested with both EXMIMO and USRP. performance better than in master branch. --- targets/RT/USER/lte-enb.c | 51 +++++++++++++++++++-------------- targets/RT/USER/lte-softmodem.c | 26 +++++++++++++++-- targets/RT/USER/lte-ue.c | 24 ++++++++-------- 3 files changed, 65 insertions(+), 36 deletions(-) diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 8f636d20d6..bdc281c8ea 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -134,8 +134,8 @@ time_stats_t softmodem_stats_mt; // main thread time_stats_t softmodem_stats_hw; // hw acquisition time_stats_t softmodem_stats_rxtx_sf; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time -int32_t **rxdata; -int32_t **txdata; +//int32_t **rxdata; +//int32_t **txdata; uint8_t seqno; //sequence number @@ -302,12 +302,13 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) { 6, phy_vars_eNB->frame_parms.nb_prefix_samples, CYCLIC_PREFIX); - PHY_ofdm_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], - dummy_tx_b+(phy_vars_eNB->frame_parms.samples_per_tti>>1), - phy_vars_eNB->frame_parms.ofdm_symbol_size, - 6, - phy_vars_eNB->frame_parms.nb_prefix_samples, - CYCLIC_PREFIX); + if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_DL) + PHY_ofdm_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], + dummy_tx_b+(phy_vars_eNB->frame_parms.samples_per_tti>>1), + phy_vars_eNB->frame_parms.ofdm_symbol_size, + 6, + phy_vars_eNB->frame_parms.nb_prefix_samples, + CYCLIC_PREFIX); } else { normal_prefix_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F], dummy_tx_b, @@ -385,7 +386,7 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) { // turn on tx switch N_TA_offset before //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,phy_vars_eNB->N_TA_offset,slot_offset); for (i=0; iN_TA_offset; i++) { - tx_offset = (int)slot_offset+time_offset[aa]+i-phy_vars_eNB->N_TA_offset/2; + tx_offset = (int)slot_offset+time_offset[aa]+i-phy_vars_eNB->N_TA_offset; if (tx_offset<0) tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; @@ -468,8 +469,16 @@ void proc_tx_full(PHY_VARS_eNB *eNB, // if TX fronthaul go ahead if (eNB->tx_fh) eNB->tx_fh(eNB,proc); - - + /* + if (proc->frame_tx>1000) { + write_output("/tmp/txsig0.m","txs0", &eNB->common_vars.txdata[eNB->Mod_id][0][0], eNB->frame_parms.samples_per_tti*10,1,1); + write_output("/tmp/txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB->Mod_id][0][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + write_output("/tmp/txsig1.m","txs1", &eNB->common_vars.txdata[eNB->Mod_id][1][0], eNB->frame_parms.samples_per_tti*10,1,1); + write_output("/tmp/txsigF1.m","txsF1", &eNB->common_vars.txdataF[eNB->Mod_id][1][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + //if (transmission_mode == 7) write_output("/tmp/txsigF5.m","txsF5", &eNB->common_vars.txdataF[eNB->Mod_id][5][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + exit_fun(""); + } + */ } void proc_tx_rru_if4p5(PHY_VARS_eNB *eNB, @@ -539,7 +548,8 @@ int wait_CCs(eNB_rxtx_proc_t *proc) { static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) { start_meas(&softmodem_stats_rxtx_sf); - // **************************************** + +// **************************************** // Common RX procedures subframe n phy_procedures_eNB_common_RX(eNB); @@ -1477,7 +1487,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c int i, CC_id; int j; - uint16_t N_TA_offset = 0; + //uint16_t N_TA_offset = 0; LTE_DL_FRAME_PARMS *frame_parms; @@ -1490,6 +1500,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c return(-1); } + /* if (frame_parms->frame_type == TDD) { if (frame_parms->N_RB_DL == 100) N_TA_offset = 624; @@ -1498,7 +1509,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c else if (frame_parms->N_RB_DL == 25) N_TA_offset = 624/4; } - + */ if (openair0_cfg[CC_id].mmapped_dma == 1) { @@ -1508,11 +1519,8 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c printf("Mapping eNB CC_id %d, rx_ant %d\n",CC_id,i); free(phy_vars_eNB[CC_id]->common_vars.rxdata[0][i]); phy_vars_eNB[CC_id]->common_vars.rxdata[0][i] = openair0_cfg[CC_id].rxbase[i]; - - - + printf("rxdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->common_vars.rxdata[0][i]); - for (j=0; j<16; j++) { printf("rxbuffer %d: %x\n",j,phy_vars_eNB[CC_id]->common_vars.rxdata[0][i][j]); phy_vars_eNB[CC_id]->common_vars.rxdata[0][i][j] = 16-j; @@ -1533,15 +1541,15 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c } } else { // not memory-mapped DMA - - + //nothing to do, everything already allocated in lte_init + /* rxdata = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*)); txdata = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (i=0; inb_antennas_rx; i++) { free(phy_vars_eNB[CC_id]->common_vars.rxdata[0][i]); rxdata[i] = (int32_t*)(32 + malloc16(32+frame_parms->samples_per_tti*10*sizeof(int32_t))); // FIXME broken memory allocation - phy_vars_eNB[CC_id]->common_vars.rxdata[0][i] = rxdata[i]-N_TA_offset; // N_TA offset for TDD FIXME! N_TA_offset > 16 => access of unallocated memory + phy_vars_eNB[CC_id]->common_vars.rxdata[0][i] = rxdata[i]; //-N_TA_offset; // N_TA offset for TDD FIXME! N_TA_offset > 16 => access of unallocated memory memset(rxdata[i], 0, frame_parms->samples_per_tti*10*sizeof(int32_t)); printf("rxdata[%d] @ %p (%p) (N_TA_OFFSET %d)\n", i, phy_vars_eNB[CC_id]->common_vars.rxdata[0][i],rxdata[i],N_TA_offset); } @@ -1553,6 +1561,7 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c memset(txdata[i],0, frame_parms->samples_per_tti*10*sizeof(int32_t)); printf("txdata[%d] @ %p\n", i, phy_vars_eNB[CC_id]->common_vars.txdata[0][i]); } + */ } } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 6272fdb4eb..c73bc8d01b 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1583,7 +1583,18 @@ int main( int argc, char **argv ) UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id]; - UE[CC_id]->N_TA_offset = 0; + + if (frame_parms[CC_id]->frame_type==FDD) { + UE[CC_id]->N_TA_offset = 0; + } + else { + if (frame_parms[CC_id]->N_RB_DL == 100) + UE[CC_id]->N_TA_offset = 624; + else if (frame_parms[CC_id]->N_RB_DL == 50) + UE[CC_id]->N_TA_offset = 624/2; + else if (frame_parms[CC_id]->N_RB_DL == 25) + UE[CC_id]->N_TA_offset = 624/4; + } } @@ -1623,8 +1634,17 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0]; - PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; - + if (frame_parms[CC_id]->frame_type==FDD) { + PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; + } + else { + if (frame_parms[CC_id]->N_RB_DL == 100) + PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624; + else if (frame_parms[CC_id]->N_RB_DL == 50) + PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/2; + else if (frame_parms[CC_id]->N_RB_DL == 25) + PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/4; + } } diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 22cc46388d..f4b8e0ab3a 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -98,8 +98,8 @@ extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int oai_exit; -extern int32_t **rxdata; -extern int32_t **txdata; +int32_t **rxdata; +int32_t **txdata; //extern unsigned int tx_forward_nsamps; //extern int tx_delay; @@ -1628,14 +1628,14 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg) } /* - if (frame_parms->frame_type == TDD) { + if (frame_parms->frame_type == TDD) { if (frame_parms->N_RB_DL == 100) - N_TA_offset = 624; - else if (frame_parms->N_RB_DL == 50) - N_TA_offset = 624/2; - else if (frame_parms->N_RB_DL == 25) - N_TA_offset = 624/4; - } + N_TA_offset = 624; + else if (frame_parms->N_RB_DL == 50) + N_TA_offset = 624/2; + else if (frame_parms->N_RB_DL == 25) + N_TA_offset = 624/4; + } */ // replace RX signal buffers with mmaped HW versions @@ -1645,9 +1645,9 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg) for (i=0; inb_antennas_rx; i++) { printf( "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map->card, rf_map->chain+i ); free( phy_vars_ue[CC_id]->common_vars.rxdata[i] ); - rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); - phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD - printf("rxdata[%d] : %p\n",i,rxdata[i]); + rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); + phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD + printf("rxdata[%d] : %p\n",i,rxdata[i]); } for (i=0; inb_antennas_tx; i++) { From 7adc4703be5954fb9c869962195c15aaa96caf9d Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 30 Nov 2016 16:29:14 +0100 Subject: [PATCH 163/182] T: update traces - add mcs to ENB_PHY_DLSCH_UE_DCI - add mcs, round, first_rb, nb_rb, TBS to ENB_PHY_ULSCH_UE_DCI --- common/utils/T/T_messages.txt | 4 ++-- openair1/SCHED/phy_procedures_lte_eNb.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 3e3ba082dd..d6aa753892 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -16,7 +16,7 @@ ID = ENB_PHY_DL_TICK ID = ENB_PHY_DLSCH_UE_DCI DESC = eNodeB downlink UE specific DCI as sent by the PHY layer GROUP = ALL:PHY:GRAPHIC:ENB - FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid + FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs ID = ENB_PHY_DLSCH_UE_ACK DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback GROUP = ALL:PHY:GRAPHIC:ENB @@ -28,7 +28,7 @@ ID = ENB_PHY_DLSCH_UE_NACK ID = ENB_PHY_ULSCH_UE_DCI DESC = eNodeB uplink UE specific DCI as sent by the PHY layer GROUP = ALL:PHY:GRAPHIC:ENB - FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid + FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS ID = ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION DESC = eNodeB uplink UE retransmission due to PHICH NACK (see generate_phich_top) GROUP = ALL:PHY:GRAPHIC:ENB diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index c868a1a733..160153317d 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -760,7 +760,8 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id), T_INT(dci_alloc->rnti), T_INT(dci_alloc->format), - T_INT(eNB->dlsch[(int)UE_id][0]->current_harq_pid)); + T_INT(eNB->dlsch[(int)UE_id][0]->current_harq_pid), + T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->mcs)); eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = dci_alloc->firstCCE; @@ -854,8 +855,12 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1; T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id), - T_INT(dci_alloc->rnti), T_INT(harq_pid)); - + T_INT(dci_alloc->rnti), T_INT(harq_pid), + T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->mcs), + T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->round), + T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->first_rb), + T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->nb_rb), + T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->TBS)); } void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols) { From a016cb75897ef7fc7bc015d2631ac8a0ee165837 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 30 Nov 2016 16:32:29 +0100 Subject: [PATCH 164/182] T: new logger ticked_ttilog A new logger is there: the "ticked TTI logger". Similar to TTI logger (used by the PUCCH1 energy plot) but takes another input, the "tick" (think subframe) and a default value for when no event is triggered between two ticks. This is used for the UL and DL MCS plots in enb.c (next commit). --- common/utils/T/tracer/logger/Makefile | 2 +- common/utils/T/tracer/logger/logger.h | 5 + common/utils/T/tracer/logger/ticked_ttilog.c | 196 +++++++++++++++++++ 3 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 common/utils/T/tracer/logger/ticked_ttilog.c diff --git a/common/utils/T/tracer/logger/Makefile b/common/utils/T/tracer/logger/Makefile index 92431739db..897c36e66f 100644 --- a/common/utils/T/tracer/logger/Makefile +++ b/common/utils/T/tracer/logger/Makefile @@ -2,7 +2,7 @@ CC=gcc CFLAGS=-Wall -g -pthread -I.. OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o ticklog.o iqlog.o \ - iqdotlog.o + iqdotlog.o ticked_ttilog.o logger.a: $(OBJS) ar cr logger.a $(OBJS) diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h index b2ab4f8cbc..4ade141742 100644 --- a/common/utils/T/tracer/logger/logger.h +++ b/common/utils/T/tracer/logger/logger.h @@ -10,6 +10,10 @@ logger *new_textlog(void *event_handler, void *database, logger *new_ttilog(void *event_handler, void *database, char *event_name, char *frame_varname, char *subframe_varname, char *data_varname, int convert_to_dB); +logger *new_ticked_ttilog(void *event_handler, void *database, + char *tick_event_name, + char *event_name, char *frame_varname, char *subframe_varname, + char *data_varname, int convert_to_dB, float empty_value); logger *new_timelog(void *event_handler, void *database, char *event_name); logger *new_ticklog(void *event_handler, void *database, char *event_name, char *frame_name, char *subframe_name); @@ -28,5 +32,6 @@ void textlog_dump_buffer(logger *_this, int dump_buffer); void logger_add_view(logger *l, view *v); void logger_set_filter(logger *l, void *filter); +void ticked_ttilog_set_tick_filter(logger *l, void *filter); #endif /* _LOGGER_H_ */ diff --git a/common/utils/T/tracer/logger/ticked_ttilog.c b/common/utils/T/tracer/logger/ticked_ttilog.c new file mode 100644 index 0000000000..96ad20a931 --- /dev/null +++ b/common/utils/T/tracer/logger/ticked_ttilog.c @@ -0,0 +1,196 @@ +#include "logger.h" +#include "logger_defs.h" +#include "event.h" +#include "database.h" +#include "handler.h" +#include "filter/filter.h" +#include +#include +#include +#include + +struct ticked_ttilog { + struct logger common; + void *database; + int tick_frame_arg; + int tick_subframe_arg; + int data_frame_arg; + int data_subframe_arg; + int data_arg; + int convert_to_dB; + int last_tick_frame; + int last_tick_subframe; + float last_value; + float empty_value; + char *tick_event_name; + unsigned long tick_handler_id; + /* tick filter - NULL is no filter set */ + void *tick_filter; +}; + +static void _event(void *p, event e) +{ + struct ticked_ttilog *l = p; + int frame; + int subframe; + float value; + + if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0) + return; + + frame = e.e[l->data_frame_arg].i; + subframe = e.e[l->data_subframe_arg].i; + + if (frame != l->last_tick_frame || subframe != l->last_tick_subframe) { + printf("WARNING: %s:%d: data comes without previous tick!\n", + __FILE__, __LINE__); + return; + } + + switch (e.e[l->data_arg].type) { + case EVENT_INT: value = e.e[l->data_arg].i; break; + case EVENT_ULONG: value = e.e[l->data_arg].ul; break; + default: printf("%s:%d: unsupported type\n", __FILE__, __LINE__); abort(); + } + + if (l->convert_to_dB) value = 10 * log10(value); + + l->last_value = value; +} + +static void _tick_event(void *p, event e) +{ + struct ticked_ttilog *l = p; + int i; + int frame; + int subframe; + + if (l->tick_filter != NULL && filter_eval(l->tick_filter, e) == 0) + return; + + frame = e.e[l->tick_frame_arg].i; + subframe = e.e[l->tick_subframe_arg].i; + + for (i = 0; i < l->common.vsize; i++) + l->common.v[i]->append(l->common.v[i], frame, subframe, l->last_value); + + l->last_value = l->empty_value; + l->last_tick_frame = frame; + l->last_tick_subframe = subframe; +} + +logger *new_ticked_ttilog(event_handler *h, void *database, + char *tick_event_name, char *frame_varname, char *subframe_varname, + char *event_name, char *data_varname, + int convert_to_dB, float empty_value) +{ + struct ticked_ttilog *ret; + int event_id; + database_event_format f; + int i; + + ret = calloc(1, sizeof(struct ticked_ttilog)); if (ret == NULL) abort(); + + ret->common.event_name = strdup(event_name); + if (ret->common.event_name == NULL) abort(); + ret->database = database; + ret->convert_to_dB = convert_to_dB; + + ret->tick_event_name = strdup(tick_event_name); + if (ret->tick_event_name == NULL) abort(); + ret->empty_value = empty_value; + ret->last_value = empty_value; + + /* tick event */ + event_id = event_id_from_name(database, tick_event_name); + + ret->tick_handler_id=register_handler_function(h,event_id,_tick_event,ret); + + f = get_format(database, event_id); + + /* look for frame, subframe and data args */ + ret->tick_frame_arg = -1; + ret->tick_subframe_arg = -1; + for (i = 0; i < f.count; i++) { + if (!strcmp(f.name[i], frame_varname)) ret->tick_frame_arg = i; + if (!strcmp(f.name[i], subframe_varname)) ret->tick_subframe_arg = i; + } + if (ret->tick_frame_arg == -1) { + printf("%s:%d: frame argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, frame_varname, event_name); + abort(); + } + if (ret->tick_subframe_arg == -1) { + printf("%s:%d: subframe argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, subframe_varname, event_name); + abort(); + } + if (strcmp(f.type[ret->tick_frame_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, frame_varname); + abort(); + } + if (strcmp(f.type[ret->tick_subframe_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, subframe_varname); + abort(); + } + + /* data event */ + event_id = event_id_from_name(database, event_name); + + ret->common.handler_id = register_handler_function(h,event_id,_event,ret); + + f = get_format(database, event_id); + + /* look for frame and subframe */ + ret->data_frame_arg = -1; + ret->data_subframe_arg = -1; + ret->data_arg = -1; + for (i = 0; i < f.count; i++) { + if (!strcmp(f.name[i], frame_varname)) ret->data_frame_arg = i; + if (!strcmp(f.name[i], subframe_varname)) ret->data_subframe_arg = i; + if (!strcmp(f.name[i], data_varname)) ret->data_arg = i; + } + if (ret->data_frame_arg == -1) { + printf("%s:%d: frame argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, frame_varname, event_name); + abort(); + } + if (ret->data_subframe_arg == -1) { + printf("%s:%d: subframe argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, subframe_varname, event_name); + abort(); + } + if (ret->data_arg == -1) { + printf("%s:%d: data argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, data_varname, event_name); + abort(); + } + if (strcmp(f.type[ret->data_frame_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, frame_varname); + abort(); + } + if (strcmp(f.type[ret->data_subframe_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, subframe_varname); + abort(); + } + if (strcmp(f.type[ret->data_arg], "int") != 0 && + strcmp(f.type[ret->data_arg], "float") != 0) { + printf("%s:%d: argument '%s' has wrong type" + " (should be 'int' or 'float')\n", + __FILE__, __LINE__, data_varname); + abort(); + } + + return ret; +} + +void ticked_ttilog_set_tick_filter(logger *_l, void *filter) +{ + struct ticked_ttilog *l = (struct ticked_ttilog *)_l; + free(l->tick_filter); + l->tick_filter = filter; +} From 1e485b4b5e09aeb17210763f1b9f743900a631e7 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 30 Nov 2016 16:39:49 +0100 Subject: [PATCH 165/182] T: add DL and UL MCS plots in enb.c Helps visualize MCS usage over time. --- common/utils/T/tracer/enb.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index 07768763a5..c6f3bba5ff 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -32,6 +32,8 @@ typedef struct { widget *pucch1_energy_ue_xy_plot; widget *pucch_iq_ue_xy_plot; widget *dl_ul_harq_ue_label; + widget *dl_mcs_xy_plot; + widget *ul_mcs_xy_plot; logger *pusch_iq_ue_logger; logger *ul_estimate_ue_logger; logger *pucch1_energy_ue_threshold_logger; @@ -44,6 +46,8 @@ typedef struct { logger *ul_dci_retransmission_logger[8]; logger *ul_ack_logger[8]; logger *ul_nack_logger[8]; + logger *dl_mcs_logger; + logger *ul_mcs_logger; } enb_gui; typedef struct { @@ -137,6 +141,10 @@ static void set_current_ue(gui *g, enb_data *e, int ue) xy_plot_set_title(g, e->e->pucch_iq_ue_xy_plot, s); sprintf(s, "DL/UL HARQ (x8) [UE %d]", ue); label_set_text(g, e->e->dl_ul_harq_ue_label, s); + sprintf(s, "DL MCS [UE %d]", ue); + xy_plot_set_title(g, e->e->dl_mcs_xy_plot, s); + sprintf(s, "UL MCS [UE %d]", ue); + xy_plot_set_title(g, e->e->ul_mcs_xy_plot, s); logger_set_filter(e->e->pusch_iq_ue_logger, filter_eq( @@ -175,6 +183,14 @@ static void set_current_ue(gui *g, enb_data *e, int ue) logger_set_filter(e->e->ul_nack_logger[i], ticktime_filter(e->database, "ENB_PHY_ULSCH_UE_NACK", i, ue)); } + logger_set_filter(e->e->dl_mcs_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_DLSCH_UE_DCI", "UE_id"), + filter_int(ue))); + logger_set_filter(e->e->ul_mcs_logger, + filter_eq( + filter_evarg(e->database, "ENB_PHY_ULSCH_UE_DCI", "UE_id"), + filter_int(ue))); } static void click(void *private, gui *g, @@ -309,6 +325,30 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database, logger_add_view(l, v); e->pucch_iq_ue_logger = l; + /* UE x DL mcs */ + line = new_container(g, HORIZONTAL); + widget_add_child(g, top_container, line, -1); + w = new_xy_plot(g, 128, 55, "", 20); + xy_plot_set_range(g, w, 0, 1024*10, -1, 29); + e->dl_mcs_xy_plot = w; + widget_add_child(g, line, w, -1); + l = new_ticked_ttilog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe", + "ENB_PHY_DLSCH_UE_DCI", "mcs", 0, -1); + v = new_view_tti(10, g, w, new_color(g, "#0c0c72")); + logger_add_view(l, v); + e->dl_mcs_logger = l; + + /* UE x UL mcs */ + w = new_xy_plot(g, 128, 55, "", 20); + xy_plot_set_range(g, w, 0, 1024*10, -1, 29); + e->ul_mcs_xy_plot = w; + widget_add_child(g, line, w, -1); + l = new_ticked_ttilog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe", + "ENB_PHY_ULSCH_UE_DCI", "mcs", 0, -1); + v = new_view_tti(10, g, w, new_color(g, "#0c0c72")); + logger_add_view(l, v); + e->ul_mcs_logger = l; + /* downlink/uplink UE DCIs */ widget_add_child(g, top_container, new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1); From cbc2164e50ff1cfb012cf79806184a24e923f747 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 30 Nov 2016 18:01:17 +0100 Subject: [PATCH 166/182] T: bugfix: vertical tick was off by 1 pixel The problem was visible when DL MCS was set to 20 (do a ping -c 192.172.0.1 -i0.2 to get it). The dots were not plotted at the exact line of the tick mark. Not sure the fix is always correct. No big deal anyway. --- common/utils/T/tracer/gui/xy_plot.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c index 9342a5a464..af88bb7149 100644 --- a/common/utils/T/tracer/gui/xy_plot.c +++ b/common/utils/T/tracer/gui/xy_plot.c @@ -70,9 +70,9 @@ static void paint(gui *_gui, widget *_this) */ char v[64]; int vwidth, dummy; - float x = (k * ticstep - allocated_xmin) / - (allocated_xmax - allocated_xmin) * - (allocated_plot_width - 1); + int x = (k * ticstep - allocated_xmin) / + (allocated_xmax - allocated_xmin) * + (allocated_plot_width - 1); x_draw_line(g->x, g->xwin, FOREGROUND_COLOR, this->common.x + this->vrule_width + x, this->common.y + this->common.height - this->label_height * 2, @@ -112,9 +112,9 @@ static void paint(gui *_gui, widget *_this) for (k = kmin; k <= kmax; k++) { char v[64]; int vwidth, dummy; - float y = (k * ticstep - allocated_ymin) / - (allocated_ymax - allocated_ymin) * - (allocated_plot_height - 1); + int y = (k * ticstep - allocated_ymin) / + (allocated_ymax - allocated_ymin) * + (allocated_plot_height - 1); sprintf(v, "%g", k * ticstep); x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy); x_draw_line(g->x, g->xwin, FOREGROUND_COLOR, From f89c70dfc34898199861fb93f7c31bbe0ebd6431 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Wed, 30 Nov 2016 18:03:49 +0100 Subject: [PATCH 167/182] T: change range of DL/UL MCS plots [-1 29] was not very pleasant for MCS 28 or no DCI (value is -1 in this case). [-2 30] looks better. --- common/utils/T/tracer/enb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index c6f3bba5ff..14e1da35c0 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -329,7 +329,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database, line = new_container(g, HORIZONTAL); widget_add_child(g, top_container, line, -1); w = new_xy_plot(g, 128, 55, "", 20); - xy_plot_set_range(g, w, 0, 1024*10, -1, 29); + xy_plot_set_range(g, w, 0, 1024*10, -2, 30); e->dl_mcs_xy_plot = w; widget_add_child(g, line, w, -1); l = new_ticked_ttilog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe", @@ -340,7 +340,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database, /* UE x UL mcs */ w = new_xy_plot(g, 128, 55, "", 20); - xy_plot_set_range(g, w, 0, 1024*10, -1, 29); + xy_plot_set_range(g, w, 0, 1024*10, -2, 30); e->ul_mcs_xy_plot = w; widget_add_child(g, line, w, -1); l = new_ticked_ttilog(h, database, "ENB_PHY_DL_TICK", "frame", "subframe", From cae34e0f4d5cf63e7cb031a1b33f3f08f93db808 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 1 Dec 2016 11:08:13 +0100 Subject: [PATCH 168/182] T: minor fix - wrong comments --- common/utils/T/tracer/logger/ticked_ttilog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/utils/T/tracer/logger/ticked_ttilog.c b/common/utils/T/tracer/logger/ticked_ttilog.c index 96ad20a931..53bbad7681 100644 --- a/common/utils/T/tracer/logger/ticked_ttilog.c +++ b/common/utils/T/tracer/logger/ticked_ttilog.c @@ -108,7 +108,7 @@ logger *new_ticked_ttilog(event_handler *h, void *database, f = get_format(database, event_id); - /* look for frame, subframe and data args */ + /* look for frame and subframe */ ret->tick_frame_arg = -1; ret->tick_subframe_arg = -1; for (i = 0; i < f.count; i++) { @@ -143,7 +143,7 @@ logger *new_ticked_ttilog(event_handler *h, void *database, f = get_format(database, event_id); - /* look for frame and subframe */ + /* look for frame, subframe and data args */ ret->data_frame_arg = -1; ret->data_subframe_arg = -1; ret->data_arg = -1; From 53ccc0e7adcf85b1a0c81cfd2c1ff438b2e8c3ca Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 1 Dec 2016 13:15:34 +0100 Subject: [PATCH 169/182] T: minor bugfix - bad argument type in log --- common/utils/T/tracer/gui/xy_plot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c index af88bb7149..3baac92c04 100644 --- a/common/utils/T/tracer/gui/xy_plot.c +++ b/common/utils/T/tracer/gui/xy_plot.c @@ -85,7 +85,7 @@ static void paint(gui *_gui, widget *_this) this->common.y + this->common.height - this->label_height * 2 + this->label_baseline, v); - LOGD("tic k %d val %g x %g\n", k, k * ticstep, x); + LOGD("tic k %d val %g x %d\n", k, k * ticstep, x); } /* vertical tics */ From ce1e9cb15ac7f6ce06e6447528151f1f58fee9de Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 1 Dec 2016 13:16:49 +0100 Subject: [PATCH 170/182] T: bugfix: bad order of parameters in function declaration --- common/utils/T/tracer/logger/logger.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h index 4ade141742..70fe7cab1f 100644 --- a/common/utils/T/tracer/logger/logger.h +++ b/common/utils/T/tracer/logger/logger.h @@ -11,9 +11,9 @@ logger *new_ttilog(void *event_handler, void *database, char *event_name, char *frame_varname, char *subframe_varname, char *data_varname, int convert_to_dB); logger *new_ticked_ttilog(void *event_handler, void *database, - char *tick_event_name, - char *event_name, char *frame_varname, char *subframe_varname, - char *data_varname, int convert_to_dB, float empty_value); + char *tick_event_name, char *frame_varname, char *subframe_varname, + char *event_name, char *data_varname, + int convert_to_dB, float empty_value); logger *new_timelog(void *event_handler, void *database, char *event_name); logger *new_ticklog(void *event_handler, void *database, char *event_name, char *frame_name, char *subframe_name); From f4b93cdc120d3db72ee7f13b7c852157bd864708 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 1 Dec 2016 19:37:48 +0100 Subject: [PATCH 171/182] [Gitlab CI] Add OAI UE to autotests --- cmake_targets/autotests/README.txt | 9 + .../autotests/run_exec_lte-softmodem_tests.py | 23 +- cmake_targets/autotests/test_case_list.xml | 795 ++++++++++++++++-- 3 files changed, 738 insertions(+), 89 deletions(-) diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt index cf0e972b08..5841ed6dc2 100644 --- a/cmake_targets/autotests/README.txt +++ b/cmake_targets/autotests/README.txt @@ -268,6 +268,15 @@ Obj.# Case# Test# Description 02 55 22 Band 7 FDD 10MHz DL Throughput (TCP) for 300 sec for 2TX/2RX (TM2) 02 55 23 Band 7 FDD 20MHz DL Throughput (TCP) for 300 sec for 2TX/2RX (TM2) +02 57 lte-softmodem tests with USRP B210 RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ OAI UE +02 57 00 Band 7 FDD 5MHz UL Throughput for 300 sec for 1TX/1RX +02 57 01 Band 7 FDD 10MHz UL Throughput for 300 sec for 1TX/1RX +02 57 02 Band 7 FDD 20MHz UL Throughput for 300 sec for 1TX/1RX +02 57 03 Band 7 FDD 5MHz DL Throughput for 300 sec for 1TX/1RX +02 57 04 Band 7 FDD 10MHz DL Throughput for 300 sec for 1TX/1RX +02 57 05 Band 7 FDD 20MHz DL Throughput for 300 sec for 1TX/1RX + + 01 64 lte-softmodem-noS1 tests 02 Functional test case diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py index ab507578af..ada0cf0932 100755 --- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py +++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py @@ -552,7 +552,7 @@ def wait_testcaseclass_generic_threads(threadListGeneric, timeout = 1): # \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) # \param ExmimoRfStop command to stop EXMIMO Card # \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case -def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): +def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, GitOAI5GRepoBranch, GitOpenaircnRepoBranch,timeout_cmd): #We ignore the password sent to this function for secuirity reasons for password present in log files #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL @@ -583,7 +583,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , RRH_main_exec = testcase.findtext('RRH_main_exec',default='') RRH_main_exec_args = testcase.findtext('RRH_main_exec_args',default='') RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='False') - + RRH_branch = testcase.findtext('RRH_branch',default=GitOAI5GRepoBranch) eNBMachine = testcase.findtext('eNB',default='') eNB_config_file = testcase.findtext('eNB_config_file',default='') @@ -599,6 +599,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') if re.compile('\w+').match(eNB_search_expr_true) != None: eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + eNB_branch = testcase.findtext('eNB_branch',default=GitOAI5GRepoBranch) UEMachine = testcase.findtext('UE',default='') UE_config_file = testcase.findtext('UE_config_file',default='') @@ -615,6 +616,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , UE_stop_script = testcase.findtext('UE_stop_script','') if re.compile('\w+').match(UE_search_expr_true) != None: UE_search_expr_true = UE_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + UE_branch = testcase.findtext('UE_branch',default=GitOAI5GRepoBranch) EPCMachine = testcase.findtext('EPC',default='') EPC_config_file = testcase.findtext('EPC_config_file',default='') @@ -633,6 +635,8 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , EPC_traffic_exec_args = testcase.findtext('EPC_traffic_exec_args',default='') EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='False') EPC_search_expr_true = testcase.findtext('EPC_search_expr_true','') + EPC_branch = testcase.findtext('EPC_branch',default=GitOpenaircnRepoBranch) + if re.compile('\w+').match(EPC_search_expr_true) != None: EPC_search_expr_true = EPC_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' @@ -689,7 +693,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logdir_local_testcase = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) #Make the log directory of test case if RRHMachine != '': - cmd = 'rm -fr ' + logdir_RRH + ' ; mkdir -p ' + logdir_RRH + cmd = 'rm -fr ' + logdir_RRH + ' ; mkdir -p ' + logdir_RRH result = oai_RRH.send_recv(cmd) cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB result = oai_eNB.send_recv(cmd) @@ -709,7 +713,8 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logfile_task_RRH_out = logdir_RRH + '/RRH_task_out' + '_' + str(run) + '_.log' logfile_task_RRH = logdir_local_testcase + '/RRH_task' + '_' + str(run) + '_.log' task_RRH_compile = ' ( uname -a ; date \n' - task_RRH_compile = task_RRH_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_RRH_compile = task_RRH_compile + 'cd ' + logdirOAI5GRepo + '; git reset --hard HEAD ; git checkout ' + RRH_branch + ' ; source oaienv \n' + task_RRH_compile = task_RRH_compile + ' source cmake_targets/tools/build_helper \n' task_RRH_compile = task_RRH_compile + 'env |grep OPENAIR \n' task_RRH_compile = task_RRH_compile + update_config_file(oai_RRH, RRH_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' if RRH_compile_prog != "": @@ -749,7 +754,8 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logfile_pcap_tmp_eNB = '/tmp/' + '/eNB_tshark' + '_' + str(run) + '_.pcap' task_eNB_compile = ' ( uname -a ; date \n' - task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + '; git reset --hard HEAD ; git checkout ' + eNB_branch + ' ; source oaienv \n' + task_eNB_compile = task_eNB_compile + ' source cmake_targets/tools/build_helper \n' task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' if eNB_compile_prog != "": @@ -799,8 +805,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , task_UE_compile = ' ( uname -a ; date \n' task_UE_compile = task_UE_compile + 'array_exec_pid=()' + '\n' - task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + '\n' - task_UE_compile = task_UE_compile + 'source oaienv \n' + task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + '; git reset --hard HEAD ; git checkout ' + UE_branch + ' ; source oaienv \n' task_UE_compile = task_UE_compile + 'source cmake_targets/tools/build_helper \n' task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' @@ -850,7 +855,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , task_EPC_compile = ' ( uname -a ; date \n' task_EPC_compile = task_EPC_compile + 'array_exec_pid=()' + '\n' - task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + ' ; source oaienv \n' + task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + '; git reset --hard HEAD ; git checkout ' + EPC_branch + ' ; source oaienv \n' task_EPC_compile = task_EPC_compile + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' task_EPC_compile = task_EPC_compile + 'source BUILD/TOOLS/build_helper \n' if EPC_compile_prog != "": @@ -2203,7 +2208,7 @@ for testcase in testcaseList: print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList) print "testcasename = " + testcasename + " class = " + testcaseclass #cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop) - handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) + handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, GitOAI5GRepoBranch, GitOpenaircnRepoBranch, Timeout_cmd ) #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term print "Creating xml file for overall results..." diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index c73a5257e9..061569bd96 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -3315,7 +3315,7 @@ lte-softmodem - calisson + hutch stevens nano 390 @@ -3333,10 +3333,10 @@ targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3353,6 +3353,7 @@ /tmp + develop $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash @@ -3368,27 +3369,32 @@ /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 @@ -3409,7 +3415,7 @@ c lte-softmodem - calisson + hutch stevens nano 390 @@ -3427,10 +3433,10 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3462,27 +3468,32 @@ c /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 @@ -3503,7 +3514,7 @@ c lte-softmodem - calisson + hutch stevens nano 390 @@ -3512,7 +3523,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 @@ -3521,10 +3532,10 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3556,27 +3567,32 @@ c /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 @@ -3597,7 +3613,7 @@ c lte-softmodem - calisson + hutch stevens nano 390 @@ -3615,10 +3631,10 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3640,7 +3656,7 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf3_script 1 ppp0 -c 192.172.0.1 -i 1 -u -f m -b 10M -R + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec @@ -3650,27 +3666,32 @@ c /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 @@ -3679,7 +3700,7 @@ c cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db - $OPENAIRCN_DIR/TEST/autotests/tools/iperf3_script 5 lo -s -i 1 -f m + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b 16M -i 1 -f m -u @@ -3691,7 +3712,7 @@ c lte-softmodem - calisson + hutch stevens nano 390 @@ -3709,10 +3730,10 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3734,7 +3755,7 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf3_script 1 ppp0 -c 192.172.0.1 -i 1 -u -f m -b 10M -R + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec @@ -3744,35 +3765,42 @@ c /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db - $OPENAIRCN_DIR/TEST/autotests/tools/iperf3_script 5 lo -s -i 1 -f m + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b33M -i 1 -f m -u @@ -3784,7 +3812,7 @@ c lte-softmodem - calisson + hutch stevens nano 390 @@ -3793,7 +3821,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 @@ -3802,10 +3830,10 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c @@ -3827,7 +3855,7 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf3_script 1 ppp0 -c 192.172.0.1 -i 1 -u -f m -b 9M -R + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec @@ -3837,27 +3865,32 @@ c /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" - ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth0\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" ETC/mme.conf MME_PORT_FOR_S11_MME 2123 ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" ETC/mme.conf OUTPUT \"CONSOLE\" - ETC/mme.conf HSS_HOSTNAME \"hss\" + ETC/mme.conf HSS_HOSTNAME \"nano\" ETC/mme_fd.conf Identity \"nano.openair4G.eur\" - ETC/hss_fd.conf Identity \"hss.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" - ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\",\"192.172.1.0/24\" - sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai -vf; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c - sudo mkdir -p /usr/local/etc/oai/freeDiamter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 @@ -3866,7 +3899,7 @@ c cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db - $OPENAIRCN_DIR/TEST/autotests/tools/iperf3_script 5 lo -s -i 1 -f m + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b55M -i 1 -f m -u @@ -10410,5 +10443,607 @@ c + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -26 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x + develop1B + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 7Mbits/s + + + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 5 lo -s -i 1 -u -f m + + throughput_test min=0.0Mbits/sec max=1.0Mbits/sec average=1.0Mbits/sec + + False + USRPb210.OAI_EPC_remote.OAI_UE.5MHz.FDD.Band_7.UL.1TX.1RX + 10 + + + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + + + develop1B + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 14Mbits/s + + + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 5 lo -s -i 1 -u -f m + + throughput_test min=0.0Mbits/sec max=1.0Mbits/sec average=1.0Mbits/sec + + False + USRPb210.OAI_EPC_remote.OAI_UE.10MHz.FDD.Band_7.UL.1TX.1RX + 10 + + + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ;sudo -E ifconfig eth0:3 192.170.0.2 up ; sudo -E ifconfig eth0:4 192.170.1.2 up; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + + + develop1B + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 10Mbits/s + + + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 5 lo -s -i 1 -u -f m + + throughput_test min=0.0Mbits/sec max=1.0Mbits/sec average=1.0Mbits/sec + + False + USRPb210.OAI_EPC_remote.OAI_UE.20MHz.FDD.Band_7.UL.1TX.1RX + 10 + + + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -26 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + develop1B + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + + throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b 16M -i 1 -f m -u + + + + False + USRPb210.OAI_EPC_remote.OAI_UE.5MHz.FDD.Band_7.DL.1TX.1RX + 10 + + + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + + + develop1B + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + + throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + + + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b33M -i 1 -f m -u + + + + False + USRPb210.OAI_EPC_remote.OAI_UE.10MHz.FDD.Band_7.DL.1TX.1RX + 10 + + + + lte-softmodem + + hutch + starsky + nano + 390 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth0\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.19/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + --eNB -w USRP -c + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + + develop1B + $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf + + + + + False + + /tmp + + + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + + throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + + False + sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + + /tmp + ETC/hss.conf MYSQL_user \"root\" + ETC/hss.conf MYSQL_pass \"linux\" + ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" + ETC/mme.conf MME_IPV4_ADDRESS_FOR_S11_MME \"127.0.11.1/8\" + ETC/mme.conf MME_PORT_FOR_S11_MME 2123 + ETC/mme.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/mme.conf OUTPUT \"CONSOLE\" + ETC/mme.conf HSS_HOSTNAME \"nano\" + ETC/mme_fd.conf Identity \"nano.openair4G.eur\" + ETC/mme_fd.conf ConnectPeer nano.openair4G.eur + ETC/hss_fd.conf Identity \"nano.openair4G.eur\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S11 \"lo\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S11 \"127.0.11.2/8\" + ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" + ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 + ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" + ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" + ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/acl.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/mme.conf /usr/local/etc/oai/ ; sudo cp -vf $OPENAIRCN_DIR/ETC/mme_fd.conf /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/spgw.conf /usr/local/etc/oai ; $OPENAIRCN_DIR/SCRIPTS/./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur ; $OPENAIRCN_DIR/SCRIPTS/build_mme -c ; $OPENAIRCN_DIR/SCRIPTS/build_spgw -c + + sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c + +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc + + cp -vf $OPENAIRCN_DIR/ETC/*.conf $OPENAIRCN_TESTDIR/; $OPENAIRCN_DIR/SCRIPTS/run_hss --export-db $OPENAIRCN_TESTDIR/hss_export.db + + $OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -c 192.172.0.2 -b55M -i 1 -f m -u + + + + False + USRPb210.OAI_EPC_remote.OAI_UE.20MHz.FDD.Band_7.DL.1TX.1RX + 10 + + + From 7c9a3311e7fb27e04cd7de69e71a99796ffb2f8b Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 1 Dec 2016 22:24:04 +0100 Subject: [PATCH 172/182] minor fixes to OAI UE/OAI EPC test cases --- cmake_targets/autotests/test_case_list.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 061569bd96..8fb4dc1c39 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -3353,11 +3353,10 @@ /tmp - develop $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 7Mbits/s @@ -10488,7 +10487,7 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 7Mbits/s From 05c635311d1dec5a82d03e6c988da2dd44d83caa Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Fri, 2 Dec 2016 07:20:43 +0100 Subject: [PATCH 173/182] fix for 0157 test cases --- cmake_targets/autotests/test_case_list.xml | 53 +++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 8fb4dc1c39..60d7043338 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -11,7 +11,7 @@ sudo -S -E /opt/ltebox/tools/stop_ltebox exmimo_pci=`lspci -m | grep Xilinx`; if [ -n "$exmimo_pci" ] ; then $OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; fi; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg 36000 - 010141 0102+ 010301 010303 010304 010305 0104+ 015508 015511 015520 015523 015518 015519 015520 015521 015522 015523 015602 015605 015702 015705 015818 015819 015820 015821 015822 015823 016102 016105 016502 016505 017002 017005 018002 018005 018502 018505 025514 025517 025520 025523 025518 025519 025520 025521 025522 025523 + 010141 0102+ 010301 010303 010304 010305 0104+ 015508 015511 015520 015523 015518 015519 015520 015521 015522 015523 015602 015605 015818 015819 015820 015821 015822 015823 016102 016105 016502 016505 017002 017005 018002 018005 018502 018505 025514 025517 025520 025523 025518 025519 025520 025521 025522 025523 3 amerique mozart hutch starsky stevens calisson superserver @@ -3387,7 +3387,7 @@ ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -3396,7 +3396,7 @@ sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -3455,7 +3455,7 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 14Mbits/s @@ -3486,7 +3486,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -3554,9 +3554,9 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 10Mbits/s + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 28Mbits/s @@ -3585,7 +3585,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -3653,14 +3653,14 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec - False sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + throughput_test min=0.0Mbits/sec max=5.0Mbits/sec average=4.0Mbits/sec + /tmp ETC/hss.conf MYSQL_user \"root\" @@ -3684,7 +3684,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -3752,14 +3752,14 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec - False sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + throughput_test min=0.0Mbits/sec max=9.0Mbits/sec average=9.0Mbits/sec + /tmp ETC/hss.conf MYSQL_user \"root\" @@ -3783,7 +3783,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -3852,14 +3852,15 @@ c $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec - False sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + throughput_test min=0.0Mbits/sec max=9.0Mbits/sec average=9.0Mbits/sec + + /tmp ETC/hss.conf MYSQL_user \"root\" @@ -3883,7 +3884,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -10518,7 +10519,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -10618,7 +10619,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -10718,7 +10719,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -10818,7 +10819,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -10918,7 +10919,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" @@ -11019,7 +11020,7 @@ c ETC/spgw.conf SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP \"eth1\" ETC/spgw.conf SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" ETC/spgw.conf SGW_IPV4_PORT_FOR_S1U_S12_S4_UP 2152 - ETC/spgw.conf PGW_IPV4_ADDRESS_FOR_SGI \"eth1\" + ETC/spgw.conf PGW_INTERFACE_NAME_FOR_SGI \"eth1\" ETC/spgw.conf PGW_MASQUERADE_SGI \"yes\" ETC/spgw.conf DEFAULT_DNS_IPV4_ADDRESS \"192.168.12.100\" ETC/spgw.conf IPV4_LIST \"192.172.0.0/24\" From 06409595609f2b2f48d9c04ad4be11f2faee8a66 Mon Sep 17 00:00:00 2001 From: Rohit gupta Date: Fri, 2 Dec 2016 07:54:02 +0100 Subject: [PATCH 174/182] minor fixes for 0257* test cases --- cmake_targets/autotests/test_case_list.xml | 118 +++++++++++---------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 60d7043338..c96c906fc3 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -10486,16 +10486,16 @@ c $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 7Mbits/s + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 oai0 -u -c 192.172.0.1 -b 7Mbits/s False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp ETC/hss.conf MYSQL_user \"root\" @@ -10528,7 +10528,7 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -10553,7 +10553,7 @@ c /tmp targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" @@ -10571,7 +10571,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c - sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -10583,26 +10583,26 @@ c /tmp - - + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 14Mbits/s + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 oai0 -u -c 192.172.0.1 -b 14Mbits/s False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" - ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" - ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" @@ -10628,7 +10628,7 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -10653,7 +10653,7 @@ c /tmp targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" @@ -10671,7 +10671,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c - sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ;sudo -E ifconfig eth0:3 192.170.0.2 up ; sudo -E ifconfig eth0:4 192.170.1.2 up; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -10683,26 +10683,26 @@ c /tmp - - + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r100 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c 192.172.0.1 -b 10Mbits/s + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 oai0 -u -c 192.172.0.1 -b 28Mbits/s False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" - ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" - ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" @@ -10728,7 +10728,7 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -10781,28 +10781,29 @@ c False + /tmp - - - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv + + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + throughput_test min=0.0Mbits/sec max=1Mbits/sec average=1Mbits/sec False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" - ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" - ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" @@ -10828,7 +10829,7 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -10883,26 +10884,27 @@ c /tmp - - + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + throughput_test min=0.0Mbits/sec max=1Mbits/sec average=1Mbits/sec False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp + ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" - ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" - ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" @@ -10927,9 +10929,9 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c +c + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash - - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc @@ -10985,25 +10987,26 @@ c /tmp - + $OPENAIR_DIR/cmake_targets/build_oai --eNB --UE -w USRP -c -x + develop1B - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo rmmod nasmesh ; sudo rmmod ue_ip; sudo rmmod oai_nw_drv - $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue + sleep 50; cd $OPENAIR_DIR/cmake_targets/lte_build_oai/build ; sudo -E $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -U -C2660000000 -r100 --ue-scan-carrier --ue-txgain 90 --ue-rxgain 125 - $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u + $OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 lo -s -i 1 -f m -u - throughput_test min=0.0Mbits/sec max=9Mbits/sec average=9Mbits/sec + throughput_test min=0.0Mbits/sec max=1Mbits/sec average=1Mbits/sec False - sudo -S -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue + /tmp ETC/hss.conf MYSQL_user \"root\" ETC/hss.conf MYSQL_pass \"linux\" ETC/hss.conf OPERATOR_key \"1006020f0a478bf6b699f15c062e42b3\" - ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"92\";MME_GID=\"4\";MME_CODE=\"1\";}" - ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"92\";TAC=\"1\";}" + ETC/mme.conf GUMMEI_LIST "{MCC=\"208\";MNC=\"93\";MME_GID=\"4\";MME_CODE=\"1\";}" + ETC/mme.conf TAI_LIST "{MCC=\"208\";MNC=\"93\";TAC=\"1\";}" ETC/mme.conf MME_INTERFACE_NAME_FOR_S1_MME \"eth1\" ETC/mme.conf MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" ETC/mme.conf MME_INTERFACE_NAME_FOR_S11_MME \"lo\" @@ -11029,7 +11032,8 @@ c sudo mkdir -p /usr/local/etc/oai/freeDiameter; sudo cp -vf $OPENAIRCN_DIR/ETC/hss.conf /usr/local/etc/oai ; sudo cp -vf $OPENAIRCN_DIR/ETC/hss_fd.conf /usr/local/etc/oai/freeDiameter ; $OPENAIRCN_DIR/SCRIPTS/check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ nano.openair4G.eur; $OPENAIRCN_DIR/SCRIPTS/build_hss -c c - $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E ifconfig eth0 add 192.172.0.1 + $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash + sleep 10;$OPENAIRCN_DIR/TEST/autotests/tools/run_epc From a78ef7c9322b375f31b88d416404d9c6f9f13a3e Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Fri, 2 Dec 2016 14:56:21 +0100 Subject: [PATCH 175/182] minor fixes for 0257+ test cases --- cmake_targets/autotests/test_case_list.xml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index c96c906fc3..bf2a1ed36c 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -10753,9 +10753,9 @@ c /tmp targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -26 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -24 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2660000000L targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 @@ -10771,7 +10771,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c - sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -10854,7 +10854,7 @@ c /tmp targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -29 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" @@ -10872,7 +10872,7 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c - sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -10956,7 +10956,7 @@ c /tmp targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"93\" targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 100 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf pdsch_referenceSignalPower -32 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" @@ -10974,9 +10974,8 @@ c targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 $OPENAIR_DIR/cmake_targets/build_oai --eNB -w USRP -c - sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf + sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; ifconfig ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf $OPENAIR_TESTDIR/enb.conf - develop1B $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf From d7831c1f5763c25686942ad953ec283399cfb628 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 14:52:12 +0100 Subject: [PATCH 176/182] T: add TBS to ENB_PHY_DLSCH_UE_DCI --- common/utils/T/T_messages.txt | 2 +- openair1/SCHED/phy_procedures_lte_eNb.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index d6aa753892..2d2ee3c489 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -16,7 +16,7 @@ ID = ENB_PHY_DL_TICK ID = ENB_PHY_DLSCH_UE_DCI DESC = eNodeB downlink UE specific DCI as sent by the PHY layer GROUP = ALL:PHY:GRAPHIC:ENB - FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs + FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS ID = ENB_PHY_DLSCH_UE_ACK DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback GROUP = ALL:PHY:GRAPHIC:ENB diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 160153317d..7286154c65 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -761,7 +761,8 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id), T_INT(dci_alloc->rnti), T_INT(dci_alloc->format), T_INT(eNB->dlsch[(int)UE_id][0]->current_harq_pid), - T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->mcs)); + T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->mcs), + T_INT(eNB->dlsch[(int)UE_id][0]->harq_processes[eNB->dlsch[(int)UE_id][0]->current_harq_pid]->TBS)); eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = dci_alloc->firstCCE; From 031a72de7dc0a4394f0bc6305c79631174cc272d Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 15:08:27 +0100 Subject: [PATCH 177/182] T: new function 'bps' This function is used to print rates (say '1kb/s' or '16Mb/s'). --- common/utils/T/tracer/utils.c | 11 +++++++++++ common/utils/T/tracer/utils.h | 1 + 2 files changed, 12 insertions(+) diff --git a/common/utils/T/tracer/utils.c b/common/utils/T/tracer/utils.c index a22e0a0565..5071546735 100644 --- a/common/utils/T/tracer/utils.c +++ b/common/utils/T/tracer/utils.c @@ -7,6 +7,7 @@ #include #include #include +#include void new_thread(void *(*f)(void *), void *data) { @@ -36,6 +37,16 @@ void sleepms(int ms) if (nanosleep(&t, NULL)) abort(); } +void bps(char *out, float v, char *suffix) +{ + static char *bps_unit[4] = { "", "k", "M", "G" }; + int flog; + if (v < 1000) flog = 0; else flog = floor(floor(log10(v)) / 3); + if (flog > 3) flog = 3; + v /= pow(10, flog*3); + sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix); +} + /****************************************************************************/ /* list */ /****************************************************************************/ diff --git a/common/utils/T/tracer/utils.h b/common/utils/T/tracer/utils.h index 086e92b5dc..3be6cfe1a7 100644 --- a/common/utils/T/tracer/utils.h +++ b/common/utils/T/tracer/utils.h @@ -3,6 +3,7 @@ void new_thread(void *(*f)(void *), void *data); void sleepms(int ms); +void bps(char *out, float v, char *suffix); /****************************************************************************/ /* list */ From bff8e40d003921641886221fde90e5dc53680cc0 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 17:30:13 +0100 Subject: [PATCH 178/182] T: add widget 'textarea' It's like a label but with fixed dimensions and maximum characters' capacity at creation time. --- common/utils/T/tracer/gui/Makefile | 4 +- common/utils/T/tracer/gui/gui.h | 3 + common/utils/T/tracer/gui/gui_defs.h | 13 ++++- common/utils/T/tracer/gui/textarea.c | 83 ++++++++++++++++++++++++++++ common/utils/T/tracer/gui/widget.c | 3 +- 5 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 common/utils/T/tracer/gui/textarea.c diff --git a/common/utils/T/tracer/gui/Makefile b/common/utils/T/tracer/gui/Makefile index 53f2077eac..2edec111d7 100644 --- a/common/utils/T/tracer/gui/Makefile +++ b/common/utils/T/tracer/gui/Makefile @@ -2,8 +2,8 @@ CC=gcc CFLAGS=-Wall -g -pthread -I/usr/include/X11/Xft -I/usr/include/freetype2 OBJS=init.o loop.o toplevel_window.o x.o container.o widget.o \ - gui.o label.o event.o xy_plot.o textlist.o notify.o positioner.o \ - timeline.o space.o image.o + gui.o label.o textarea.o event.o xy_plot.o textlist.o notify.o \ + positioner.o timeline.o space.o image.o gui.a: $(OBJS) ar cr gui.a $(OBJS) diff --git a/common/utils/T/tracer/gui/gui.h b/common/utils/T/tracer/gui/gui.h index c61c2dc6c0..43b955f91a 100644 --- a/common/utils/T/tracer/gui/gui.h +++ b/common/utils/T/tracer/gui/gui.h @@ -30,6 +30,7 @@ widget *new_toplevel_window(gui *gui, int width, int height, char *title); widget *new_container(gui *gui, int vertical); widget *new_positioner(gui *gui); widget *new_label(gui *gui, const char *text); +widget *new_textarea(gui *gui, int width, int height, int maxsize); widget *new_xy_plot(gui *gui, int width, int height, char *label, int vruler_width); widget *new_textlist(gui *gui, int width, int nlines, int background_color); @@ -41,6 +42,8 @@ widget *new_image(gui *gui, unsigned char *data, int length); void label_set_clickable(gui *gui, widget *label, int clickable); void label_set_text(gui *gui, widget *label, char *text); +void textarea_set_text(gui *gui, widget *textarea, char *text); + void container_set_child_growable(gui *_gui, widget *_this, widget *child, int growable); diff --git a/common/utils/T/tracer/gui/gui_defs.h b/common/utils/T/tracer/gui/gui_defs.h index 938641178c..9cb94dc98a 100644 --- a/common/utils/T/tracer/gui/gui_defs.h +++ b/common/utils/T/tracer/gui/gui_defs.h @@ -31,7 +31,7 @@ extern int volatile gui_logd; enum widget_type { TOPLEVEL_WINDOW, CONTAINER, POSITIONER, TEXT_LIST, XY_PLOT, BUTTON, LABEL, - TIMELINE, SPACE, IMAGE + TEXTAREA, TIMELINE, SPACE, IMAGE }; struct widget_list; @@ -148,6 +148,17 @@ struct label_widget { int baseline; /* as given by the graphic's backend */ }; +struct textarea_widget { + struct widget common; + char *t; + int tmaxsize; + int color; + int wanted_width; + int wanted_height; + int baseline; /* as given by the graphic's backend */ + int text_width; /* as given by the graphic's backend */ +}; + struct space_widget { struct widget common; int wanted_width; diff --git a/common/utils/T/tracer/gui/textarea.c b/common/utils/T/tracer/gui/textarea.c new file mode 100644 index 0000000000..da84f850ca --- /dev/null +++ b/common/utils/T/tracer/gui/textarea.c @@ -0,0 +1,83 @@ +#include "gui.h" +#include "gui_defs.h" +#include "x.h" +#include +#include +#include + +static void paint(gui *_gui, widget *_w) +{ + struct gui *g = _gui; + struct textarea_widget *t = _w; + LOGD("PAINT textarea '%s'\n", t->t); + x_fill_rectangle(g->x, g->xwin, BACKGROUND_COLOR, + t->common.x, t->common.y, + t->common.width, t->common.height); + x_draw_clipped_string(g->x, g->xwin, DEFAULT_FONT, t->color, + t->common.x + t->common.width - t->text_width, + t->common.y + t->baseline, t->t, + t->common.x, t->common.y, + t->common.width, t->common.height); +} + +static void hints(gui *_gui, widget *_w, int *width, int *height) +{ + struct textarea_widget *t = _w; + LOGD("HINTS textarea '%s'\n", t->t); + *width = t->wanted_width; + *height = t->wanted_height; +} + +widget *new_textarea(gui *_gui, int width, int height, int maxsize) +{ + struct gui *g = _gui; + struct textarea_widget *w; + int _; + + glock(g); + + w = new_widget(g, TEXTAREA, sizeof(struct textarea_widget)); + + w->t = calloc(maxsize, 1); + if (w->t == NULL) OOM; + w->tmaxsize = maxsize; + w->wanted_width = width; + w->wanted_height = height; + w->color = FOREGROUND_COLOR; + w->text_width = 0; + + x_text_get_dimensions(g->x, DEFAULT_FONT, "jlM", + &_, &_, &w->baseline); + + w->common.paint = paint; + w->common.hints = hints; + + gunlock(g); + + return w; +} + +/*************************************************************************/ +/* public functions */ +/*************************************************************************/ + +void textarea_set_text(gui *_g, widget *_this, char *text) +{ + struct gui *g = _g; + struct textarea_widget *this = _this; + int _; + int len = strlen(text); + if (len >= this->tmaxsize) { + fprintf(stderr, "ERROR: string '%s' too big for textarea\n", text); + return; + } + + glock(g); + + strcpy(this->t, text); + x_text_get_dimensions(g->x, DEFAULT_FONT, text, + &this->text_width, &_, &this->baseline); + send_event(g, DIRTY, this->common.id); + + gunlock(g); +} diff --git a/common/utils/T/tracer/gui/widget.c b/common/utils/T/tracer/gui/widget.c index 362d2e1e48..b8ccba6d54 100644 --- a/common/utils/T/tracer/gui/widget.c +++ b/common/utils/T/tracer/gui/widget.c @@ -265,7 +265,7 @@ void widget_dirty(gui *_gui, widget *_this) static const char *names[] = { "TOPLEVEL_WINDOW", "CONTAINER", "POSITIONER", "TEXT_LIST", - "XY_PLOT", "BUTTON", "LABEL", "TIMELINE", "SPACE", "IMAGE" + "XY_PLOT", "BUTTON", "LABEL", "TEXTAREA", "TIMELINE", "SPACE", "IMAGE" }; const char *widget_name(enum widget_type type) { @@ -277,6 +277,7 @@ const char *widget_name(enum widget_type type) case XY_PLOT: case BUTTON: case LABEL: + case TEXTAREA: case TIMELINE: case SPACE: case IMAGE: From 5b6a83fc7f1f47b18305037d02763167da4a66c1 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 17:37:22 +0100 Subject: [PATCH 179/182] T: some work on XY plot - change paint function: when the XY plot is resized we scale. Previously the last range was put in the middle of the new range (say when we increase the size). We may get aspect ratio changes if the resize is not identical vertically and horizontally, but I think this behaviour is more 'natural'. - fix a bug: the last horizontal tick label was printed to far on the right, out of the bouding box of the XY plot. This is not totally fixed in the case the label is larger than the XY plot. Now the part out of the bounding box will be printed on the left. No big deal, make the plot big enough. (Before, even if big enough you had a problem.) - add a new vertical tick display, to be used for throughput mostly. See in enb.c the difference between 'input signal' and throughput plots (those throughput plots will come in later commits). --- common/utils/T/tracer/gui/gui.h | 5 + common/utils/T/tracer/gui/gui_defs.h | 1 + common/utils/T/tracer/gui/xy_plot.c | 202 +++++++++++++++++++++++++++ 3 files changed, 208 insertions(+) diff --git a/common/utils/T/tracer/gui/gui.h b/common/utils/T/tracer/gui/gui.h index 43b955f91a..0fb96db325 100644 --- a/common/utils/T/tracer/gui/gui.h +++ b/common/utils/T/tracer/gui/gui.h @@ -14,6 +14,10 @@ typedef void widget; #define DEFAULT_FONT 0 +/* tic type for XY plot */ +#define XY_PLOT_DEFAULT_TICK 0 +#define XY_PLOT_SCROLL_TICK 1 + /* key modifiers */ #define KEY_SHIFT (1<<0) #define KEY_CONTROL (1<<1) @@ -54,6 +58,7 @@ void xy_plot_set_points(gui *gui, widget *this, int plot, int npoints, float *x, float *y); void xy_plot_get_dimensions(gui *gui, widget *this, int *width, int *height); void xy_plot_set_title(gui *gui, widget *this, char *label); +void xy_plot_set_tick_type(gui *gui, widget *this, int type); void textlist_add(gui *gui, widget *this, const char *text, int position, int color); diff --git a/common/utils/T/tracer/gui/gui_defs.h b/common/utils/T/tracer/gui/gui_defs.h index 9cb94dc98a..88b8121ec9 100644 --- a/common/utils/T/tracer/gui/gui_defs.h +++ b/common/utils/T/tracer/gui/gui_defs.h @@ -117,6 +117,7 @@ struct xy_plot_widget { int wanted_height; struct xy_plot_plot *plots; int nplots; + int tick_type; }; struct timeline_subline { diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c index 3baac92c04..4115f92103 100644 --- a/common/utils/T/tracer/gui/xy_plot.c +++ b/common/utils/T/tracer/gui/xy_plot.c @@ -1,11 +1,20 @@ #include "gui.h" #include "gui_defs.h" #include "x.h" +#include "../utils.h" #include #include #include #include +#if 0 +/* this version behaves differently when you resize the XY plot. Say + * you increase the size. The old (smaller) view is put at the center + * of the new view. Everything inside keeps the same size/aspect ratio. + * The other version below resizes the old view so that it fully occupies + * the new view. It may introduce aspect ratio changes, but usage seems + * to suggest it's a better behaviour. + */ static void paint(gui *_gui, widget *_this) { struct gui *g = _gui; @@ -155,6 +164,184 @@ static void paint(gui *_gui, widget *_this) x_plot_points(g->x, g->xwin, this->plots[n].color); } } +#endif + +static void paint(gui *_gui, widget *_this) +{ + struct gui *g = _gui; + struct xy_plot_widget *this = _this; + int allocated_plot_width; + int allocated_plot_height; + float pxsize; + float ticdist; + float tic; + float ticstep; + int k, kmin, kmax; + float allocated_xmin, allocated_xmax; + float allocated_ymin, allocated_ymax; + int i; + int n; + char v[64]; + int vwidth, dummy; + +# define FLIP(v) (-(v) + allocated_plot_height-1) + + LOGD("PAINT xy plot xywh %d %d %d %d\n", this->common.x, this->common.y, this->common.width, this->common.height); + +//x_draw_rectangle(g->x, g->xwin, 1, this->common.x, this->common.y, this->common.width, this->common.height); + + allocated_plot_width = this->common.width - this->vrule_width; + allocated_plot_height = this->common.height - this->label_height * 2; + + if (allocated_plot_width <= 1 || allocated_plot_height <= 1) { + WARN("PAINT xy plot: width (%d) or height (%d) is wrong, not painting\n", + this->common.width, this->common.height); + return; + } + + /* plot zone */ + /* TODO: refine height - height of hrule text may be != from label */ + x_draw_rectangle(g->x, g->xwin, 1, + this->common.x + this->vrule_width, + this->common.y, + this->common.width - this->vrule_width -1, /* -1 to see right border */ + this->common.height - this->label_height * 2); + + /* horizontal tics */ + pxsize = (this->xmax - this->xmin) / allocated_plot_width; + ticdist = 100; + tic = floor(log10(ticdist * pxsize)); + ticstep = powf(10, tic); + allocated_xmin = this->xmin; + allocated_xmax = this->xmax; + /* adjust tic if too tight */ + LOGD("pre x ticstep %g\n", ticstep); + while (1) { + if (ticstep / (allocated_xmax - allocated_xmin) + * (allocated_plot_width - 1) > 40) break; + ticstep *= 2; + } + LOGD("post x ticstep %g\n", ticstep); + LOGD("xmin/max %g %g width allocated %d alloc xmin/max %g %g ticstep %g\n", this->xmin, this->xmax, allocated_plot_width, allocated_xmin, allocated_xmax, ticstep); + kmin = ceil(allocated_xmin / ticstep); + kmax = floor(allocated_xmax / ticstep); + for (k = kmin; k <= kmax; k++) { +/* + (k * ticstep - allocated_xmin) / (allocated_max - allocated_xmin) = + (x - 0) / (allocated_plot_width-1 - 0) + */ + int x = (k * ticstep - allocated_xmin) / + (allocated_xmax - allocated_xmin) * + (allocated_plot_width - 1); + int px; + x_draw_line(g->x, g->xwin, FOREGROUND_COLOR, + this->common.x + this->vrule_width + x, + this->common.y + this->common.height - this->label_height * 2, + this->common.x + this->vrule_width + x, + this->common.y + this->common.height - this->label_height * 2 - 5); + sprintf(v, "%g", k * ticstep); + x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy); + + /* do not draw after the widget ('width-1' for if we use 'width' + * it is still off by 1 pixel for whatever reason) */ + px = this->vrule_width + x - vwidth/2; + if (px + vwidth > this->common.width-1) + px = this->common.width-1 - vwidth; + + x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR, + this->common.x + px, + this->common.y + this->common.height - this->label_height * 2 + + this->label_baseline, + v); + LOGD("tic k %d val %g x %d\n", k, k * ticstep, x); + } + + /* vertical tics */ + allocated_ymin = this->ymin; + allocated_ymax = this->ymax; + switch (this->tick_type) { + case XY_PLOT_DEFAULT_TICK: + pxsize = (this->ymax - this->ymin) / allocated_plot_height; + ticdist = 30; + tic = floor(log10(ticdist * pxsize)); + ticstep = powf(10, tic); + /* adjust tic if too tight */ + LOGD("pre y ticstep %g\n", ticstep); + while (1) { + if (ticstep / (allocated_ymax - allocated_ymin) + * (allocated_plot_height - 1) > 20) break; + ticstep *= 2; + } + LOGD("post y ticstep %g\n", ticstep); + LOGD("ymin/max %g %g height allocated %d alloc " + "ymin/max %g %g ticstep %g\n", this->ymin, this->ymax, + allocated_plot_height, allocated_ymin, allocated_ymax, ticstep); + kmin = ceil(allocated_ymin / ticstep); + kmax = floor(allocated_ymax / ticstep); + for (k = kmin; k <= kmax; k++) { + int y = (k * ticstep - allocated_ymin) / + (allocated_ymax - allocated_ymin) * + (allocated_plot_height - 1); + sprintf(v, "%g", k * ticstep); + x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy); + x_draw_line(g->x, g->xwin, FOREGROUND_COLOR, + this->common.x + this->vrule_width, + this->common.y + FLIP(y), + this->common.x + this->vrule_width + 5, + this->common.y + FLIP(y)); + x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR, + this->common.x + this->vrule_width - vwidth - 2, + this->common.y + FLIP(y)-this->label_height/2+this->label_baseline, + v); + } + break; + case XY_PLOT_SCROLL_TICK: + /* print only max value, formatted using 'bps' for readability */ + bps(v, this->ymax, ""); + x_text_get_dimensions(g->x, DEFAULT_FONT, v, &vwidth, &dummy, &dummy); + x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR, + this->common.x + this->vrule_width - vwidth - 2, + this->common.y + +this->label_baseline, + v); + /* vertically divide into 5 */ + for (k = 1; k < 5; k++) { + int y = round((k * (allocated_plot_height - 1)) / 5.); + x_draw_line(g->x, g->xwin, FOREGROUND_COLOR, + this->common.x + this->vrule_width, + this->common.y + y, + this->common.x + this->vrule_width + 5, + this->common.y + y); + } + break; + } /* swich (this->tick_type) */ + + /* label at bottom, in the middle */ + x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR, + this->common.x + (this->common.width - this->label_width) / 2, + this->common.y + this->common.height - this->label_height + + this->label_baseline, + this->label); + + for (n = 0; n < this->nplots; n++) { + /* points */ + float ax, bx, ay, by; + ax = (allocated_plot_width-1) / (allocated_xmax - allocated_xmin); + bx = -ax * allocated_xmin; + ay = (allocated_plot_height-1) / (allocated_ymax - allocated_ymin); + by = -ay * allocated_ymin; + for (i = 0; i < this->plots[n].npoints; i++) { + int x, y; + x = ax * this->plots[n].x[i] + bx; + y = ay * this->plots[n].y[i] + by; + if (x >= 0 && x < allocated_plot_width && + y >= 0 && y < allocated_plot_height) + x_add_point(g->x, + this->common.x + this->vrule_width + x, + this->common.y + FLIP(y)); + } + x_plot_points(g->x, g->xwin, this->plots[n].color); + } +} static void hints(gui *_gui, widget *_w, int *width, int *height) { @@ -191,6 +378,7 @@ widget *new_xy_plot(gui *_gui, int width, int height, char *label, w->ymax = 1; w->plots = NULL; w->nplots = 0; + w->tick_type = XY_PLOT_DEFAULT_TICK; w->common.paint = paint; w->common.hints = hints; @@ -309,3 +497,17 @@ void xy_plot_set_title(gui *_gui, widget *_this, char *label) gunlock(g); } + +void xy_plot_set_tick_type(gui *_gui, widget *_this, int type) +{ + struct gui *g = _gui; + struct xy_plot_widget *this = _this; + + glock(g); + + this->tick_type = type; + + send_event(g, DIRTY, this->common.id); + + gunlock(g); +} From 2270dae1e722d7410ba99ed29c7b17672504fae0 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 17:49:03 +0100 Subject: [PATCH 180/182] T: new view 'scolltti' This view is used to display throughput (to come in next commits). --- common/utils/T/tracer/view/Makefile | 2 +- common/utils/T/tracer/view/scrolltti.c | 100 +++++++++++++++++++++++++ common/utils/T/tracer/view/view.h | 2 + 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 common/utils/T/tracer/view/scrolltti.c diff --git a/common/utils/T/tracer/view/Makefile b/common/utils/T/tracer/view/Makefile index 32b267ec24..370c317e66 100644 --- a/common/utils/T/tracer/view/Makefile +++ b/common/utils/T/tracer/view/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-Wall -g -pthread -I.. -I../logger -OBJS=stdout.o textlist.o xy.o tti.o time.o ticktime.o +OBJS=stdout.o textlist.o xy.o tti.o time.o ticktime.o scrolltti.o view.a: $(OBJS) ar cr view.a $(OBJS) diff --git a/common/utils/T/tracer/view/scrolltti.c b/common/utils/T/tracer/view/scrolltti.c new file mode 100644 index 0000000000..ad83cbc756 --- /dev/null +++ b/common/utils/T/tracer/view/scrolltti.c @@ -0,0 +1,100 @@ +#include "view.h" +#include "../utils.h" +#include +#include +#include +#include +#include +#include + +struct scrolltti { + view common; + gui *g; + widget *w; + widget *throughput_textarea; + int plot; + float refresh_rate; + pthread_mutex_t lock; + unsigned long data[1000]; + unsigned long total; /* sum data[0..999] to have smoother value printed */ + float xout[1000]; + float yout[1000]; + int insert_point; +}; + +/* this array is used to get Y range 1000, 2000, 5000, 10000, ... */ +static int tolog[11] = { -1, 1, 2, 5, 5, 5, 10, 10, 10, 10, 10 }; + +static void *scrolltti_thread(void *_this) +{ + struct scrolltti *this = _this; + int i; + int p; + float max, mlog; + char o[64]; + + while (1) { + if (pthread_mutex_lock(&this->lock)) abort(); + /* TODO: optimize */ + p = this->insert_point; + max = 0; + for (i = 0; i < 1000; i++) { + this->xout[i] = i; + this->yout[i] = this->data[p]; + if (this->data[p] > max) max = this->data[p]; + p = (p + 1) % 1000; + } + bps(o, this->total/1000., "b/s"); + textarea_set_text(this->g, this->throughput_textarea, o); + /* for Y range we want 1000, 2000, 5000, 10000, 20000, 50000, etc. */ + if (max < 1000) max = 1000; + mlog = pow(10, floor(log10(max))); + max = tolog[(int)ceil(max/mlog)] * mlog; + xy_plot_set_range(this->g, this->w, 0, 1000, 0, max); + xy_plot_set_points(this->g, this->w, this->plot, + 1000, this->xout, this->yout); + if (pthread_mutex_unlock(&this->lock)) abort(); + sleepms(1000/this->refresh_rate); + } + + return 0; +} + +static void clear(view *this) +{ + /* TODO */ +} + +static void append(view *_this, int frame, int subframe, double value) +{ + struct scrolltti *this = (struct scrolltti *)_this; + + if (pthread_mutex_lock(&this->lock)) abort(); + this->total -= this->data[this->insert_point]; + this->data[this->insert_point] = value; + this->total += this->data[this->insert_point]; + this->insert_point = (this->insert_point + 1) % 1000; + if (pthread_mutex_unlock(&this->lock)) abort(); +} + +view *new_view_scrolltti(float refresh_rate, gui *g, widget *w, int color, + widget *throughput_textarea) +{ + struct scrolltti *ret = calloc(1, sizeof(struct scrolltti)); + if (ret == NULL) abort(); + + ret->common.clear = clear; + ret->common.append = (void (*)(view *, ...))append; + + ret->refresh_rate = refresh_rate; + ret->g = g; + ret->w = w; + ret->throughput_textarea = throughput_textarea; + ret->plot = xy_plot_new_plot(g, w, color); + + if (pthread_mutex_init(&ret->lock, NULL)) abort(); + + new_thread(scrolltti_thread, ret); + + return (view *)ret; +} diff --git a/common/utils/T/tracer/view/view.h b/common/utils/T/tracer/view/view.h index 2173c842ce..8167a00ccd 100644 --- a/common/utils/T/tracer/view/view.h +++ b/common/utils/T/tracer/view/view.h @@ -19,6 +19,8 @@ view *new_view_xy(int length, float refresh_rate, gui *g, widget *w, int color, enum xy_mode mode); view *new_view_tti(float refresh_rate, gui *g, widget *w, int color); +view *new_view_scrolltti(float refresh_rate, gui *g, widget *w, + int color, widget *throughput_label); view *new_view_time(int number_of_seconds, float refresh_rate, gui *g, widget *w); view *new_subview_time(view *time, int line, int color, int size); From 9a0f32aa1d0d1d28b6a206f6311bc37a7d9532a8 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Dec 2016 17:58:16 +0100 Subject: [PATCH 181/182] T: add 'throughputlog' logger Normally it is used to display throughput. The computation it does is to sum up the wanted value for the last second (1000 TTIs) and send this value to the views associated to this logger, at each TTI. --- common/utils/T/tracer/logger/Makefile | 2 +- common/utils/T/tracer/logger/logger.h | 3 + common/utils/T/tracer/logger/throughputlog.c | 194 +++++++++++++++++++ 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 common/utils/T/tracer/logger/throughputlog.c diff --git a/common/utils/T/tracer/logger/Makefile b/common/utils/T/tracer/logger/Makefile index 897c36e66f..28f0e0b813 100644 --- a/common/utils/T/tracer/logger/Makefile +++ b/common/utils/T/tracer/logger/Makefile @@ -2,7 +2,7 @@ CC=gcc CFLAGS=-Wall -g -pthread -I.. OBJS=logger.o textlog.o framelog.o ttilog.o timelog.o ticklog.o iqlog.o \ - iqdotlog.o ticked_ttilog.o + iqdotlog.o ticked_ttilog.o throughputlog.o logger.a: $(OBJS) ar cr logger.a $(OBJS) diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h index 70fe7cab1f..434cf5a90f 100644 --- a/common/utils/T/tracer/logger/logger.h +++ b/common/utils/T/tracer/logger/logger.h @@ -14,6 +14,9 @@ logger *new_ticked_ttilog(void *event_handler, void *database, char *tick_event_name, char *frame_varname, char *subframe_varname, char *event_name, char *data_varname, int convert_to_dB, float empty_value); +logger *new_throughputlog(void *event_handler, void *database, + char *tick_event_name, char *frame_varname, char *subframe_varname, + char *event_name, char *data_varname); logger *new_timelog(void *event_handler, void *database, char *event_name); logger *new_ticklog(void *event_handler, void *database, char *event_name, char *frame_name, char *subframe_name); diff --git a/common/utils/T/tracer/logger/throughputlog.c b/common/utils/T/tracer/logger/throughputlog.c new file mode 100644 index 0000000000..8a2d46da91 --- /dev/null +++ b/common/utils/T/tracer/logger/throughputlog.c @@ -0,0 +1,194 @@ +#include "logger.h" +#include "logger_defs.h" +#include "event.h" +#include "database.h" +#include "handler.h" +#include "filter/filter.h" +#include +#include +#include +#include + +struct throughputlog { + struct logger common; + void *database; + int tick_frame_arg; + int tick_subframe_arg; + int data_frame_arg; + int data_subframe_arg; + int data_arg; + int last_tick_frame; + int last_tick_subframe; + unsigned long bits[1000]; + unsigned long total; + int insert_point; + char *tick_event_name; + unsigned long tick_handler_id; + /* tick filter - NULL is no filter set */ + void *tick_filter; +}; + +static void _event(void *p, event e) +{ + struct throughputlog *l = p; + int frame; + int subframe; + unsigned long value; + + if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0) + return; + + frame = e.e[l->data_frame_arg].i; + subframe = e.e[l->data_subframe_arg].i; + + if (frame != l->last_tick_frame || subframe != l->last_tick_subframe) { + printf("WARNING: %s:%d: data comes without previous tick!\n", + __FILE__, __LINE__); + return; + } + + switch (e.e[l->data_arg].type) { + case EVENT_INT: value = e.e[l->data_arg].i; break; + case EVENT_ULONG: value = e.e[l->data_arg].ul; break; + default: printf("%s:%d: unsupported type\n", __FILE__, __LINE__); abort(); + } + + l->total += value; + l->bits[l->insert_point] += value; +} + +static void _tick_event(void *p, event e) +{ + struct throughputlog *l = p; + int i; + int frame; + int subframe; + + if (l->tick_filter != NULL && filter_eval(l->tick_filter, e) == 0) + return; + + frame = e.e[l->tick_frame_arg].i; + subframe = e.e[l->tick_subframe_arg].i; + + for (i = 0; i < l->common.vsize; i++) + l->common.v[i]->append(l->common.v[i], frame, subframe, (double)l->total); + + l->insert_point = (l->insert_point + 1) % 1000; + l->total -= l->bits[l->insert_point]; + l->bits[l->insert_point] = 0; + + l->last_tick_frame = frame; + l->last_tick_subframe = subframe; +} + +logger *new_throughputlog(event_handler *h, void *database, + char *tick_event_name, char *frame_varname, char *subframe_varname, + char *event_name, char *data_varname) +{ + struct throughputlog *ret; + int event_id; + database_event_format f; + int i; + + ret = calloc(1, sizeof(struct throughputlog)); if (ret == NULL) abort(); + + ret->common.event_name = strdup(event_name); + if (ret->common.event_name == NULL) abort(); + ret->database = database; + + ret->tick_event_name = strdup(tick_event_name); + if (ret->tick_event_name == NULL) abort(); + + /* tick event */ + event_id = event_id_from_name(database, tick_event_name); + + ret->tick_handler_id=register_handler_function(h,event_id,_tick_event,ret); + + f = get_format(database, event_id); + + /* look for frame and subframe */ + ret->tick_frame_arg = -1; + ret->tick_subframe_arg = -1; + for (i = 0; i < f.count; i++) { + if (!strcmp(f.name[i], frame_varname)) ret->tick_frame_arg = i; + if (!strcmp(f.name[i], subframe_varname)) ret->tick_subframe_arg = i; + } + if (ret->tick_frame_arg == -1) { + printf("%s:%d: frame argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, frame_varname, event_name); + abort(); + } + if (ret->tick_subframe_arg == -1) { + printf("%s:%d: subframe argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, subframe_varname, event_name); + abort(); + } + if (strcmp(f.type[ret->tick_frame_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, frame_varname); + abort(); + } + if (strcmp(f.type[ret->tick_subframe_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, subframe_varname); + abort(); + } + + /* data event */ + event_id = event_id_from_name(database, event_name); + + ret->common.handler_id = register_handler_function(h,event_id,_event,ret); + + f = get_format(database, event_id); + + /* look for frame, subframe and data args */ + ret->data_frame_arg = -1; + ret->data_subframe_arg = -1; + ret->data_arg = -1; + for (i = 0; i < f.count; i++) { + if (!strcmp(f.name[i], frame_varname)) ret->data_frame_arg = i; + if (!strcmp(f.name[i], subframe_varname)) ret->data_subframe_arg = i; + if (!strcmp(f.name[i], data_varname)) ret->data_arg = i; + } + if (ret->data_frame_arg == -1) { + printf("%s:%d: frame argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, frame_varname, event_name); + abort(); + } + if (ret->data_subframe_arg == -1) { + printf("%s:%d: subframe argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, subframe_varname, event_name); + abort(); + } + if (ret->data_arg == -1) { + printf("%s:%d: data argument '%s' not found in event '%s'\n", + __FILE__, __LINE__, data_varname, event_name); + abort(); + } + if (strcmp(f.type[ret->data_frame_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, frame_varname); + abort(); + } + if (strcmp(f.type[ret->data_subframe_arg], "int") != 0) { + printf("%s:%d: argument '%s' has wrong type (should be 'int')\n", + __FILE__, __LINE__, subframe_varname); + abort(); + } + if (strcmp(f.type[ret->data_arg], "int") != 0 && + strcmp(f.type[ret->data_arg], "float") != 0) { + printf("%s:%d: argument '%s' has wrong type" + " (should be 'int' or 'float')\n", + __FILE__, __LINE__, data_varname); + abort(); + } + + return ret; +} + +void throughputlog_set_tick_filter(logger *_l, void *filter) +{ + struct throughputlog *l = (struct throughputlog *)_l; + free(l->tick_filter); + l->tick_filter = filter; +} From 8def47c4881ab140d16d04faff815e3a95c345e7 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 5 Dec 2016 22:04:12 +0200 Subject: [PATCH 182/182] Changed old licenses in FlexRAN agent source files --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 48 ++++++++---------- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 48 ++++++++---------- .../MAC/flexran_agent_mac_defs.h | 48 ++++++++---------- .../MAC/flexran_agent_mac_internal.c | 48 ++++++++---------- .../MAC/flexran_agent_mac_internal.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent.h | 49 ++++++++----------- openair2/ENB_APP/flexran_agent_async.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_async.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_common.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_common.h | 48 ++++++++---------- .../ENB_APP/flexran_agent_common_internal.c | 48 ++++++++---------- .../ENB_APP/flexran_agent_common_internal.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_defs.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_extern.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_handler.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_net_comm.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_net_comm.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_task_manager.c | 47 ++++++++---------- openair2/ENB_APP/flexran_agent_task_manager.h | 47 ++++++++---------- openair2/LAYER2/MAC/flexran_agent_mac_proto.h | 48 ++++++++---------- .../MAC/flexran_agent_scheduler_dataplane.c | 48 ++++++++---------- .../MAC/flexran_agent_scheduler_dlsch_ue.c | 48 ++++++++---------- .../flexran_agent_scheduler_dlsch_ue_remote.c | 48 ++++++++---------- .../flexran_agent_scheduler_dlsch_ue_remote.h | 48 ++++++++---------- openair2/LAYER2/MAC/flexran_dci_conversions.h | 48 ++++++++---------- openair2/UTIL/ASYNC_IF/link_manager.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/link_manager.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/message_queue.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/message_queue.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/socket_link.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/socket_link.h | 47 ++++++++---------- 34 files changed, 680 insertions(+), 943 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 34b6ef345f..b9cad28278 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac.c * \brief FlexRAN agent message handler for MAC layer 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 fbb13ceca9..e2378e9311 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac.h * \brief FlexRAN agent message handler APIs for MAC layer diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h index e42847c371..bb6aed1d8e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_defs.h * \brief FlexRAN agent - mac interface primitives 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 04a90250eb..a63225e657 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 @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_internal.c * \brief Helper functions for the MAC agent diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index e7a922d503..9a7d4a8555 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_internal.h * \brief Implementation specific definitions for the FlexRAN MAC agent diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 8984e39971..beca1062bd 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent.h * \brief top level flexran agent receive thread and itti task diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h index beed4b9885..21ea21aafc 100644 --- a/openair2/ENB_APP/flexran_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -1,32 +1,23 @@ - -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent.h * \brief top level flexran agent diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index ae0273a668..978b44929d 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_async.c * \brief channel implementation for async interface diff --git a/openair2/ENB_APP/flexran_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h index 3e5c21463a..b097b15c25 100644 --- a/openair2/ENB_APP/flexran_agent_async.h +++ b/openair2/ENB_APP/flexran_agent_async.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_async.h * \brief channel implementation for async interface diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 00f938f4fb..2ccca6602b 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common.c * \brief common primitives for all agents diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index caa2eeb900..56a52cd0b6 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common.h * \brief common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index f35cd8666f..3026190863 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common_internal.c * \brief internal functions for common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h index 45f4a73ffb..c8f78aafe9 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.h +++ b/openair2/ENB_APP/flexran_agent_common_internal.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common_internal.h * \brief internal agent functions for common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 7da0487120..d60510b0c7 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_defs.h * \brief FlexRAN agent common definitions diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index 602b1d6ce3..3a03239e6f 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file ENB_APP/extern.h * \brief FlexRAN agent - mac interface primitives diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index c077827c66..4967e46923 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_handler.c * \brief FlexRAN agent tx and rx message handler diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index 986c819fb0..6e39d6089f 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_net_comm.c * \brief FlexRAN agent network interface abstraction diff --git a/openair2/ENB_APP/flexran_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h index ca26de7c16..e4aa854c70 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.h +++ b/openair2/ENB_APP/flexran_agent_net_comm.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_net_comm.h * \brief FlexRAN agent network interface abstraction diff --git a/openair2/ENB_APP/flexran_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c index e278386ba4..eaa6a58af8 100644 --- a/openair2/ENB_APP/flexran_agent_task_manager.c +++ b/openair2/ENB_APP/flexran_agent_task_manager.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 flexran_agent_task_manager.h * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas diff --git a/openair2/ENB_APP/flexran_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h index 9faa0e3db7..1b14f1f6f6 100644 --- a/openair2/ENB_APP/flexran_agent_task_manager.h +++ b/openair2/ENB_APP/flexran_agent_task_manager.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 flexran_agent_task_manager.h * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas diff --git a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h index 9e46e0904a..060e8ab6ca 100644 --- a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_proto.h * \brief MAC functions for FlexRAN agent diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c index aff196681e..6d3c32a516 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dataplane.c * \brief data plane procedures related to eNB scheduling diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index bc0187cd56..8975465e77 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c index 78b093c27d..7dec8d0c56 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue_remote.c * \brief procedures related to remote scheduling in the DLSCH transport channel diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h index 2cfad85771..7a02ff2f1d 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue_remote.h * \brief Local stub for remote scheduler used by the controller diff --git a/openair2/LAYER2/MAC/flexran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h index 038290d1b2..a417c39d20 100644 --- a/openair2/LAYER2/MAC/flexran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -1,31 +1,23 @@ -/******************************************************************************* - 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 . - - 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. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_dci_conversions.h * \brief Conversion helpers from flexran messages to OAI formats DCI diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 0ab2ecc2b2..1c9fb72bfe 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 4f0628c0ee..a25c072b41 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c index 3e06b5021a..ee6c92d852 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.c +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h index 15fc4335a1..4e46ec08d6 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c index 0d63e41431..047e3f716c 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h index 756a35ae4a..7dc4637404 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index f4bd248f78..720a55398c 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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 diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index c9e99b839f..5b9f438c8a 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - 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 . - - 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