Merging test-x310, ci-dev-nr-add-gnb-nr-ur-uspr-testing and nr-mimo-mode-clean branches

This commit is contained in:
yilmazt
2019-05-20 21:32:34 +02:00
74 changed files with 6954 additions and 908 deletions
+1 -1
View File
@@ -30,7 +30,7 @@
#define RRC_CONFIG_TOOLS_H_
#define KHz (1000UL)
#define MHz (1000 * KHz)
#define MHz (1000*KHz)
typedef struct eutra_band_s {
int16_t band;
+1 -4
View File
@@ -51,14 +51,11 @@
#include "openair1/PHY/INIT/phy_init.h"
extern unsigned char NB_eNB_INST;
#include <nr-softmodem.h>
extern RAN_CONTEXT_t RC;
# define ENB_REGISTER_RETRY_DELAY 10
#include "targets/RT/USER/lte-softmodem.h"
/*------------------------------------------------------------------------------*/
+4 -39
View File
@@ -28,12 +28,12 @@
#define _GNU_SOURCE
#include "flexran_agent.h"
#include <common/utils/system.h>
#include <pthread.h>
#include <arpa/inet.h>
void *receive_thread(void *args);
pthread_t new_thread(void *(*f)(void *), void *b);
Protocol__FlexranMessage *flexran_agent_timeout(void* args);
@@ -147,38 +147,6 @@ error:
}
/* 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);
}
struct sched_param sched_param_recv_thread;
sched_param_recv_thread.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;
pthread_attr_setschedparam(&att, &sched_param_recv_thread);
pthread_attr_setschedpolicy(&att, SCHED_FIFO);
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 channel_container_init = 0;
int flexran_agent_start(mid_t mod_id)
{
@@ -235,12 +203,9 @@ int flexran_agent_start(mid_t mod_id)
*/
/*Initialize the continuous stats update mechanism*/
if (flexran_agent_init_cont_stats_update(mod_id) < 0) {
LOG_E(FLEXRAN_AGENT, "could not initialize continuous stats updates\n");
goto error;
}
new_thread(receive_thread, flexran);
flexran_agent_init_cont_stats_update(mod_id);
pthread_t t;
threadCreate(&t, receive_thread, flexran, "flexran", -1, OAI_PRIORITY_RT);
/* Register and initialize the control modules depending on capabilities.
* After registering, calling flexran_agent_get_*_xface() tells whether a
-1
View File
@@ -83,7 +83,6 @@ typedef struct {
uint64_t get_pdcp_optmask(void);
extern pthread_t pdcp_thread;
extern pthread_attr_t pdcp_thread_attr;
extern pthread_mutex_t pdcp_mutex;
extern pthread_cond_t pdcp_cond;
extern int pdcp_instance_cnt;
+2 -19
View File
@@ -96,8 +96,7 @@ pdcp_netlink_init(
int i;
int nb_inst_enb;
int nb_inst_ue;
pthread_attr_t attr;
struct sched_param sched_param;
reset_meas(&ip_pdcp_stats_tmp);
nb_inst_enb = 1;
nb_inst_ue = 1;
@@ -137,27 +136,11 @@ pdcp_netlink_init(
}
if ((nb_inst_ue + nb_inst_enb) > 0) {
if (pthread_attr_init(&attr) != 0) {
LOG_E(PDCP, "[NETLINK]Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
sched_param.sched_priority = 10;
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setschedparam(&attr, &sched_param);
/* Create one thread that fetchs packets from the netlink.
* When the netlink fifo is full, packets are silently dropped, this behaviour
* should be avoided if we want a reliable link.
*/
if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) {
LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" );
threadCreate(&pdcp_netlink_thread, pdcp_netlink_thread_fct, "PDCP netlink", -1, OAI_PRIORITY_RT_LOW );
}
return 0;
+1 -23
View File
@@ -45,7 +45,6 @@ extern int oai_exit;
extern char UE_flag;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_mutex_t pdcp_mutex;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
@@ -101,33 +100,12 @@ static void *pdcp_thread_main(void* param)
int init_pdcp_thread(void)
{
int error_code;
struct sched_param p;
pthread_attr_init (&pdcp_thread_attr);
pthread_attr_setstacksize(&pdcp_thread_attr,OPENAIR_THREAD_STACK_SIZE);
//attr_dlsch_threads.priority = 1;
p.sched_priority = OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&pdcp_thread_attr, &p);
pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
pthread_mutex_init(&pdcp_mutex,NULL);
pthread_cond_init(&pdcp_cond,NULL);
pdcp_instance_cnt = -1;
LOG_I(PDCP,"Allocating PDCP thread\n");
error_code = pthread_create(&pdcp_thread,
&pdcp_thread_attr,
pdcp_thread_main,
(void*)NULL);
if (error_code!= 0) {
LOG_I(PDCP,"Could not allocate PDCP thread, error %d\n",error_code);
return(error_code);
} else {
LOG_I(PDCP,"Allocate PDCP thread successful\n");
pthread_setname_np( pdcp_thread, "PDCP" );
}
threadCreate(&pdcp_thread, pdcp_thread_main, (void*)NULL, "PDCP", -1, OAI_PRIORITY_RT);
return(0);
}
@@ -40,8 +40,6 @@
#include "openair1/PHY/defs_RU.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#define MAX_NUM_DL_PDU 100
#define MAX_NUM_UL_PDU 100
#define MAX_NUM_HI_DCI0_PDU 100
+1 -1
View File
@@ -42,7 +42,7 @@
#include "rrc_types_NB_IoT.h"
#include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#include "openairinterface5g_limits.h"
#include "COMMON/mac_rrc_primitives.h"
+9 -30
View File
@@ -74,6 +74,7 @@
#include "pdcp.h"
#include "plmn_data.h"
#include "msc.h"
#include <common/utils/system.h>
#include "intertask_interface.h"
@@ -4953,7 +4954,6 @@ rrc_ue_process_sidelink_radioResourceConfig(
} else {
//SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_NOTHING, /* No components present */
}
break;
case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_release:
@@ -4972,58 +4972,37 @@ rrc_ue_process_sidelink_radioResourceConfig(
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//-----------------------------------------------------------
void
rrc_control_socket_init() {
void rrc_control_socket_init() {
struct sockaddr_in rrc_ctrl_socket_addr;
pthread_attr_t attr;
struct sched_param sched_param;
int optval; // flag value for setsockopt
//int n; // message byte size
// create the control socket
ctrl_sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (ctrl_sock_fd == -1) {
LOG_E(RRC,"[rrc_control_socket_init] :Error opening socket %d (%d:%s)\n",ctrl_sock_fd,errno, strerror(errno));
LOG_E(RRC,"[rrc_control_socket_init] :Error opening socket %d (%d:%s)\n", ctrl_sock_fd, errno, strerror(errno));
exit(EXIT_FAILURE);
}
// if (ctrl_sock_fd < 0)
// error("ERROR: Failed on opening socket");
optval = 1;
setsockopt(ctrl_sock_fd, SOL_SOCKET, SO_REUSEADDR,
(const void *)&optval, sizeof(int));
//build the server's address
setsockopt(ctrl_sock_fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval, sizeof(int));
//build the server's address
bzero((char *) &rrc_ctrl_socket_addr, sizeof(rrc_ctrl_socket_addr));
rrc_ctrl_socket_addr.sin_family = AF_INET;
rrc_ctrl_socket_addr.sin_addr.s_addr = htonl(INADDR_ANY);
rrc_ctrl_socket_addr.sin_port = htons(CONTROL_SOCKET_PORT_NO);
// associate the parent socket with a port
if (bind(ctrl_sock_fd, (struct sockaddr *) &rrc_ctrl_socket_addr,
sizeof(rrc_ctrl_socket_addr)) < 0) {
if (bind(ctrl_sock_fd, (struct sockaddr *) &rrc_ctrl_socket_addr, sizeof(rrc_ctrl_socket_addr)) < 0) {
LOG_E(RRC,"[rrc_control_socket_init] ERROR: Failed on binding the socket\n");
exit(1);
}
//create thread to listen to incoming packets
if (pthread_attr_init(&attr) != 0) {
LOG_E(RRC, "[rrc_control_socket_init]Failed to initialize pthread attribute for ProSe -> RRC communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
pthread_t rrc_control_socket_thread;
sched_param.sched_priority = 10;
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setschedparam(&attr, &sched_param);
pthread_t rrc_control_socket_thread;
if (pthread_create(&rrc_control_socket_thread, &attr, rrc_control_socket_thread_fct, NULL) != 0) {
LOG_E(RRC, "[rrc_control_socket_init]Failed to create new thread for RRC/ProSeApp communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
pthread_setname_np( rrc_control_socket_thread, "RRC Control Socket" );
threadCreate(&rrc_control_socket_thread, rrc_control_socket_thread_fct, NULL, "RRC/ProSeApp", -1, OAI_PRIORITY_RT);
}
//--------------------------------------------------------
+1 -2
View File
@@ -116,10 +116,9 @@ mui_t rrc_gNB_mui = 0;
void openair_nr_rrc_on(const protocol_ctxt_t* const ctxt_pP){
int CC_id;
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
+5 -29
View File
@@ -30,6 +30,8 @@
#include "link_manager.h"
#include "common/utils/LOG/log.h"
#include <common/utils/assertions.h>
#include <common/utils/system.h>
#include <stdio.h>
#include <stdlib.h>
@@ -98,47 +100,21 @@ link_manager_t *create_link_manager(
LOG_D(MAC, "create new link manager\n");
ret = calloc(1, sizeof(link_manager_t));
if (ret == NULL)
goto error;
AssertFatal( (ret=calloc(1, sizeof(link_manager_t))) != NULL,"");
ret->send_queue = send_queue;
ret->receive_queue = receive_queue;
ret->socket_link = link;
ret->run = 1;
if (pthread_attr_init(&attr))
goto error;
// Make the async interface threads real-time
//#ifndef LOWLATENCY
struct sched_param sched_param_recv_thread;
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_create(&t, &attr, link_manager_sender_thread, ret))
goto error;
threadCreate(&t, link_manager_sender_thread, ret, "flexranSender", -1, OAI_PRIORITY_RT_LOW);
ret->sender = t;
if (pthread_create(&t, &attr, link_manager_receiver_thread, ret))
/* we should destroy the other thread here */
goto error;
threadCreate(&t, link_manager_receiver_thread, ret, "flexranReceiver", -1, OAI_PRIORITY_RT_LOW);
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)
+1 -4
View File
@@ -90,10 +90,7 @@ int cli_server_init(cli_handler_t handler)
}
/* create telnet listener thread */
if (pthread_create(&cli_server_listener, NULL, cli_server_listen, NULL)) {
perror("thread");
return -1;
}
threadCreate(&cli_server_listener, cli_server_listen, NULL, "telnet", -1, OAI_PRIORITY_RT_LOW);
return 0;
}
+3 -10
View File
@@ -90,8 +90,9 @@ what about the implementation
#include <pthread.h>
#include <stdint.h>
#include "common/config/config_userapi.h"
#include "opt.h"
#include "common/config/config_userapi.h"
#include "common/utils/system.h"
int opt_enabled=0;
@@ -196,15 +197,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) {
return -1;
}
ret = pthread_create(&opt_listener.thread, NULL, opt_listener_thread, NULL);
if (ret != 0) {
LOG_E(OPT, "Failed to create thread for server socket: %s\n", strerror(errno));
opt_type = OPT_NONE;
close(opt_listener.sd);
opt_listener.sd = -1;
return -1;
}
threadCreate(&opt_listener.thread, opt_listener_thread, NULL, "flexran", -1, OAI_PRIORITY_RT_LOW);
return 0;
}
+1 -11
View File
@@ -195,17 +195,7 @@ void server_socket_tcp_ip4()
/* create new thread for the new connection */
if (pthread_create(&id, NULL, (void *)recv_ip4_tcp, (void*)csock))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_create OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_create \n");
if (pthread_detach(id))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_detach OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_detach\n");
threadCreate(&id, (void *)recv_ip4_tcp, (void*)csock), "OTG", -1, OAI_PRIORITY_RT_LOW);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Client n=%d finish transmission\n", cmpt_cl);
cmpt_cl+=1;
}