very big merge with merged develop, basic test done
This commit is contained in:
@@ -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>
|
||||
@@ -93,52 +95,26 @@ link_manager_t *create_link_manager(
|
||||
socket_link_t *link)
|
||||
{
|
||||
link_manager_t *ret = NULL;
|
||||
pthread_attr_t attr;
|
||||
//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;
|
||||
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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ void pkt_list_display (Packet_OTG_List_t *listP) {
|
||||
|
||||
if (cursor) {
|
||||
while (cursor != NULL) {
|
||||
printf ("Pkt (DST %d, RB %d)\n", (cursor->otg_pkt).dst_id, (cursor->otg_pkt).rb_id);
|
||||
printf ("Pkt (DST %d, RB %ld)\n", (cursor->otg_pkt).dst_id, (cursor->otg_pkt).rb_id);
|
||||
//msg ("From (%d,%d) To (%d,%d)\n", (cursor->job).node1, (cursor->job).master1, (cursor->job).node2, (cursor->job).master2);
|
||||
cursor = cursor->next;
|
||||
nb_elements++;
|
||||
|
||||
@@ -52,7 +52,7 @@ inline unsigned int taus(unsigned int comp) {
|
||||
return r[comp];
|
||||
}
|
||||
|
||||
void set_taus_seed(unsigned int seed_type) {
|
||||
/*void set_taus_seed(unsigned int seed_type) {
|
||||
unsigned int i; // i index of component
|
||||
|
||||
for (i=MIN_NUM_COMPS; i < MAX_NUM_COMPS ; i ++) {
|
||||
@@ -79,7 +79,7 @@ void set_taus_seed(unsigned int seed_type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
int get_rand (unsigned int comp) {
|
||||
if ((comp > MIN_NUM_COMPS) && (comp < MAX_NUM_COMPS))
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
//typedef char bool;
|
||||
#include <stdbool.h>
|
||||
#include "omg_constants.h"
|
||||
|
||||
#ifdef STANDALONE
|
||||
typedef struct {
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct Geo {
|
||||
int node_type;
|
||||
int Neighbors; // number of neighboring nodes (distance between the node and its neighbors < 100)
|
||||
int Neighbor[NUMBER_OF_UE_MAX]; // array of its neighbors
|
||||
//relavent to UE only
|
||||
//relevant to UE only
|
||||
unsigned short state;
|
||||
unsigned short rnti;
|
||||
unsigned int connected_eNB;
|
||||
|
||||
@@ -49,7 +49,7 @@ This header file must be included */
|
||||
#ifndef project_include
|
||||
#define project_include
|
||||
#include "common/utils/LOG/log_if.h"
|
||||
#include "PHY/impl_defs_lte.h"
|
||||
#include "PHY/defs_RU.h"
|
||||
#endif
|
||||
|
||||
#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
|
||||
@@ -68,14 +68,14 @@ typedef guint8 gboolean;
|
||||
#define CONFIG_HLP_TYPEMON "Type of L2 monitoring messages: none,pcap,wireshark \n"
|
||||
#define CONFIG_HLP_L2MONIP "ip address for wireshark messages \n"
|
||||
#define CONFIG_HLP_L2MONPATH "file path for pcap messages on localhost \n"
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for LOG utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for LOG utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define OPT_PARAMS_DESC { \
|
||||
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
|
||||
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
|
||||
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
|
||||
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
|
||||
}
|
||||
|
||||
#define OPTTYPE_IDX 0
|
||||
@@ -106,7 +106,6 @@ typedef enum radio_type_e {
|
||||
} radio_type_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* function def
|
||||
*/
|
||||
|
||||
+10
-11
@@ -92,6 +92,7 @@ what about the implementation
|
||||
#include <stdint.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "opt.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;
|
||||
}
|
||||
@@ -341,7 +334,9 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
|
||||
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
||||
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||
const uint8_t *PDU, unsigned int length) {
|
||||
const uint8_t *PDU,
|
||||
unsigned int length)
|
||||
{
|
||||
pcaprec_hdr_t packet_header;
|
||||
uint8_t context_header[256];
|
||||
int offset = 0;
|
||||
@@ -386,6 +381,7 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||
fwrite(PDU, 1, length, file_fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include <common/ran_context.h>
|
||||
extern RAN_CONTEXT_t RC;
|
||||
#include <openair1/PHY/phy_extern_ue.h>
|
||||
@@ -446,7 +442,8 @@ void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int p
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------*/
|
||||
int init_opt(void) {
|
||||
int init_opt(void)
|
||||
{
|
||||
char *in_type=NULL;
|
||||
paramdef_t opt_params[] = OPT_PARAMS_DESC ;
|
||||
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
|
||||
@@ -454,6 +451,7 @@ int init_opt(void) {
|
||||
config_set_checkfunctions(opt_params, opt_checkParams,
|
||||
sizeof(opt_params)/sizeof(paramdef_t));
|
||||
config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||
|
||||
subframesSinceCaptureStart = 0;
|
||||
int tmptype = config_get_processedint( &(opt_params[OPTTYPE_IDX]));
|
||||
|
||||
@@ -533,6 +531,7 @@ int init_opt(void) {
|
||||
// memset(mac_info, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
||||
return (1);
|
||||
}
|
||||
|
||||
void terminate_opt(void) {
|
||||
/* Close local socket */
|
||||
// free(mac_info);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "otg_kpi.h"
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
FD_otg *form_dl, *form_ul;
|
||||
FL_FORM *fclock;
|
||||
|
||||
@@ -41,7 +41,7 @@ unsigned int start_log_jitter=0;
|
||||
#include"otg_externs.h"
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
void tx_throughput(int src, int dst, int application) {
|
||||
if (otg_info->tx_num_bytes[src][dst][application]>0) {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
//#include "LAYER2/MAC/extern.h"
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+11
-14
@@ -36,7 +36,7 @@
|
||||
#include "otg_externs.h"
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
|
||||
// char string for payload gen
|
||||
@@ -224,9 +224,9 @@ int size_dist(
|
||||
return size_data;
|
||||
}
|
||||
|
||||
|
||||
int adjust_size(int size)
|
||||
{
|
||||
|
||||
if (size<PAYLOAD_MIN) {
|
||||
LOG_W(OTG,"Packet Size=%d out of range, size=%d \n", size, PAYLOAD_MIN);
|
||||
size=PAYLOAD_MIN;
|
||||
@@ -239,9 +239,6 @@ int adjust_size(int size)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned char *packet_gen(
|
||||
const int src_instance,
|
||||
const int dst_instance,
|
||||
@@ -391,22 +388,20 @@ unsigned char *packet_gen(
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned char *packet_gen_multicast(
|
||||
const int src_instance,
|
||||
const int dst_instance,
|
||||
const int ctime,
|
||||
unsigned int * const pkt_size)
|
||||
{
|
||||
|
||||
*pkt_size =0;
|
||||
unsigned int size=0;
|
||||
unsigned int buffer_size =0;
|
||||
*pkt_size = 0;
|
||||
unsigned int size = 0;
|
||||
unsigned int buffer_size = 0;
|
||||
char *payload=NULL;
|
||||
char *header=NULL;
|
||||
unsigned int flag;
|
||||
int app,seq_num=0;
|
||||
int otg_hdr_size= sizeof(otg_hdr_info_t) + sizeof(otg_hdr_t);
|
||||
unsigned int flag = 0;
|
||||
int app, seq_num = 0;
|
||||
int otg_hdr_size = sizeof(otg_hdr_info_t) + sizeof(otg_hdr_t);
|
||||
|
||||
set_ctime(ctime); // fixme: this should be done separetly from packet_gen and packet_gen_multicast
|
||||
|
||||
@@ -488,7 +483,9 @@ unsigned char *packet_gen_multicast(
|
||||
payload,
|
||||
buffer_size,
|
||||
0/*g_otg_multicast->application_type[src_instance][dst][app]*/,
|
||||
flag, 0, ctime,
|
||||
flag,
|
||||
0,
|
||||
ctime,
|
||||
seq_num,
|
||||
0,
|
||||
HDR_IP_v4_MIN+HDR_UDP,
|
||||
|
||||
Reference in New Issue
Block a user