branch LG_PRE_RELEASE_0.3 reintegration

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7117 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Lionel Gauthier
2015-04-10 13:18:11 +00:00
parent 4f583e2053
commit 56c9000558
227 changed files with 11342 additions and 10069 deletions
+32 -21
View File
@@ -57,7 +57,7 @@ uint32_t counters[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
* initialize all ures
*/
void *
pool_buffer_init ()
pool_buffer_init (void)
{
//-----------------------------------------------------------------------------
@@ -189,20 +189,19 @@ free_mem_block (mem_block_t * leP)
//-----------------------------------------------------------------------------
mem_block_t *
get_free_mem_block (uint16_t sizeP)
get_free_mem_block (uint32_t sizeP)
{
//-----------------------------------------------------------------------------
mem_block_t *le = NULL;
int pool_selected;
int size;
// next block commented, because sizeP > MEM_MNGT_MB12_BLOCK_SIZE can never be true.
// if (sizeP > MEM_MNGT_MB12_BLOCK_SIZE) {
// msg ("[MEM_MNGT][ERROR][FATAL] size requested %d out of bounds\n", sizeP);
// display_mem_load ();
// mac_xface->macphy_exit("[MEM_MNGT][ERROR][FATAL] get_free_mem_block size requested out of bounds");
// return NULL;
// }
if (sizeP > MEM_MNGT_MB12_BLOCK_SIZE) {
msg ("[MEM_MNGT][ERROR][FATAL] size requested %d out of bounds\n", sizeP);
display_mem_load ();
mac_xface->macphy_exit("[MEM_MNGT][ERROR][FATAL] get_free_mem_block size requested out of bounds");
return NULL;
}
size = sizeP >> 6;
pool_selected = 0;
@@ -332,7 +331,8 @@ check_mem_area (void)
mb_index = MEM_MNGT_MB0_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB1_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool1[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID1)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool1[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID1)) {
msg ("[MEM] ERROR POOL1 block index %d\n", index);
}
}
@@ -340,7 +340,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB1_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB2_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool2[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID2)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool2[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID2)) {
msg ("[MEM] ERROR POOL2 block index %d\n", index);
}
}
@@ -348,7 +349,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB2_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB3_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool3[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID3)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool3[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID3)) {
msg ("[MEM] ERROR POOL3 block index %d\n", index);
}
}
@@ -356,7 +358,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB3_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB4_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool4[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID4)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool4[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID4)) {
msg ("[MEM] ERROR POOL4 block index %d\n", index);
}
}
@@ -364,7 +367,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB4_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB5_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool5[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID5)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool5[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID5)) {
msg ("[MEM] ERROR POOL5 block index %d\n", index);
}
}
@@ -372,7 +376,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB5_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB6_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool6[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID6)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool6[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID6)) {
msg ("[MEM] ERROR POOL6 block index %d\n", index);
}
}
@@ -380,7 +385,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB6_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB7_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool7[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID7)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool7[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID7)) {
msg ("[MEM] ERROR POOL7 block index %d\n", index);
}
}
@@ -388,7 +394,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB7_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB8_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool8[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID8)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool8[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID8)) {
msg ("[MEM] ERROR POOL8 block index %d\n", index);
}
}
@@ -396,7 +403,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB8_NB_BLOCKS;
for (index = 0; index < MEM_MNGT_MB9_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool9[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID9)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool9[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID9)) {
msg ("[MEM] ERROR POOL9 block index %d\n", index);
}
}
@@ -404,7 +412,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB9_NB_BLOCKS;
for (index = mb_index; index < MEM_MNGT_MB10_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool10[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID10)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool10[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID10)) {
msg ("[MEM] ERROR POOL10 block index %d\n", index);
}
}
@@ -412,7 +421,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB10_NB_BLOCKS;
for (index = mb_index; index < MEM_MNGT_MB11_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool11[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID11)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool11[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID11)) {
msg ("[MEM] ERROR POOL11 block index %d\n", index);
}
}
@@ -420,7 +430,8 @@ check_mem_area (void)
mb_index += MEM_MNGT_MB11_NB_BLOCKS;
for (index = mb_index; index < MEM_MNGT_MB12_NB_BLOCKS; index++) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool12[index][0])) && (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID12)) {
if ((memory->mem_blocks[mb_index + index].data != (unsigned char*)&(memory->mem_pool12[index][0]))
&& (memory->mem_blocks[mb_index + index].pool_id != MEM_MNGT_POOL_ID12)) {
msg ("[MEM] ERROR POOL12 block index %d\n", index);
}
}
+4 -1
View File
@@ -39,6 +39,9 @@
#ifndef __MEM_BLOCK_H__
# define __MEM_BLOCK_H__
#ifdef USER_MODE
#include <stdint.h>
#endif
#ifdef MEM_BLOCK_C
# define public_mem_block(x) x
# define private_mem_block(x) x
@@ -61,7 +64,7 @@ typedef struct mem_block_t {
public_mem_block(void *pool_buffer_init (void);)
public_mem_block(void *pool_buffer_clean (void *arg);)
public_mem_block(void free_mem_block (mem_block_t * leP);)
public_mem_block(mem_block_t *get_free_mem_block (unsigned short sizeP);)
public_mem_block(mem_block_t* get_free_mem_block (uint32_t sizeP);)
public_mem_block(mem_block_t *get_free_copy_mem_block (void);)
public_mem_block(mem_block_t *get_free_copy_mem_block_up (void);)
public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP);)
+10 -5
View File
@@ -450,29 +450,34 @@ check_free_mem_block (mem_block_t * leP)
if ((leP->data != &(mem->mem_pool4[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID4)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
}
} else if (block_index < MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS) {
} else if (block_index < MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS +
MEM_MNGT_MB5_NB_BLOCKS) {
if ((leP->data != &(mem->mem_pool5[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID5)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
}
} else if (block_index <
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS + MEM_MNGT_MB6_NB_BLOCKS) {
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS +
MEM_MNGT_MB6_NB_BLOCKS) {
if ((leP->data != &(mem->mem_pool6[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID6)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
}
} else if (block_index <
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS + MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS +
MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB7_NB_BLOCKS) {
if ((leP->data != &(mem->mem_pool7[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID7)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
}
} else if (block_index <
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS + MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS +
MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB7_NB_BLOCKS + MEM_MNGT_MB8_NB_BLOCKS) {
if ((leP->data != &(mem->mem_pool8[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID8)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
}
} else if (block_index <
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS + MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS +
MEM_MNGT_MB6_NB_BLOCKS +
MEM_MNGT_MB7_NB_BLOCKS + MEM_MNGT_MB8_NB_BLOCKS + MEM_MNGT_MB9_NB_BLOCKS) {
if ((leP->data != &(mem->mem_pool9[block_index][0])) && (leP->pool_id != MEM_MNGT_POOL_ID9)) {
msg ("[MEM][ERROR][FATAL] free mem block is corrupted\n");
-3
View File
@@ -232,9 +232,6 @@ int OCG_main(char is_local_server[FILENAME_LENGTH_MAX])
case STATE_GENERATE_REPORT :
if (create_dir_OK != MODULE_OK) {
// a temp folder is required when the output folder could not be correctly generated
//strcpy(output_dir, OPENAIR_TARGETS);
//strcat(output_dir, "SIMU/EXAMPLES/OSD/");
//strcat(output_dir, TEMP_OUTPUT_DIR);
strncpy(output_dir, OPENAIR_TARGETS, sizeof(output_dir));
output_dir[sizeof(output_dir) - 1] = 0; // terminate string
strncat(output_dir, "SIMU/EXAMPLES/OSD/", sizeof(output_dir) - strlen(output_dir) - 1);
+5
View File
@@ -726,6 +726,11 @@ typedef struct {
*/
unsigned char slot_isr;
int slot_sfd;
rnti_t eNB_ue_module_id_to_rnti[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled:
by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/
module_id_t eNB_ue_local_uid_to_ue_module_id[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled:
by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/
} Info;
/* @}*/
-4
View File
@@ -53,7 +53,6 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M
char directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
mode_t process_mask = umask(0);
//strcpy(directory, output_dir);
strncpy(directory, output_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX);
directory[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - 1] = 0; // terminate string
@@ -64,13 +63,10 @@ int create_dir(char output_dir[DIR_LENGTH_MAX], char user_name[FILENAME_LENGTH_M
LOG_I(OCG, "output_dir %s is created", directory);
}
//strcat(directory, user_name);
strncat(directory, user_name, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
mkdir(directory, S_IRWXU | S_IRWXG | S_IRWXO);
// strcat(directory, "/");
//strcat(directory, file_date);
strncat(directory, "/", FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
strncat(directory, file_date, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(directory) - 1);
-2
View File
@@ -95,8 +95,6 @@ int detect_file(char src_dir[DIR_LENGTH_MAX], char is_local_server[FILENAME_LENG
}
char check_src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX];
//strcpy(check_src_file, src_dir);
//strcat(check_src_file, filename);
strncpy(check_src_file, src_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX);
check_src_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - 1] = 0; // terminate string
strncat(check_src_file, filename, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(check_src_file) - 1);
-2
View File
@@ -55,8 +55,6 @@ int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_
// for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
//strcat(dst_file, dst_dir);
//strcat(dst_file, filename);
strncat(dst_file, dst_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);
strncat(dst_file, filename, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(dst_file) - 1);
-2
View File
@@ -1272,10 +1272,8 @@ void characters(void *user_data, const xmlChar *xmlch, int xmllen) // called o
} else if (trace_file_) {
oai_emulation.info.opt_enabled = 1;
// if (strcmp(strndup(ch, len), "wireshark") == 0) {
if (strncmp(ch, "wireshark", len) == 0) {
opt_type = OPT_WIRESHARK;
// } else if (strcmp(strndup(ch, len), "pcap") == 0) {
} else if (strncmp(ch, "pcap", len) == 0) {
opt_type = OPT_PCAP;
} else {
-4
View File
@@ -50,14 +50,12 @@
int parse_filename(char filename[FILENAME_LENGTH_MAX])
{
char *delim = "._";
//char *result;
char tmp_filename[FILENAME_LENGTH_MAX];
char *fd_tmp;
char *un_tmp;
char *ex_tmp;
//delim = "._";
// strcpy(tmp_filename, filename);
strncpy(tmp_filename, filename, FILENAME_LENGTH_MAX);
tmp_filename[FILENAME_LENGTH_MAX - 1] = 0; // terminate string
@@ -70,8 +68,6 @@ int parse_filename(char filename[FILENAME_LENGTH_MAX])
"Please use .xml file for configuration with the format \"user_name.file_date.xml\"\nfile_date = \"year month day hour minute second\" without space, \ne.g. 20100201193045 represents in the year 2010, February 1st, 19:30:45\n");
return MODULE_ERROR;
} else {
//strcpy(file_date, fd_tmp);
//strcpy(user_name, un_tmp);
strncpy(file_date, fd_tmp, sizeof(file_date));
file_date[sizeof(file_date) - 1] = 0; // terminate string
strncpy(user_name, un_tmp, sizeof(user_name));
-3
View File
@@ -55,12 +55,9 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename)
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
char XML_saving_dir[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX + 32] = "";
//strcpy(dst_file, output_dir);
strncpy(dst_file, output_dir, sizeof(dst_file));
dst_file[sizeof(dst_file) - 1] = 0; // terminate string
//strcat(dst_file, "SCENARIO/XML/");
//strcpy(XML_saving_dir, dst_file);
//strcat(dst_file, filename);
strncpy(XML_saving_dir, dst_file, sizeof(XML_saving_dir));
XML_saving_dir[sizeof(XML_saving_dir) - 1] = 0; // terminate string
strncat(dst_file, filename, sizeof(dst_file) - strlen(dst_file) - 1);
+3 -3
View File
@@ -1,4 +1,4 @@
include $(OPENAIR_HOME)/common/utils/Makefile.inc
include $(OPENAIR_DIR)/common/utils/Makefile.inc
LIB = -lxml2
TOP_DIR = ../..
@@ -18,8 +18,8 @@ ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif
ifdef NAS_NETLINK
CFLAGS += -DNAS_NETLINK -DLINUX -DDEBUG_CONTROL
ifdef PDCP_USE_NETLINK
CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
endif
CFLAGS += -DPHY_ABSTRACTION
+2 -2
View File
@@ -71,8 +71,8 @@ ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif
ifdef NAS_NETLINK
CFLAGS += -DNAS_NETLINK -DLINUX -DDEBUG_CONTROL
ifdef PDCP_USE_NETLINK
CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
endif
CFLAGS += -DPHY_ABSTRACTION
+2 -2
View File
@@ -73,8 +73,8 @@ ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif
ifdef NAS_NETLINK
CFLAGS += -DNAS_NETLINK -DLINUX -DDEBUG_CONTROL
ifdef PDCP_USE_NETLINK
CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
endif
CFLAGS += -DPHY_ABSTRACTION
-2
View File
@@ -196,8 +196,6 @@ storage * receiveExact()
storage* temp = writePacket(buf, NN);
free( buf );
return temp;
//return writePacket(buf, NN);
}
+88 -86
View File
@@ -25,18 +25,18 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
*******************************************************************************/
/*! \file otg_defs.h main used structures
* \brief otg structure
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
* \note
* \warning
*/
* \brief otg structure
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
* \note
* \warning
*/
#ifndef __OTG_DEFS_H__
# define __OTG_DEFS_H__
@@ -52,12 +52,12 @@
#include "otg_config.h"
/**
* \enum Application
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
* \enum Application
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
typedef enum {
NO_PREDEFINED_MULTICAST_TRAFFIC =0,
MSCBR,
@@ -70,12 +70,12 @@ typedef enum {
} Multicast_Application;
/**
* \enum Application
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
* \enum Application
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
typedef enum {
NO_PREDEFINED_TRAFFIC =0,
M2M, // 1
@@ -118,12 +118,12 @@ typedef enum {
/**
* \enum dist_type
* \brief OTG implemented distribution for packet and inter departure time computation
*
*
* dist_type presents the used distribition to generate inter departure time and packet size
*/
* \enum dist_type
* \brief OTG implemented distribution for packet and inter departure time computation
*
*
* dist_type presents the used distribition to generate inter departure time and packet size
*/
typedef enum {
NO_TRAFFIC=0,
@@ -144,12 +144,12 @@ typedef enum {
/**
* \enum trans_proto
*
* \brief trans_proto enmerates used transport protocol
*
*
*/
* \enum trans_proto
*
* \brief trans_proto enmerates used transport protocol
*
*
*/
typedef enum {
NO_PROTO=0,
@@ -159,11 +159,11 @@ typedef enum {
/**
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*
*/
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*
*/
typedef enum {
NO_IP=0,
IPV4=1,
@@ -171,11 +171,11 @@ typedef enum {
} ip_v;
/**
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*
*/
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*
*/
/*
typedef enum {
OFF_STATE=0,
@@ -183,7 +183,7 @@ typedef enum {
ACTIVE_STATE,
MAX_NUM_STATE,
}TRAFFIC_STATE;
*/
*/
typedef enum {
OFF_STATE=0,
@@ -198,11 +198,11 @@ typedef enum {
} VOIP_STATE;
/**
* \enum ALPHABET
*
*\brief ALPHABET Alphabet type to generate random string
*
*/
* \enum ALPHABET
*
*\brief ALPHABET Alphabet type to generate random string
*
*/
typedef enum {
REPEAT_STRING=0, // repeat the same set of characters
SUBSTRACT_STRING, // substract the string from the know character string
@@ -217,11 +217,11 @@ typedef enum {
/**
* \enum HEADER_TYPE
*
* \brief HEADER_TYPE alows to identify the transport protocol and IP version
*
*/
* \enum HEADER_TYPE
*
* \brief HEADER_TYPE alows to identify the transport protocol and IP version
*
*/
typedef enum {
NO_HEADER=0,
@@ -232,18 +232,18 @@ typedef enum {
} HEADER_TYPE;
/**
* \enum TRAFFIC_TYPE
*
* \brief HEADER_TYPE alows to identify the traffic type no specific type, m2m,etc.
*
*/
* \enum TRAFFIC_TYPE
*
* \brief HEADER_TYPE alows to identify the traffic type no specific type, m2m,etc.
*
*/
/*
typedef enum {
NO_TYPE=0,
M2M_TYPE,
}TRAFFIC_TYPE;
*/
*/
/*
@@ -339,11 +339,11 @@ typedef struct {
/**
* \struct otg_t
*
*\brief otg_t define the traffic generator global parameters, it include a matrix of nodes (source, destination and state) parameters
*
*/
* \struct otg_t
*
*\brief otg_t define the traffic generator global parameters, it include a matrix of nodes (source, destination and state) parameters
*
*/
typedef struct {
int max_nb_frames; /*!< \brief Max Number of frames*/
int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/
@@ -425,14 +425,16 @@ typedef struct {
typedef struct {
unsigned char flow_id; /*!< \brief It identify the flow ID (we can have source and destination with several flows) */
unsigned int time; /*!< \brief simulation time at the tx, this is ctime */
unsigned int seq_num; /*!< \brief Sequence Number, counter of data packets between tx and rx */
unsigned char state; /*!< \brief state of node : on, off, or active */
unsigned char hdr_type; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
unsigned char flow_id; /*!< \brief It identify the flow ID (we can have source and destination with several flows) */
unsigned int time; /*!< \brief simulation time at the tx, this is ctime */
unsigned int seq_num; /*!< \brief Sequence Number, counter of data packets between tx and rx */
unsigned char state; /*!< \brief state of node : on, off, or active */
unsigned char hdr_type; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
unsigned char src_instance; /*!< \brief traffic source instance */
unsigned char dst_instance; /*!< \brief traffic destination instance */
unsigned short pkts_size; /*!< \brief the size of payload + header */
unsigned short aggregation_level; /*!< \brief packet aggregation level */
unsigned int traffic_type; /*!< \brief to specify if it corresponds to an m2m traffic */
unsigned short aggregation_level;/*!< \brief packet aggregation level */
unsigned int traffic_type; /*!< \brief to specify if it corresponds to an m2m traffic */
//int payload_size; /*!< \brief the size of the payload to transmit */
//int header_size; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
} __attribute__((__packed__)) otg_hdr_t;
@@ -444,12 +446,12 @@ typedef struct {
/**
* \struct packet_t
*
* \brief packet_t corresponds to the global structure of the generated packet
*
*
*/
* \struct packet_t
*
* \brief packet_t corresponds to the global structure of the generated packet
*
*
*/
typedef struct {
@@ -500,11 +502,11 @@ typedef struct {
/**
* \struct packet_t
*
* \brief The OTG information and KPI of the simulation structure
*
*/
* \struct packet_t
*
* \brief The OTG information and KPI of the simulation structure
*
*/
typedef struct {
/*!< \brief info part: */
@@ -536,9 +538,9 @@ typedef struct {
float rx_owd_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_owd_history[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_jitter[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
float rx_jitter_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_jitter_avg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_jitter_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
+1
View File
@@ -43,6 +43,7 @@
#include "otg_models.h"
#include "UTIL/LOG/log.h"
double backgroundRateRnd(void);
/*all the TARMA stuff:
+247 -139
View File
@@ -25,18 +25,18 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
*******************************************************************************/
/*! \file otg_rx.c
* \brief function containing the OTG traffic generation functions
* \author Navid Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
* \note
* \warning
*/
* \brief function containing the OTG traffic generation functions
* \author Navid Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
* \note
* \warning
*/
#include "otg_rx.h"
#include "otg_externs.h"
@@ -61,23 +61,28 @@ extern unsigned char NB_UE_INST;
// Check if the packet is well received or not and extract data
int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const unsigned int size)
{
int bytes_read=0;
int bytes_read = 0;
otg_hdr_info_t * otg_hdr_info_rx;
otg_hdr_t * otg_hdr_rx;
int is_size_ok=0;
unsigned int seq_num_rx;
unsigned int nb_loss_pkts;
unsigned int lost_packet=0;
otg_hdr_t * otg_hdr_rx;
int is_size_ok = 0;
unsigned int seq_num_rx;
unsigned int nb_loss_pkts;
unsigned int lost_packet = 0;
unsigned int src_instance;
unsigned int dst_instance;
if (buffer_tx!=NULL) {
otg_hdr_info_rx = (otg_hdr_info_t *) (&buffer_tx[bytes_read]);
bytes_read += sizeof (otg_hdr_info_t);
LOG_D(OTG,"otg_rx_pkt functions: source %d, destination %d, size %d, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %d \n",
src,dst,size,otg_hdr_info_rx->flag,otg_hdr_info_rx->size);
LOG_D(OTG,"otg_rx_pkt functions: destination %d, size %d, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %d \n",
dst_instanceP,
size,
otg_hdr_info_rx->flag,
otg_hdr_info_rx->size);
if (((otg_hdr_info_rx->flag == 0xffff) ||
@@ -91,55 +96,79 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
if (( otg_hdr_info_rx->size ) == size ) {*/
is_size_ok= 1;
otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]);
LOG_I(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) \n", src, dst,otg_hdr_rx->flow_id,
otg_hdr_rx->traffic_type, ctime, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, otg_hdr_rx->time, otg_hdr_info_rx->size, size);
LOG_I(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) \n",
otg_hdr_rx->src_instance,
otg_hdr_rx->dst_instance,
otg_hdr_rx->flow_id,
otg_hdr_rx->traffic_type,
ctime,
otg_hdr_info_rx->flag,
otg_hdr_rx->seq_num,
otg_hdr_rx->time,
otg_hdr_info_rx->size, size);
bytes_read += sizeof (otg_hdr_t);
src_instance = otg_hdr_rx->src_instance;
dst_instance = otg_hdr_rx->dst_instance;
if (dst_instance != dst_instanceP) {
#warning "LG: TODO think about multicast traffic"
LOG_W(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) not for dest instance %u\n",
dst_instanceP);
}
if(otg_hdr_rx->traffic_type > MAX_NUM_APPLICATION) {
LOG_W(OTG,"RX packet: application type out of range %d for the pair of (src %d, dst %d) \n",
otg_hdr_rx->traffic_type, src, dst);
otg_hdr_rx->traffic_type, src_instance, dst_instance);
otg_hdr_rx->traffic_type=0;
}
/** unicast traffic **/
if (otg_hdr_info_rx->flag == 0xffff) {
seq_num_rx=otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type];
seq_num_rx=otg_info->seq_num_rx[src_instance][dst_instance][otg_hdr_rx->traffic_type];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
if (src_instance<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_dl[src_instance][dst_instance][otg_hdr_rx->traffic_type];
else
nb_loss_pkts=otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type];
nb_loss_pkts=otg_info->nb_loss_pkts_ul[src_instance][dst_instance][otg_hdr_rx->traffic_type];
} /** multicast traffic **/
else if (otg_hdr_info_rx->flag == 0x1000) {
seq_num_rx = otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type];
nb_loss_pkts = otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
// otg_multicast_info->ran_owd[src][dst][otg_hdr_rx->traffic_type] = ctime- otg_hdr_rx->time;
// rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts);
// otg_multicast_info->loss_rate[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
//otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
seq_num_rx = otg_multicast_info->rx_sn[src_instance][dst_instance][otg_hdr_rx->traffic_type];
nb_loss_pkts = otg_multicast_info->loss_pkts_dl[src_instance][dst_instance][otg_hdr_rx->traffic_type];
// otg_multicast_info->ran_owd[src_instance][dst_instance][otg_hdr_rx->traffic_type] = ctime- otg_hdr_rx->time;
// rx_check_loss(src_instance, dst_instance, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts);
// otg_multicast_info->loss_rate[src_instance][dst_instance][otg_hdr_rx->traffic_type]=nb_loss_pkts;
//otg_multicast_info->rx_sn[src_instance][dst_instance][otg_hdr_rx->traffic_type]=seq_num_rx;
LOG_I(OTG,"received a multicast packet with size %d sn %d ran owd %d loss rate %d\n",
otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts);
//return 0;
} /** background traffic **/
else {
seq_num_rx=otg_info->seq_num_rx_background[src][dst];
seq_num_rx=otg_info->seq_num_rx_background[src_instance][dst_instance];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_background_dl[src][dst];
if (src_instance<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_background_dl[src_instance][dst_instance];
else
nb_loss_pkts=otg_info->nb_loss_pkts_background_ul[src][dst];
nb_loss_pkts=otg_info->nb_loss_pkts_background_ul[src_instance][dst_instance];
}
LOG_D(OTG,"[%d][%d] AGGREGATION LEVEL (RX) %d \n", src, dst, otg_hdr_rx->aggregation_level);
otg_info->aggregation_level[src][dst]=otg_hdr_rx->aggregation_level;
LOG_D(OTG,"[%d][%d] AGGREGATION LEVEL (RX) %d \n", src_instance, dst_instance, otg_hdr_rx->aggregation_level);
otg_info->aggregation_level[src_instance][dst_instance]=otg_hdr_rx->aggregation_level;
/* Loss and out of sequence data management */
lost_packet= rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts);
lost_packet= rx_check_loss(
src_instance,
dst_instance,
otg_hdr_info_rx->flag,
otg_hdr_rx->seq_num,
&seq_num_rx,
&nb_loss_pkts);
if (otg_info->owd_const[src][dst][otg_hdr_rx->flow_id]==0)
owd_const_gen(src,dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type);
if (otg_info->owd_const[src_instance][dst_instance][otg_hdr_rx->flow_id]==0)
owd_const_gen(src_instance,dst_instance,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type);
/******/
@@ -149,128 +178,185 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
float owd_const_IP_backbone_v=owd_const_IP_backbone()/2;
float owd_const_application_v=owd_const_application()/2;
FILE *file;
file = fopen("/tmp/log_latency_m2m.txt", "a");
fprintf(file," %d %d [%d] [%d] %.2f %.2f %.2f %.2f %.2f %.2f\n", otg_hdr_rx->time, otg_hdr_info_rx->size, src, dst, owd_const_capillary_v,otg_info->radio_access_delay[src][dst],owd_const_mobile_core_v, owd_const_IP_backbone_v, owd_const_application_v, owd_const_capillary_v + otg_info->radio_access_delay[src][dst]+owd_const_mobile_core_v + owd_const_IP_backbone_v+ owd_const_application_v);
fclose(file);
*/
FILE *file;
file = fopen("/tmp/log_latency_m2m.txt", "a");
fprintf(file," %d %d [%d] [%d] %.2f %.2f %.2f %.2f %.2f %.2f\n", otg_hdr_rx->time, otg_hdr_info_rx->size, src, dst, owd_const_capillary_v,otg_info->radio_access_delay[src][dst],owd_const_mobile_core_v, owd_const_IP_backbone_v, owd_const_application_v, owd_const_capillary_v + otg_info->radio_access_delay[src][dst]+owd_const_mobile_core_v + owd_const_IP_backbone_v+ owd_const_application_v);
fclose(file);
*/
/******/
// }
if (otg_hdr_rx->time<=ctime) {
otg_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
otg_multicast_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
otg_info->radio_access_delay[src_instance][dst_instance]=(float) (ctime- otg_hdr_rx->time);
otg_multicast_info->radio_access_delay[src_instance][dst_instance]=(float) (ctime- otg_hdr_rx->time);
} else {
LOG_N(OTG,"received packet has tx time %d greater than the current time %d\n",otg_hdr_rx->time,ctime );
otg_info->radio_access_delay[src][dst] = 0;
otg_multicast_info->radio_access_delay[src][dst]=0;
otg_info->radio_access_delay[src_instance][dst_instance] = 0;
otg_multicast_info->radio_access_delay[src_instance][dst_instance]=0;
}
/* actual radio OWD*/
otg_info->rx_pkt_owd[src][dst]=otg_info->radio_access_delay[src][dst];
otg_info->rx_pkt_owd[src_instance][dst_instance]=otg_info->radio_access_delay[src_instance][dst_instance];
/* estimated E2E OWD based on the emulated delays for the other part of the network */
otg_info->rx_pkt_owd_e2e[src][dst]=otg_info->owd_const[src][dst][otg_hdr_rx->flow_id] + otg_info->radio_access_delay[src][dst];
otg_multicast_info->rx_pkt_owd[src][dst]=otg_multicast_info->radio_access_delay[src][dst];
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance]=
otg_info->owd_const[src_instance][dst_instance][otg_hdr_rx->flow_id] + otg_info->radio_access_delay[src_instance][dst_instance];
otg_multicast_info->rx_pkt_owd[src_instance][dst_instance]=otg_multicast_info->radio_access_delay[src_instance][dst_instance];
LOG_D(OTG, "[src %d][dst %d] ctime %d tx time %d: OWD %lf E2E OWD %lf \n", src, dst, ctime, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], otg_info->rx_pkt_owd_e2e[src][dst] );
LOG_D(OTG, "[src %d][dst %d] ctime %d tx time %d: OWD %lf E2E OWD %lf \n",
src_instance,
dst_instance,
ctime,
otg_hdr_rx->time,
otg_info->rx_pkt_owd[src_instance][dst_instance],
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance] );
// compute the jitter by ignoring the packet loss
if (lost_packet == 0) {
// radio access
otg_info->rx_pkt_owd_history[src][dst][1] = otg_info->rx_pkt_owd_history[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history[src][dst][0] = otg_info->rx_pkt_owd[src][dst]; // the current owd
otg_info->rx_pkt_owd_history[src_instance][dst_instance][1] = otg_info->rx_pkt_owd_history[src_instance][dst_instance][0]; // the previous owd
otg_info->rx_pkt_owd_history[src_instance][dst_instance][0] = otg_info->rx_pkt_owd[src_instance][dst_instance]; // the current owd
if (otg_info->rx_pkt_owd_history[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter[src][dst]=0;
if (otg_info->rx_pkt_owd_history[src_instance][dst_instance][1] == 0) // first packet
otg_info->rx_pkt_jitter[src_instance][dst_instance]=0;
else // for the consecutive packets
otg_info->rx_pkt_jitter[src][dst] = fabsf(otg_info->rx_pkt_owd_history[src][dst][0] - otg_info->rx_pkt_owd_history[src][dst][1]);
otg_info->rx_pkt_jitter[src_instance][dst_instance]=
abs(otg_info->rx_pkt_owd_history[src_instance][dst_instance][0] - otg_info->rx_pkt_owd_history[src_instance][dst_instance][1]);
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter[src][dst],
otg_info->rx_pkt_owd_history[src][dst][0], otg_info->rx_pkt_owd_history[src][dst][1]);
src_instance, dst_instance, ctime, otg_info->rx_pkt_jitter[src_instance][dst_instance],
otg_info->rx_pkt_owd_history[src_instance][dst_instance][0], otg_info->rx_pkt_owd_history[src_instance][dst_instance][1]);
// e2e
otg_info->rx_pkt_owd_history_e2e[src][dst][1] = otg_info->rx_pkt_owd_history_e2e[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history_e2e[src][dst][0] = otg_info->rx_pkt_owd_e2e[src][dst]; // the current owd
otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][1] = otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][0]; // the previous owd
otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][0] = otg_info->rx_pkt_owd_e2e[src_instance][dst_instance]; // the current owd
if (otg_info->rx_pkt_owd_history_e2e[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter_e2e[src][dst]=0;
if (otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][1] == 0) // first packet
otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance]=0;
else // for the consecutive packets
otg_info->rx_pkt_jitter_e2e[src][dst]= fabsf(otg_info->rx_pkt_owd_history_e2e[src][dst][0] - otg_info->rx_pkt_owd_history_e2e[src][dst][1]);
otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance]=
abs(otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][0] - otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][1]);
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter_e2e[src][dst],
otg_info->rx_pkt_owd_history_e2e[src][dst][0], otg_info->rx_pkt_owd_history_e2e[src][dst][1]);
src_instance,
dst_instance,
ctime,
otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance],
otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][0],
otg_info->rx_pkt_owd_history_e2e[src_instance][dst_instance][1]);
}
if (otg_hdr_info_rx->flag == 0x1000) {
LOG_I(OTG,"[SRC%d -> DST %d] Received a multicast packet at time %d with size %d, seq num %d, ran owd %d number loss packet %d\n",
dst, src, ctime,otg_hdr_info_rx->size, otg_hdr_rx->seq_num, ctime - otg_hdr_rx->time, nb_loss_pkts);
src_instance,
dst_instance,
ctime,otg_hdr_info_rx->size,
otg_hdr_rx->seq_num,
ctime - otg_hdr_rx->time,
nb_loss_pkts);
LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n",
src, dst, otg_multicast_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_multicast_info->rx_pkt_owd[src][dst]);
src_instance,
dst_instance,
otg_multicast_info->radio_access_delay[src_instance][dst_instance],
otg_hdr_rx->time, ctime ,
otg_multicast_info->rx_pkt_owd[src_instance][dst_instance]);
if (otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
if (otg_multicast_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]==0) {
otg_multicast_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src_instance][dst_instance];
otg_multicast_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src_instance][dst_instance];
} else {
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
otg_multicast_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MAX(
otg_multicast_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_multicast_info->rx_pkt_owd[src_instance][dst_instance] );
otg_multicast_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MIN(
otg_multicast_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_multicast_info->rx_pkt_owd[src_instance][dst_instance] );
}
if (g_otg->curve==1) {
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_multicast_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
add_tab_metric(
src_instance,
dst_instance,
otg_multicast_info->rx_pkt_owd[src_instance][dst_instance],
((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_multicast_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
add_tab_metric(src_instance,
dst_instance,
otg_multicast_info->radio_access_delay[src_instance][dst_instance],
((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
otg_hdr_rx->time);
}
otg_multicast_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
} else {
LOG_I(OTG,"[SRC %d][DST %d] Stats :: radio access latency %.2f (tx time %d, ctime %d) jitter %.2f, Estimated E2E OWD:%.2f (ms):\n",
src, dst, otg_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_info->rx_pkt_jitter[src][dst], otg_info->rx_pkt_owd_e2e[src][dst]);
src_instance,
dst_instance,
otg_info->radio_access_delay[src_instance][dst_instance],
otg_hdr_rx->time, ctime ,
otg_info->rx_pkt_jitter[src_instance][dst_instance],
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance]);
if (otg_hdr_info_rx->flag == 0xffff) {
if (otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
if (otg_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src_instance][dst_instance];
otg_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src_instance][dst_instance];
otg_info->rx_owd_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src_instance][dst_instance];
otg_info->rx_owd_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src_instance][dst_instance];
} else {
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
otg_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_owd[src_instance][dst_instance] );
otg_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_owd[src_instance][dst_instance] );
otg_info->rx_owd_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance] );
otg_info->rx_owd_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance] );
}
if (otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
if (otg_info->rx_jitter_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_jitter_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src_instance][dst_instance];
otg_info->rx_jitter_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src_instance][dst_instance];
otg_info->rx_jitter_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance];
otg_info->rx_jitter_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance];
} else if (lost_packet==0) {
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
otg_info->rx_jitter_max[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_jitter[src_instance][dst_instance] );
otg_info->rx_jitter_min[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_jitter[src_instance][dst_instance] );
otg_info->rx_jitter_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance] );
otg_info->rx_jitter_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type],
otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance] );
// avg jitter
otg_info->rx_jitter_avg[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_avg_e2e[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_sample[src][dst][otg_hdr_rx->traffic_type] +=1;
otg_info->rx_jitter_avg[src_instance][dst_instance][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src_instance][dst_instance];
otg_info->rx_jitter_avg_e2e[src_instance][dst_instance][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance];
otg_info->rx_jitter_sample[src_instance][dst_instance][otg_hdr_rx->traffic_type] +=1;
}
}
if (g_otg->curve==1) {
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
add_tab_metric(
src_instance,
dst_instance,
otg_info->rx_pkt_owd[src_instance][dst_instance],
((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
add_tab_metric(
src_instance,
dst_instance, otg_info->radio_access_delay[src_instance][dst_instance],
((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
otg_hdr_rx->time);
}
if (src<NB_eNB_INST)
if (src_instance<NB_eNB_INST)
otg_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
else
otg_info->rx_total_bytes_ul+=otg_hdr_info_rx->size;
@@ -283,85 +369,97 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
//printf("payload_size %d, header_size %d \n", otg_hdr_rx->pkts_size, otg_hdr_rx->hdr_type);
LOG_I(OTG,"[RX] OTG packet, PACKET SIZE [SRC %d][DST %d]: Flag (0x%x), Traffic %d, time(%d), Seq num (%d), Total size (%d)\n",
src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->traffic_type, ctime, otg_hdr_rx->seq_num, size);
src_instance,
dst_instance,
otg_hdr_info_rx->flag,
otg_hdr_rx->traffic_type,
ctime,
otg_hdr_rx->seq_num, size);
/*LOG_I(OTG,"details::RX [SRC %d][DST %d]: Flag (0x%x), time(%d), Seq num (%d), Total size (%d), header(%d), payload (%d) \n", src, dst, otg_hdr_info_rx->flag, ctime, otg_hdr_rx->seq_num, size, strlen(packet_rx->header), strlen(packet_rx->payload));*/
if (otg_hdr_info_rx->flag == 0xffff) {
otg_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
otg_info->rx_num_pkt[src_instance][dst_instance][otg_hdr_rx->traffic_type]+=1;
otg_info->rx_num_bytes[src_instance][dst_instance][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx[src_instance][dst_instance][otg_hdr_rx->traffic_type]=seq_num_rx;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
if (src_instance<NB_eNB_INST)
otg_info->nb_loss_pkts_dl[src_instance][dst_instance][otg_hdr_rx->traffic_type]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
otg_info->nb_loss_pkts_ul[src_instance][dst_instance][otg_hdr_rx->traffic_type]=nb_loss_pkts;
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0) {
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter_e2e[src][dst], OTG_JITTER);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->rx_pkt_owd[src_instance][dst_instance], OTG_LATENCY);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->rx_pkt_jitter_e2e[src_instance][dst_instance], OTG_JITTER);
} else {
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src][dst], OTG_JITTER);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->radio_access_delay[src_instance][dst_instance], OTG_LATENCY);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src_instance][dst_instance], OTG_JITTER);
}
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
add_log_metric(src_instance,
dst_instance,
otg_hdr_rx->time,
((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
OTG_GP); /* compute the throughput in Kbit/s */
} else if (otg_hdr_info_rx->flag == 0x1000) {
otg_multicast_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
otg_multicast_info->rx_num_pkt[src_instance][dst_instance][otg_hdr_rx->traffic_type]+=1;
otg_multicast_info->rx_num_bytes[src_instance][dst_instance][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
// LOG_D(OTG,"DUY: otg_multicast_info->rx_num_bytes[%d][%d][%d] is %d \nn",src,dst,otg_hdr_rx->traffic_type,otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]);
otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
otg_multicast_info->rx_sn[src_instance][dst_instance][otg_hdr_rx->traffic_type]=seq_num_rx;
otg_multicast_info->loss_pkts_dl[src_instance][dst_instance][otg_hdr_rx->traffic_type]=nb_loss_pkts;
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src][dst], OTG_LATENCY);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src_instance][dst_instance], OTG_LATENCY);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src][dst], OTG_LATENCY);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src_instance][dst_instance], OTG_LATENCY);
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src_instance][dst_instance]*1024 )),
OTG_GP); /* compute the throughput in Kbit/s */
} else {
otg_info->rx_num_pkt_background[src][dst]+=1;
otg_info->rx_num_bytes_background[src][dst]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx_background[src][dst]=seq_num_rx;
otg_info->rx_num_pkt_background[src_instance][dst_instance]+=1;
otg_info->rx_num_bytes_background[src_instance][dst_instance]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx_background[src_instance][dst_instance]=seq_num_rx;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_background_dl[src][dst]=nb_loss_pkts;
if (src_instance<NB_eNB_INST)
otg_info->nb_loss_pkts_background_dl[src_instance][dst_instance]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_background_ul[src][dst]=nb_loss_pkts;
otg_info->nb_loss_pkts_background_ul[src_instance][dst_instance]=nb_loss_pkts;
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY_BG);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->rx_pkt_owd[src_instance][dst_instance], OTG_LATENCY_BG);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY_BG);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, otg_info->radio_access_delay[src_instance][dst_instance], OTG_LATENCY_BG);
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP_BG);
add_log_metric(src_instance, dst_instance, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src_instance][dst_instance]*1024 )), OTG_GP_BG);
}
if (is_size_ok == 0) {
otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]);
LOG_W(OTG,"[SRC %d][DST %d] RX pkt: seq number %d size mis-matche (hdr %d, pdcp %d) \n", src, dst, otg_hdr_rx->seq_num, otg_hdr_info_rx->size, size);
otg_info->nb_loss_pkts_otg[src][dst]++;
LOG_W(OTG,"[SRC %d][DST %d] RX pkt: seq number %d size mis-matche (hdr %d, pdcp %d) \n",
src_instance, dst_instance, otg_hdr_rx->seq_num, otg_hdr_info_rx->size, size);
otg_info->nb_loss_pkts_otg[src_instance][dst_instance]++;
}
return(0);
} else {
LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %d, pdcp_size %d) FIX ME \n", otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size);
LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %d, pdcp_size %d) FIX ME \n",
otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size);
return(0); //to be fixed on the real case to one
}
@@ -373,7 +471,13 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts)
int rx_check_loss(
const int src,
const int dst,
const unsigned int flag,
const int seq_num,
unsigned int * const seq_num_rx,
unsigned int * const nb_loss_pkts)
{
/* Loss and out of sequence data management, we have 3 case : */
@@ -406,7 +510,11 @@ int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int
void owd_const_gen(int src, int dst, int flow_id, unsigned int flag)
void owd_const_gen(
const int src,
const int dst,
const int flow_id,
const unsigned int flag)
{
otg_info->owd_const[src][dst][flow_id]=(owd_const_mobile_core()+owd_const_IP_backbone()+owd_const_application())/2;
@@ -423,9 +531,9 @@ void owd_const_gen(int src, int dst, int flow_id, unsigned int flag)
float owd_const_capillary(void)
{
/*return (uniform_dist(MIN_APPLICATION_PROCESSING_GATEWAY_DELAY, MAX_APPLICATION_PROCESSING_GATEWAY_DELAY) +
uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) +
uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) +
TERMINAL_ACCESS_DELAY);*/
uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) +
uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) +
TERMINAL_ACCESS_DELAY);*/
return ((double)MIN_APPLICATION_PROCESSING_GATEWAY_DELAY+ (double)MAX_APPLICATION_PROCESSING_GATEWAY_DELAY + (double)MIN_FORMATING_TRANSFERRING_DELAY+ (double)MAX_FORMATING_TRANSFERRING_DELAY+
(double)MIN_ACCESS_DELAY+(double)MAX_ACCESS_DELAY) /2 + (double)TERMINAL_ACCESS_DELAY;
}
@@ -442,7 +550,7 @@ float owd_const_mobile_core(void)
// in this case, according to the fit in the paper,
// the delay is generalized pareto: GP(k=0.75,s=0.55,t=1.2)
// using inverse cdf method we have CDF(x)=1-(k(x-t)/s+1)^(-1/k),
// x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t)
// x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t)
double k,s,t,u;
k=0.75;
+13 -6
View File
@@ -53,16 +53,17 @@
/*! \fn char *check_packet(int src, int dst, int ctime);
/*! \fn int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const unsigned int size);
* \brief check if the packet is well received and do measurements: one way delay, throughput,etc.
* \param[in] the source
* \param[in] the destination
* \param[in] time of the emulation
* \param[in] The packet
* \param[in] Size of the packet
* \param[out] return NULL is the packet is well received, else the packet to forward
* \note
* @ingroup _otg
*/
int otg_rx_pkt(int src, int dst, int ctime, char *packet, unsigned int size);
int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const unsigned int size);
/*! \fn void owd_const_gen(int src,int dst);
@@ -73,7 +74,7 @@ int otg_rx_pkt(int src, int dst, int ctime, char *packet, unsigned int size);
*\note
*@ingroup _otg
*/
void owd_const_gen(int src,int dst, int flow_id, unsigned int flag);
void owd_const_gen(const int src, const int dst, const int flow_id, const unsigned int flag);
/*! \fn float owd_const_capillary();
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
@@ -108,7 +109,7 @@ float owd_const_IP_backbone(void);
float owd_const_application(void);
/*! \fn void rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts);
/*! \fn void rx_check_loss(const int src, const int dst, const unsigned int flag, const int seq_num, unsigned int * const seq_num_rx, unsigned int * const nb_loss_pkts);
*\brief check the number of loss packet/out of sequence
*\param[in] src
*\param[in] dst
@@ -120,6 +121,12 @@ float owd_const_application(void);
*\note
*@ingroup _otg
*/
int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts);
int rx_check_loss(
const int src,
const int dst,
const unsigned int flag,
const int seq_num,
unsigned int * const seq_num_rx,
unsigned int * const nb_loss_pkts);
#endif
+621 -427
View File
File diff suppressed because it is too large Load Diff
+61 -32
View File
@@ -54,25 +54,33 @@
//#include "COMMON/platform_constants.h"
/*! \fn int time_dist(int src, int dst, int state)
/*! \fn int time_dist(const int src, const int dst, const int state)
* \brief compute Inter Departure Time, in ms
* \param[in] Source, destination, state
* \param[out] Inter Departure Time
* \note
* @ingroup _otg
*/
int time_dist(int src, int dst, int application, int state);
int time_dist(
const int src_instance,
const int dst_instance,
const int application,
const int state);
/*! \fn int size_dist(int src, int dst, int state)
/*! \fn int size_dist(const int src, const int dst, const int state)
* \brief compute the payload size, in bytes
* \param[in] Source, node_dst, state
* \param[out] size of the payload, in bytes
* \note
* @ingroup _otg
*/
int size_dist(int src, int dst, int application, int state);
int size_dist(
const int src_instance,
const int dst_instance,
const int application,
const int state);
/*! \fn char *random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
/*! \fn char *random_string(const int size, const ALPHABET_GEN mode, const ALPHABET_TYPE data_type);
* \brief return a random string[size]
* \param[in] size of the string to generate,
* \param[in] ALPHABET_GEN : static or random string
@@ -81,10 +89,9 @@ int size_dist(int src, int dst, int application, int state);
* \note
* @ingroup _otg
*/
char * random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
//char *random_string(int size, ALPHABET data_type, char *data_string);
char * random_string(const int size, const ALPHABET_GEN mode, const ALPHABET_TYPE data_type);
/*! \fn int packet_gen(int src, int dst, int state, int ctime)
/*! \fn int packet_gen(const int src, const int dst, const int state, const int ctime)
* \brief return int= 1 if the packet is generated: OTG header + header + payload, else 0
* \param[in] src source identity
* \param[in] dst destination id
@@ -94,41 +101,49 @@ char * random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
* \note
* @ingroup _otg
*/
unsigned char *packet_gen(int src, int dst, int app, int ctime, unsigned int *pkt_size);
unsigned char *packet_gen(
const int src_instance,
const int dst_instance,
const int app,
const int ctime,
unsigned int * const pkt_size);
/*! \fn int packet_gen(int src, int dst, int state, int ctime)
/*! \fn unsigned char * packet_gen_multicast(const int src, const int dst, const int ctime, unsigned int * const pkt_size)
* \brief return int= 1 if the packet is generated: OTG header + header + payload, else 0
* \param[in] src source identity
* \param[in] dst destination id
* \param[in] application id that might generate the packet
* \param[in] ctime
* \param[out] final packet size
* \param[out] packet_t: the generated packet: otg_header + header + payload
* \note
* @ingroup _otg
*/
unsigned char *packet_gen_multicast(int src, int dst, int ctime, unsigned int * pkt_size);
unsigned char *packet_gen_multicast(
const int src_instance,
const int dst_instance,
const int ctime,
unsigned int * const pkt_size);
/*! \fn char *header_gen(int hdr_size);
/*! \fn char *header_gen(const int hdr_size);
* \brief generate IP (v4/v6) + transport header(TCP/UDP)
* \param[in] int : size
* \param[out] the payload corresponding to ip version and transport protocol
* \note
* @ingroup _otg
*/
unsigned char *header_gen(int hdr_size);
unsigned char *header_gen(const int hdr_size);
/*! \fn char *payload_pkts(int payload_size);
/*! \fn char *payload_pkts(const int payload_size);
* \brief generate the payload
* \param[in] int : payload size
* \param[out] char * payload
* \note
* @ingroup _otg
*/
unsigned char *payload_pkts(int payload_size);
unsigned char *payload_pkts(const int payload_size);
/*! \fn
char * serialize_buffer(char* header, char* payload, unsigned int buffer_size, int flag, int flow_id, int ctime, int seq_num, int hdr_type, int state)
char * serialize_buffer(char* const header, char* const payload, const unsigned int buffer_size, const int flag, const int flow_id, const int ctime, const int seq_num, const int hdr_type, const int state)
* \brief serilize the packet and add otg control information
* \param[in] char* header pointer to the header
* \param[in] char* payload pointer to the payload
@@ -144,8 +159,20 @@ flow id, simulation time, , sequence number, header type (to know the transport/
* @ingroup _otg
*/
unsigned char * serialize_buffer(char* header, char* payload, unsigned int buffer_size, unsigned int traffic_type, int flag, int flow_id, int ctime, int seq_num, int hdr_type, int state,
unsigned int aggregation_level);
unsigned char * serialize_buffer(
char* const header,
char* const payload,
const unsigned int buffer_size,
const unsigned int traffic_type,
const int flag,
const int flow_id,
const int ctime,
const int seq_num,
const int hdr_type,
const int state,
const unsigned int aggregation_level,
const int src_instance,
const int dst_instance);
/*! \fn int adjust_size(int size);
@@ -165,7 +192,7 @@ int adjust_size(int size);
* \note
* @ingroup _otg
*/
void header_size_gen(int src, int dst, int application);
void header_size_gen(const int src, const int dst, const int application);
void init_predef_multicast_traffic(void);
@@ -176,9 +203,9 @@ void init_predef_multicast_traffic(void);
* \note
* @ingroup _otg
*/
void init_predef_traffic(unsigned char nb_ue_local, unsigned char nb_enb_local);
void init_predef_traffic(const unsigned char nb_ue_local, const unsigned char nb_enb_local);
/*! \fn int background_gen(int src, int dst, int ctime);
/*! \fn int background_gen(const int src, const int dst, const int ctime);
* \brief manage idt and packet size for the backgrounf traffic.
* \param[in] src
* \param[in] dst
@@ -187,22 +214,24 @@ void init_predef_traffic(unsigned char nb_ue_local, unsigned char nb_enb_local);
* \note
* @ingroup _otg
*/
int background_gen(int src, int dst, int ctime);
int background_gen(const int src, const int dst, const int ctime);
int header_size_gen_background(int src, int dst);
int header_size_gen_background(const int src, const int dst);
void state_management(int src, int dst,int application, int ctime);
void state_management(const int src, const int dst,const int application, const int ctime);
void voip_traffic(int src, int dst, int application, int ctime);
void voip_traffic(const int src, const int dst, const int application, const int ctime);
int otg_hdr_size(int src, int dst);
int otg_hdr_size(
const int src_instance,
const int dst_instance);
void init_packet_gen(int src, int dst, int ctime);
void init_packet_gen(const int src_instance, const int dst_instance, const int ctime);
int check_data_transmit(int src,int dst, int app, int ctime);
int check_data_transmit(const int src,const int dst, const int app, const int ctime);
unsigned int get_application_state(int src, int dst, int application, int ctime);
unsigned int get_application_state(const int src, const int dst, const int application, const int ctime);
void check_ctime(int ctime);
void check_ctime(const int ctime);
#endif