Merge branch 'issue394_fix_cppcheck' into develop_integration_2019_w07_v2
--> openair2/LAYER2/MAC/eNB_scheduler_primitives.c is still old (not from issue394_fix_cppcheck branch) Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
+122
-152
@@ -34,11 +34,11 @@
|
||||
#include "log_extern.h"
|
||||
#include "assertions.h"
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
# if defined(ENABLE_USE_MME)
|
||||
# include "s1ap_eNB.h"
|
||||
# include "sctp_eNB_task.h"
|
||||
# endif
|
||||
#include "intertask_interface.h"
|
||||
#if defined(ENABLE_USE_MME)
|
||||
#include "s1ap_eNB.h"
|
||||
#include "sctp_eNB_task.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "SystemInformationBlockType2.h"
|
||||
|
||||
@@ -56,11 +56,10 @@
|
||||
void RCconfig_NbIoTL1(void) {
|
||||
paramdef_t NbIoT_L1_Params[] = L1PARAMS_DESC;
|
||||
paramlist_def_t NbIoT_L1_ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_L1_Params[L1_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
config_getlist( &NbIoT_L1_ParamList,NbIoT_L1_Params,sizeof(NbIoT_L1_Params)/sizeof(paramdef_t), NULL);
|
||||
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_L1_Params[L1_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
|
||||
config_getlist( &NbIoT_L1_ParamList,NbIoT_L1_Params,sizeof(NbIoT_L1_Params)/sizeof(paramdef_t), NULL);
|
||||
if (NbIoT_L1_ParamList.numelt > 0) {
|
||||
if (RC.L1_NB_IoT == NULL) {
|
||||
RC.L1_NB_IoT = (PHY_VARS_eNB_NB_IoT **)malloc(RC.nb_nb_iot_L1_inst*sizeof(PHY_VARS_eNB_NB_IoT *));
|
||||
@@ -68,219 +67,190 @@ void RCconfig_NbIoTL1(void) {
|
||||
memset(RC.L1_NB_IoT,0,RC.nb_nb_iot_L1_inst*sizeof(PHY_VARS_eNB_NB_IoT *));
|
||||
}
|
||||
|
||||
|
||||
for(int j = 0; j <NbIoT_L1_ParamList.numelt ; j++) {
|
||||
for(int j = 0; j <NbIoT_L1_ParamList.numelt ; j++) {
|
||||
if (RC.L1_NB_IoT[j] == NULL) {
|
||||
RC.L1_NB_IoT[j] = (PHY_VARS_eNB_NB_IoT *)malloc(sizeof(PHY_VARS_eNB_NB_IoT));
|
||||
LOG_I(PHY,"RC.L1_NB_IoT[%d] = %p\n",j,RC.L1_NB_IoT[j]);
|
||||
memset(RC.L1_NB_IoT[j],0,sizeof(PHY_VARS_eNB_NB_IoT));
|
||||
RC.L1_NB_IoT[j] = (PHY_VARS_eNB_NB_IoT *)malloc(sizeof(PHY_VARS_eNB_NB_IoT));
|
||||
LOG_I(PHY,"RC.L1_NB_IoT[%d] = %p\n",j,RC.L1_NB_IoT[j]);
|
||||
memset(RC.L1_NB_IoT[j],0,sizeof(PHY_VARS_eNB_NB_IoT));
|
||||
}
|
||||
if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
|
||||
|
||||
if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
|
||||
} else if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
RC.L1_NB_IoT[j]->eth_params_n.local_if_name = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_addr = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_addr = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_portc = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_portc = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_portd = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_portd = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
} else { // other midhaul
|
||||
}
|
||||
else if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
RC.L1_NB_IoT[j]->eth_params_n.local_if_name = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_addr = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_addr = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_portc = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_portc = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.my_portd = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.remote_portd = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
|
||||
RC.L1_NB_IoT[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
}
|
||||
|
||||
else { // other midhaul
|
||||
}
|
||||
}// j=0..num_inst
|
||||
|
||||
printf("Initializing northbound interface for NB-IoT L1\n");
|
||||
l1_north_init_NB_IoT();
|
||||
} else {
|
||||
LOG_I(PHY,"No " NBIOT_L1LIST_CONFIG_STRING " configuration found");
|
||||
LOG_I(PHY,"No " NBIOT_L1LIST_CONFIG_STRING " configuration found");
|
||||
}
|
||||
}
|
||||
|
||||
void RCconfig_NbIoTmacrlc(void) {
|
||||
|
||||
|
||||
|
||||
paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC;
|
||||
paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
|
||||
|
||||
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_MacRLC_Params[MACRLC_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
|
||||
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
|
||||
/* No component carrier for NbIoT, ignore number of CC */
|
||||
// NbIoT_MacRLC_Params[MACRLC_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
|
||||
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t), NULL);
|
||||
|
||||
if ( NbIoT_MacRLC_ParamList.numelt > 0) {
|
||||
mac_top_init_eNB_NB_IoT();
|
||||
for (int j=0;j<RC.nb_nb_iot_macrlc_inst;j++) {
|
||||
|
||||
for (int j=0; j<RC.nb_nb_iot_macrlc_inst; j++) {
|
||||
if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
|
||||
// check number of instances is same as RRC/PDCP
|
||||
|
||||
// check number of instances is same as RRC/PDCP
|
||||
} else if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
|
||||
RC.nb_iot_mac[j]->eth_params_n.local_if_name = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
|
||||
RC.nb_iot_mac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
RC.nb_iot_mac[j]->eth_params_n.local_if_name = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.my_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_n.remote_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
|
||||
RC.nb_iot_mac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
} else { // other midhaul
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
|
||||
if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
|
||||
|
||||
|
||||
} else if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
RC.nb_iot_mac[j]->eth_params_s.local_if_name = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
|
||||
RC.nb_iot_mac[j]->eth_params_s.local_if_name = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_addr = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_portc = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.my_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.remote_portd = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
|
||||
RC.nb_iot_mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
|
||||
} else { // other midhaul
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
}// j=0..num_inst */
|
||||
} else {// MacRLC_ParamList.numelt > 0
|
||||
AssertFatal (0,
|
||||
"No " NBIOT_MACRLCLIST_CONFIG_STRING " configuration found");
|
||||
AssertFatal (0,
|
||||
"No " NBIOT_MACRLCLIST_CONFIG_STRING " configuration found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nbiotrrc) {
|
||||
|
||||
|
||||
char instprefix[MAX_OPTNAME_SIZE*3 + 32];
|
||||
|
||||
|
||||
checkedparam_t NBIoTCheckParams[] = NBIOT_RRCPARAMS_CHECK_DESC;
|
||||
checkedparam_t NBIoTCheckParams[] = NBIOT_RRCPARAMS_CHECK_DESC_0_14;
|
||||
checkedparam_t NBIoTCheckParamsB[] = NBIOT_RRCPARAMS_CHECK_DESC_15_end;
|
||||
paramdef_t NBIoTParams[] = NBIOTRRCPARAMS_DESC;
|
||||
|
||||
paramdef_t NBIoTPrachParams[] = NBIOTRRC_NPRACH_PARAMS_DESC;
|
||||
checkedparam_t NBIoTPrachCheckParams[] = NBIOT_RRCLIST_NPRACHPARAMSCHECK_DESC;
|
||||
|
||||
paramdef_t NBIoTRRCRefParams[] = NBIOTRRCPARAMS_RRCREF_DESC;
|
||||
|
||||
paramdef_t NBIoTLteCCParams[] = NBIOT_LTECCPARAMS_DESC;
|
||||
checkedparam_t NBIoTLteCCCheckParams[] = NBIOT_LTECCPARAMS_CHECK_DESC;
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
for (int i=0; (i<sizeof(NBIoTParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
NBIoTParams[i].chkPptr = &(NBIoTCheckParams[i]);
|
||||
}
|
||||
for (int i=0; (i<sizeof(NBIoTPrachParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTPrachCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
NBIoTPrachParams[i].chkPptr = &(NBIoTPrachCheckParams[i]);
|
||||
NBIoTParams[i].chkPptr = &(NBIoTCheckParams[i]);
|
||||
}
|
||||
|
||||
/* brut force itti message fields assignment, to be redesigned with itti replacement */
|
||||
for (int i=0; (i<sizeof(NBIoTParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTCheckParamsB)/sizeof(checkedparam_t)); i++ ) {
|
||||
NBIoTParams[i+15].chkPptr = &(NBIoTCheckParamsB[i]);
|
||||
}
|
||||
|
||||
for (int i=0; (i<sizeof(NBIoTPrachParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTPrachCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
NBIoTPrachParams[i].chkPptr = &(NBIoTPrachCheckParams[i]);
|
||||
}
|
||||
|
||||
/* brut force itti message fields assignment, to be redesigned with itti replacement */
|
||||
NBIoTParams[NBIOT_RACH_RARESPONSEWINDOWSIZE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize_NB);
|
||||
NBIoTParams[NBIOT_RACH_MACCONTENTIONRESOLUTIONTIMER_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer_NB);
|
||||
NBIoTParams[NBIOT_RACH_POWERRAMPINGSTEP_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep_NB);
|
||||
NBIoTParams[NBIOT_RACH_POWERRAMPINGSTEP_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep_NB);
|
||||
NBIoTParams[NBIOT_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower_NB);
|
||||
NBIoTParams[NBIOT_RACH_PREAMBLETRANSMAX_CE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax_CE_NB);
|
||||
NBIoTParams[NBIOT_BCCH_MODIFICATIONPERIODCOEFF_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff_NB);
|
||||
NBIoTParams[NBIOT_PCCH_DEFAULTPAGINGCYCLE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle_NB);
|
||||
NBIoTParams[NBIOT_NPRACH_CP_LENGTH_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_CP_Length);
|
||||
NBIoTParams[NBIOT_NPRACH_RSRP_RANGE_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_rsrp_range);
|
||||
|
||||
|
||||
|
||||
NBIoTParams[NBIOT_RACH_PREAMBLETRANSMAX_CE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax_CE_NB);
|
||||
NBIoTParams[NBIOT_BCCH_MODIFICATIONPERIODCOEFF_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff_NB);
|
||||
NBIoTParams[NBIOT_PCCH_DEFAULTPAGINGCYCLE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle_NB);
|
||||
NBIoTParams[NBIOT_NPRACH_CP_LENGTH_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_CP_Length);
|
||||
NBIoTParams[NBIOT_NPRACH_RSRP_RANGE_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_rsrp_range);
|
||||
NBIoTParams[NBIOT_MAXNUMPREAMBLEATTEMPTCE_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).maxNumPreambleAttemptCE_NB);
|
||||
|
||||
NBIoTParams[NBIOT_NPDSCH_NRS_POWER_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdsch_nrs_Power);
|
||||
NBIoTParams[NBIOT_NPUSCH_ACK_NACK_NUMREPETITIONS_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_ack_nack_numRepetitions_NB);
|
||||
NBIoTParams[NBIOT_NPUSCH_SRS_SUBFRAMECONFIG_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_srs_SubframeConfig_NB);
|
||||
NBIoTParams[NBIOT_NPUSCH_THREETONE_CYCLICSHIFT_R13_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_threeTone_CyclicShift_r13);
|
||||
NBIoTParams[NBIOT_NPDSCH_NRS_POWER_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdsch_nrs_Power);
|
||||
NBIoTParams[NBIOT_NPUSCH_ACK_NACK_NUMREPETITIONS_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_ack_nack_numRepetitions_NB);
|
||||
NBIoTParams[NBIOT_NPUSCH_SRS_SUBFRAMECONFIG_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_srs_SubframeConfig_NB);
|
||||
NBIoTParams[NBIOT_NPUSCH_THREETONE_CYCLICSHIFT_R13_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_threeTone_CyclicShift_r13);
|
||||
NBIoTParams[NBIOT_NPUSCH_SIXTONE_CYCLICSHIFT_R13_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_sixTone_CyclicShift_r13);
|
||||
|
||||
NBIoTParams[NBIOT_NPUSCH_GROUPASSIGNMENTNPUSCH_R13_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupAssignmentNPUSCH_r13);
|
||||
NBIoTParams[NBIOT_DL_GAPTHRESHOLD_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapThreshold_NB);
|
||||
NBIoTParams[NBIOT_DL_GAPPERIODICITY_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapPeriodicity_NB);
|
||||
|
||||
NBIoTParams[NBIOT_NPUSCH_P0_NOMINALNPUSCH_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_p0_NominalNPUSCH);
|
||||
|
||||
NBIoTParams[NBIOT_DELTAPREAMBLEMSG3_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).deltaPreambleMsg3);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T300_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300_NB);
|
||||
NBIoTParams[NBIOT_DL_GAPTHRESHOLD_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapThreshold_NB);
|
||||
NBIoTParams[NBIOT_DL_GAPPERIODICITY_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapPeriodicity_NB);
|
||||
NBIoTParams[NBIOT_NPUSCH_P0_NOMINALNPUSCH_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_p0_NominalNPUSCH);
|
||||
NBIoTParams[NBIOT_DELTAPREAMBLEMSG3_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).deltaPreambleMsg3);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T300_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T301_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T310_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T311_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N310_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T310_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T311_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N310_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310_NB);
|
||||
NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N311_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311_NB);
|
||||
|
||||
sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]",nbiotrrc_id);
|
||||
config_get( NBIoTParams,sizeof(NBIoTParams)/sizeof(paramdef_t),instprefix);
|
||||
|
||||
config_get( NBIoTParams,sizeof(NBIoTParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierMSG3_RangeStart = config_get_processedint( &(NBIoTParams[NBIOT_NPRACH_SUBCARRIERMSG3_RANGESTART_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupHoppingEnabled = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapDurationCoeff_NB = config_get_processedint( &(NBIoTParams[NBIOT_DL_GAPDURATIONCOEFF_NB_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupHoppingEnabled = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapDurationCoeff_NB = config_get_processedint( &(NBIoTParams[NBIOT_DL_GAPDURATIONCOEFF_NB_IDX] ) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_alpha = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_ALPHA_IDX] ) );
|
||||
|
||||
for (int i=0; i<MAX_NUM_NBIOT_CELEVELS; i++) {
|
||||
char *tmpptr=NULL;
|
||||
NBIoTPrachParams[NBIOT_NPRACH_PERIODICITY_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_Periodicity[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_STARTTIME_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_StartTime[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_SUBCARRIEROFFSET_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierOffset[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_NUMSUBCARRIERS_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_NumSubcarriers[i]);
|
||||
NBIoTPrachParams[NBIOT_NUMREPETITIONSPERPREAMBLEATTEMPT_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).numRepetitionsPerPreambleAttempt_NB[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_NUMREPETITIONS_RA_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_NumRepetitions_RA[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_STARTSF_CSS_RA_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_StartSF_CSS_RA[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_OFFSET_RA_IDX].strptr = &tmpptr;
|
||||
sprintf(instprefix, "%s.[%i].%s.[%i]",NBIOT_RRCLIST_CONFIG_STRING, nbiotrrc_id,NBIOT_RRCLIST_NPRACHPARAMS_CONFIG_STRING,i);
|
||||
config_get( NBIoTPrachParams,sizeof(NBIoTPrachParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_Offset_RA[i] = config_get_processedint( &(NBIoTPrachParams[NBIOT_NPDCCH_OFFSET_RA_IDX]) );
|
||||
char *tmpptr=NULL;
|
||||
NBIoTPrachParams[NBIOT_NPRACH_PERIODICITY_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_Periodicity[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_STARTTIME_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_StartTime[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_SUBCARRIEROFFSET_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierOffset[i]);
|
||||
NBIoTPrachParams[NBIOT_NPRACH_NUMSUBCARRIERS_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_NumSubcarriers[i]);
|
||||
NBIoTPrachParams[NBIOT_NUMREPETITIONSPERPREAMBLEATTEMPT_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).numRepetitionsPerPreambleAttempt_NB[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_NUMREPETITIONS_RA_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_NumRepetitions_RA[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_STARTSF_CSS_RA_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_StartSF_CSS_RA[i]);
|
||||
NBIoTParams[NBIOT_NPDCCH_OFFSET_RA_IDX].strptr = &tmpptr;
|
||||
sprintf(instprefix, "%s.[%i].%s.[%i]",NBIOT_RRCLIST_CONFIG_STRING, nbiotrrc_id,NBIOT_RRCLIST_NPRACHPARAMS_CONFIG_STRING,i);
|
||||
config_get( NBIoTPrachParams,sizeof(NBIoTPrachParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_Offset_RA[i] = config_get_processedint( &(NBIoTPrachParams[NBIOT_NPDCCH_OFFSET_RA_IDX]) );
|
||||
}
|
||||
/* get the LTE RRC and CC this NB-IoT RRC instance is attached to */
|
||||
|
||||
/* get the LTE RRC and CC this NB-IoT RRC instance is attached to */
|
||||
sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]." NBIOT_LTERRCREF_CONFIG_STRING, nbiotrrc_id );
|
||||
config_get( NBIoTRRCRefParams,sizeof(NBIoTRRCRefParams)/sizeof(paramdef_t),instprefix);
|
||||
|
||||
/* read SIB1 parameters in the LTE RRC and CC sections */
|
||||
config_get( NBIoTRRCRefParams,sizeof(NBIoTRRCRefParams)/sizeof(paramdef_t),instprefix);
|
||||
/* read SIB1 parameters in the LTE RRC and CC sections */
|
||||
sprintf(instprefix, ENB_CONFIG_STRING_ENB_LIST ".[%i]." ENB_CONFIG_STRING_COMPONENT_CARRIERS ".[%i]",
|
||||
*(NBIoTRRCRefParams[NBIOT_RRCINST_IDX].uptr), *(NBIoTRRCRefParams[NBIOT_CCINST_IDX].uptr));
|
||||
|
||||
NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config);
|
||||
NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_S_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config_s);
|
||||
NBIoTLteCCParams[LTECCPARAMS_EUTRA_BAND_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).eutra_band);
|
||||
NBIoTLteCCParams[LTECCPARAMS_DOWNLINK_FREQUENCY_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).downlink_frequency);
|
||||
*(NBIoTRRCRefParams[NBIOT_RRCINST_IDX].uptr), *(NBIoTRRCRefParams[NBIOT_CCINST_IDX].uptr));
|
||||
NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config);
|
||||
NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_S_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config_s);
|
||||
NBIoTLteCCParams[LTECCPARAMS_EUTRA_BAND_IDX ].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).eutra_band);
|
||||
NBIoTLteCCParams[LTECCPARAMS_DOWNLINK_FREQUENCY_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).downlink_frequency);
|
||||
NBIoTLteCCParams[LTECCPARAMS_UPLINK_FREQUENCY_OFFSET_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset);
|
||||
NBIoTLteCCParams[LTECCPARAMS_NID_CELL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).Nid_cell);
|
||||
NBIoTLteCCParams[LTECCPARAMS_N_RB_DL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).N_RB_DL);
|
||||
NBIoTLteCCParams[LTECCPARAMS_NID_CELL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).Nid_cell);
|
||||
NBIoTLteCCParams[LTECCPARAMS_N_RB_DL_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).N_RB_DL);
|
||||
|
||||
for (int i=0; (i<sizeof(NBIoTLteCCParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTLteCCCheckParams)/sizeof(checkedparam_t)); i++ ) {
|
||||
NBIoTLteCCParams[i].chkPptr = &(NBIoTLteCCCheckParams[i]);
|
||||
NBIoTLteCCParams[i].chkPptr = &(NBIoTLteCCCheckParams[i]);
|
||||
}
|
||||
config_get( NBIoTLteCCParams,sizeof(NBIoTLteCCParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).frame_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_FRAME_TYPE_IDX]) );
|
||||
|
||||
config_get( NBIoTLteCCParams,sizeof(NBIoTLteCCParams)/sizeof(paramdef_t),instprefix);
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).frame_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_FRAME_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_IDX]) );
|
||||
NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_UL_IDX]) );
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RCConfig_NbIoT(RAN_CONTEXT_t *RC) {
|
||||
|
||||
paramlist_def_t NbIoT_MACRLCParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
|
||||
paramlist_def_t NbIoT_L1ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
|
||||
paramlist_def_t NbIoT_ParamList = {NBIOT_RRCLIST_CONFIG_STRING,NULL,0};
|
||||
|
||||
|
||||
config_getlist( &NbIoT_ParamList,NULL,0,NULL);
|
||||
RC->nb_nb_iot_rrc_inst = NbIoT_ParamList.numelt;
|
||||
|
||||
|
||||
|
||||
|
||||
config_getlist( &NbIoT_MACRLCParamList,NULL,0, NULL);
|
||||
RC->nb_nb_iot_macrlc_inst = NbIoT_MACRLCParamList.numelt;
|
||||
// Get num L1 instances
|
||||
config_getlist( &NbIoT_L1ParamList,NULL,0, NULL);
|
||||
RC->nb_nb_iot_L1_inst = NbIoT_L1ParamList.numelt;
|
||||
|
||||
config_getlist( &NbIoT_MACRLCParamList,NULL,0, NULL);
|
||||
RC->nb_nb_iot_macrlc_inst = NbIoT_MACRLCParamList.numelt;
|
||||
// Get num L1 instances
|
||||
config_getlist( &NbIoT_L1ParamList,NULL,0, NULL);
|
||||
RC->nb_nb_iot_L1_inst = NbIoT_L1ParamList.numelt;
|
||||
}
|
||||
|
||||
@@ -1909,7 +1909,7 @@ int RCconfig_S1(
|
||||
|
||||
default: {
|
||||
LOG_E(S1AP, "Default I-DRX value in conf file is invalid (%i). Should be 32, 64, 128 or 256. \
|
||||
Default DRX set to 32 in MME configuration\n",
|
||||
Default DRX set to 32 in MME configuration\n",
|
||||
ccparams_lte.pcch_defaultPagingCycle);
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,10 +17,10 @@
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
*/
|
||||
|
||||
/*! \file flexran_agent_timer.c
|
||||
* \brief FlexRAN Timer
|
||||
* \brief FlexRAN Timer
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
@@ -35,23 +35,23 @@
|
||||
//struct flexran_agent_map agent_map;
|
||||
flexran_agent_timer_instance_t timer_instance;
|
||||
int agent_timer_init = 0;
|
||||
err_code_t flexran_agent_init_timer(void){
|
||||
|
||||
err_code_t flexran_agent_init_timer(void) {
|
||||
LOG_I(FLEXRAN_AGENT, "init RB tree\n");
|
||||
|
||||
if (!agent_timer_init) {
|
||||
RB_INIT(&timer_instance.flexran_agent_head);
|
||||
agent_timer_init = 1;
|
||||
}
|
||||
|
||||
return PROTOCOL__FLEXRAN_ERR__NO_ERR;
|
||||
|
||||
return PROTOCOL__FLEXRAN_ERR__NO_ERR;
|
||||
}
|
||||
|
||||
RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
|
||||
|
||||
/* The timer_id might not be the best choice for the comparison */
|
||||
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){
|
||||
|
||||
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b) {
|
||||
if (a->timer_id < b->timer_id) return -1;
|
||||
|
||||
if (a->timer_id > b->timer_id) return 1;
|
||||
|
||||
// equal timers
|
||||
@@ -59,52 +59,53 @@ int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
|
||||
uint32_t interval_usec,
|
||||
agent_id_t agent_id,
|
||||
instance_t instance,
|
||||
uint32_t timer_type,
|
||||
xid_t xid,
|
||||
flexran_agent_timer_callback_t cb,
|
||||
void* timer_args,
|
||||
long *timer_id){
|
||||
|
||||
uint32_t interval_usec,
|
||||
agent_id_t agent_id,
|
||||
instance_t instance,
|
||||
uint32_t timer_type,
|
||||
xid_t xid,
|
||||
flexran_agent_timer_callback_t cb,
|
||||
void *timer_args,
|
||||
long *timer_id) {
|
||||
struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
|
||||
DevAssert(e != NULL);
|
||||
|
||||
//uint32_t timer_id;
|
||||
//uint32_t timer_id;
|
||||
int ret=-1;
|
||||
|
||||
if ((interval_sec == 0) && (interval_usec == 0 ))
|
||||
|
||||
if ((interval_sec == 0) && (interval_usec == 0 )) {
|
||||
free(e);
|
||||
return TIMER_NULL;
|
||||
|
||||
if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
|
||||
return TIMER_TYPE_INVALIDE;
|
||||
|
||||
if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_ONE_SHOT,
|
||||
timer_args,
|
||||
timer_id);
|
||||
|
||||
e->type = TIMER_ONE_SHOT;
|
||||
}
|
||||
else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_PERIODIC,
|
||||
timer_args,
|
||||
timer_id);
|
||||
|
||||
|
||||
if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) {
|
||||
free(e);
|
||||
return TIMER_TYPE_INVALIDE;
|
||||
}
|
||||
|
||||
if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT) {
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_ONE_SHOT,
|
||||
timer_args,
|
||||
timer_id);
|
||||
|
||||
e->type = TIMER_ONE_SHOT;
|
||||
} else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ) {
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_PERIODIC,
|
||||
timer_args,
|
||||
timer_id);
|
||||
e->type = TIMER_PERIODIC;
|
||||
}
|
||||
|
||||
|
||||
if (ret < 0 ) {
|
||||
return TIMER_SETUP_FAILED;
|
||||
free(e);
|
||||
return TIMER_SETUP_FAILED;
|
||||
}
|
||||
|
||||
e->agent_id = agent_id;
|
||||
@@ -112,19 +113,16 @@ err_code_t flexran_agent_create_timer(uint32_t interval_sec,
|
||||
e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE;
|
||||
e->timer_id = *timer_id;
|
||||
e->xid = xid;
|
||||
e->timer_args = timer_args;
|
||||
e->timer_args = timer_args;
|
||||
e->cb = cb;
|
||||
/*element should be a real pointer*/
|
||||
RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
|
||||
RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
|
||||
e->timer_id, e->agent_id, e->instance);
|
||||
|
||||
return 0;
|
||||
e->timer_id, e->agent_id, e->instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_timer(long timer_id){
|
||||
|
||||
err_code_t flexran_agent_destroy_timer(long timer_id) {
|
||||
struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
|
||||
|
||||
if (e != NULL ) {
|
||||
@@ -132,13 +130,12 @@ err_code_t flexran_agent_destroy_timer(long timer_id){
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
}
|
||||
|
||||
if (timer_remove(timer_id) < 0 )
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (timer_remove(timer_id) < 0 )
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
|
||||
return TIMER_REMOVED_FAILED ;
|
||||
}
|
||||
@@ -152,66 +149,59 @@ err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) {
|
||||
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
if (timer_remove(timer_id) < 0 ) {
|
||||
goto error;
|
||||
|
||||
if (timer_remove(timer_id) < 0 ) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
|
||||
return TIMER_REMOVED_FAILED ;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_timers(void){
|
||||
|
||||
err_code_t flexran_agent_destroy_timers(void) {
|
||||
struct flexran_agent_timer_element_s *e = NULL;
|
||||
|
||||
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
|
||||
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
timer_remove(e->timer_id);
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void flexran_agent_sleep_until(struct timespec *ts, int delay) {
|
||||
ts->tv_nsec += delay;
|
||||
if(ts->tv_nsec >= 1000*1000*1000){
|
||||
|
||||
if(ts->tv_nsec >= 1000*1000*1000) {
|
||||
ts->tv_nsec -= 1000*1000*1000;
|
||||
ts->tv_sec++;
|
||||
}
|
||||
|
||||
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL);
|
||||
}
|
||||
|
||||
|
||||
err_code_t flexran_agent_stop_timer(long timer_id){
|
||||
|
||||
err_code_t flexran_agent_stop_timer(long timer_id) {
|
||||
struct flexran_agent_timer_element_s *e=NULL;
|
||||
struct flexran_agent_timer_element_s search;
|
||||
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
|
||||
search.timer_id = timer_id;
|
||||
|
||||
e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
|
||||
|
||||
if (e != NULL ) {
|
||||
e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED;
|
||||
}
|
||||
|
||||
|
||||
timer_remove(timer_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
|
||||
|
||||
struct flexran_agent_timer_element_s *get_timer_entry(long timer_id) {
|
||||
struct flexran_agent_timer_element_s search;
|
||||
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
|
||||
search.timer_id = timer_id;
|
||||
|
||||
return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
|
||||
return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
|
||||
}
|
||||
|
||||
@@ -134,42 +134,37 @@ static const eutra_bandentry_t eutra_bandtable[] = {
|
||||
{68, 6980, 7280, 7530, 7830, 67536}
|
||||
};
|
||||
|
||||
uint32_t to_earfcn(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw)
|
||||
{
|
||||
|
||||
#define BANDTABLE_SIZE (sizeof(eutra_bandtable)/sizeof(eutra_bandentry_t))
|
||||
|
||||
uint32_t to_earfcn(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw) {
|
||||
uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000;
|
||||
int bw_by_100 = bw / 100;
|
||||
|
||||
int i;
|
||||
|
||||
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
|
||||
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min,
|
||||
"Band %d, bw %u : DL carrier frequency %u Hz < %u\n",
|
||||
eutra_bandP, bw, dl_CarrierFreq,
|
||||
eutra_bandtable[i].dl_min);
|
||||
"Band %d, bw %u : DL carrier frequency %u Hz < %u\n",
|
||||
eutra_bandP, bw, dl_CarrierFreq,
|
||||
eutra_bandtable[i].dl_min);
|
||||
AssertFatal(dl_CarrierFreq_by_100k <=
|
||||
(eutra_bandtable[i].dl_max - bw_by_100),
|
||||
"Band %d, bw %u: DL carrier frequency %u Hz > %d\n",
|
||||
eutra_bandP, bw, dl_CarrierFreq,
|
||||
eutra_bandtable[i].dl_max - bw_by_100);
|
||||
|
||||
|
||||
(eutra_bandtable[i].dl_max - bw_by_100),
|
||||
"Band %d, bw %u: DL carrier frequency %u Hz > %d\n",
|
||||
eutra_bandP, bw, dl_CarrierFreq,
|
||||
eutra_bandtable[i].dl_max - bw_by_100);
|
||||
return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min +
|
||||
(eutra_bandtable[i].N_OFFs_DL / 10));
|
||||
(eutra_bandtable[i].N_OFFs_DL / 10));
|
||||
}
|
||||
|
||||
uint32_t to_earfcn_DL(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw)
|
||||
{
|
||||
|
||||
uint32_t to_earfcn_DL(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw) {
|
||||
uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000;
|
||||
int bw_by_100 = bw / 100;
|
||||
|
||||
int i;
|
||||
|
||||
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
|
||||
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min,
|
||||
"Band %d, bw %u : DL carrier frequency %lld Hz < %u\n",
|
||||
@@ -180,22 +175,17 @@ uint32_t to_earfcn_DL(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw
|
||||
"Band %d, bw %u : DL carrier frequency %lld Hz > %d\n",
|
||||
eutra_bandP, bw, dl_CarrierFreq,
|
||||
eutra_bandtable[i].dl_max - bw_by_100);
|
||||
|
||||
|
||||
return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min +
|
||||
(eutra_bandtable[i].N_OFFs_DL / 10));
|
||||
}
|
||||
|
||||
uint32_t to_earfcn_UL(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw)
|
||||
{
|
||||
|
||||
uint32_t to_earfcn_UL(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw) {
|
||||
uint32_t ul_CarrierFreq_by_100k = ul_CarrierFreq / 100000;
|
||||
int bw_by_100 = bw / 100;
|
||||
|
||||
int i;
|
||||
|
||||
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
|
||||
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
AssertFatal(ul_CarrierFreq_by_100k >= eutra_bandtable[i].ul_min,
|
||||
"Band %d, bw %u : UL carrier frequency %lld Hz < %u\n",
|
||||
@@ -206,30 +196,26 @@ uint32_t to_earfcn_UL(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw
|
||||
"Band %d, bw %u : UL carrier frequency %lld Hz > %d\n",
|
||||
eutra_bandP, bw, ul_CarrierFreq,
|
||||
eutra_bandtable[i].ul_max - bw_by_100);
|
||||
|
||||
|
||||
return (ul_CarrierFreq_by_100k - eutra_bandtable[i].ul_min +
|
||||
((eutra_bandtable[i].N_OFFs_DL + 180000) / 10));
|
||||
}
|
||||
|
||||
uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn)
|
||||
{
|
||||
|
||||
uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn) {
|
||||
int i;
|
||||
|
||||
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
|
||||
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
return (eutra_bandtable[i].dl_min +
|
||||
(dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000;
|
||||
(dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000;
|
||||
}
|
||||
|
||||
|
||||
int32_t get_uldl_offset(int eutra_bandP)
|
||||
{
|
||||
int32_t get_uldl_offset(int eutra_bandP) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
|
||||
|
||||
return (eutra_bandtable[i].dl_min - eutra_bandtable[i].ul_min);
|
||||
}
|
||||
|
||||
|
||||
@@ -1013,7 +1013,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
|
||||
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
|
||||
}
|
||||
|
||||
eNB_UE_stats->dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
|
||||
//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
|
||||
|
||||
// store stats
|
||||
//UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->dl_cqi;
|
||||
|
||||
+612
-657
File diff suppressed because it is too large
Load Diff
@@ -128,6 +128,8 @@ void rlc_am_v9_3_0_test_windows()
|
||||
rlc_am_entity_t am2;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
memset(am1,0,sizeof(rlc_am_entity_t));
|
||||
memset(am2,0,sizeof(rlc_am_entity_t));
|
||||
|
||||
rlc_am_init(&am1, g_frame);
|
||||
rlc_am_init(&am2, g_frame);
|
||||
@@ -215,19 +217,16 @@ void rlc_am_v9_3_0_test_windows()
|
||||
assert(rlc_am_in_rx_window(&am1, i) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned int bit_pos_write = 0; // range from 0 (MSB/left) to 7 (LSB/right)
|
||||
uint8_t* byte_pos_write = g_buffer;
|
||||
|
||||
uint8_t *byte_pos_write = g_buffer;
|
||||
unsigned int bit_pos_read = 0; // range from 0 (MSB/left) to 7 (LSB/right)
|
||||
uint8_t* byte_pos_read = g_buffer;
|
||||
uint8_t *byte_pos_read = g_buffer;
|
||||
uint16_t read_value;
|
||||
|
||||
memset (g_buffer, 0, sizeof(g_buffer));
|
||||
// byte 0
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
|
||||
@@ -240,7 +239,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
|
||||
assert(g_buffer[0] == 0x96);
|
||||
assert(g_buffer[1] == 0x00);
|
||||
|
||||
// byte 1
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
|
||||
@@ -251,10 +249,8 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
|
||||
assert(g_buffer[0] == 0x96);
|
||||
|
||||
assert(g_buffer[1] == 0xD9);
|
||||
assert(g_buffer[2] == 0x00);
|
||||
|
||||
// byte 2
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
|
||||
@@ -266,7 +262,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
|
||||
assert(g_buffer[0] == 0x96);
|
||||
assert(g_buffer[1] == 0xD9);
|
||||
|
||||
assert(g_buffer[2] == 0x11);
|
||||
assert(g_buffer[3] == 0x00);
|
||||
// byte 3 & 4
|
||||
@@ -282,7 +277,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[0] == 0x96);
|
||||
assert(g_buffer[1] == 0xD9);
|
||||
assert(g_buffer[2] == 0x11);
|
||||
|
||||
assert(g_buffer[3] == 0x99);
|
||||
assert(g_buffer[4] == 0xA7);
|
||||
assert(g_buffer[5] == 0x00);
|
||||
@@ -298,7 +292,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[2] == 0x11);
|
||||
assert(g_buffer[3] == 0x99);
|
||||
assert(g_buffer[4] == 0xA7);
|
||||
|
||||
assert(g_buffer[5] == 0xF4);
|
||||
assert(g_buffer[6] == 0x86);
|
||||
assert(g_buffer[7] == 0x00);
|
||||
@@ -317,7 +310,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[4] == 0xA7);
|
||||
assert(g_buffer[5] == 0xF4);
|
||||
assert(g_buffer[6] == 0x86);
|
||||
|
||||
assert(g_buffer[7] == 0xCD);
|
||||
assert(g_buffer[8] == 0x7D);
|
||||
assert(g_buffer[9] == 0x58);
|
||||
@@ -337,7 +329,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[7] == 0xCD);
|
||||
assert(g_buffer[8] == 0x7D);
|
||||
assert(g_buffer[9] == 0x58);
|
||||
|
||||
assert(g_buffer[10] == 0xAA);
|
||||
assert(g_buffer[11] == 0xDB);
|
||||
assert(g_buffer[12] == 0xAA);
|
||||
@@ -368,7 +359,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[12] == 0xAA);
|
||||
assert(g_buffer[13] == 0xBD);
|
||||
assert(g_buffer[14] == 0x34);
|
||||
|
||||
assert(g_buffer[15] == 0xE0);
|
||||
assert(g_buffer[16] == 0x3F);
|
||||
assert(g_buffer[17] == 0x84);
|
||||
@@ -385,7 +375,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(g_buffer[28] == 0x87);
|
||||
assert(g_buffer[29] == 0x88);
|
||||
assert(g_buffer[30] == 0x00);
|
||||
|
||||
// 0x96 0xD9
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b0
|
||||
assert(read_value == 1);
|
||||
@@ -419,7 +408,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(read_value == 0);
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b15
|
||||
assert(read_value == 1);
|
||||
|
||||
// 0x11 0x99
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
|
||||
assert(read_value == 0);
|
||||
@@ -439,7 +427,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(read_value == 2);
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
|
||||
assert(read_value == 1);
|
||||
|
||||
// 0xA7 0xF4 0x86 0xCD 0x7D;
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
|
||||
assert(read_value == 0x29F);
|
||||
@@ -449,10 +436,8 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(read_value == 0x1B3);
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
|
||||
assert(read_value == 0x17D);
|
||||
|
||||
// 0x58 0xAA 0xDB 0xAA 0xBD 0x34
|
||||
// 0xE0 0x3F 0x84 0xBA 0x91 0xEC
|
||||
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);
|
||||
assert(read_value == 0);
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
|
||||
@@ -475,7 +460,6 @@ void rlc_am_v9_3_0_test_read_write_bit_field()
|
||||
assert(read_value == 0x2EA);
|
||||
read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
|
||||
assert(read_value == 0x11E);
|
||||
|
||||
bit_pos_read = 0;
|
||||
byte_pos_read = g_buffer;
|
||||
// 0x96 0xD9 0x11 0x99 0xA7 0xF4 0x86 0xCD 0x7D 0x58 0xAA 0xDB 0xAA 0xBD 0x34
|
||||
@@ -523,30 +507,24 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
|
||||
printf("[FRAME %05d][RLC][MOD %02d][RB %02d] TX SDU %d %04d bytes\n",g_frame,am_txP->module_id, am_txP->rb_id, sdu_indexP, strlen(g_sdus[sdu_indexP]) + 1);
|
||||
memset (sdu->data, 0, sizeof (struct rlc_am_data_req_alloc));
|
||||
strcpy (&sdu->data[sizeof (struct rlc_am_data_req_alloc)],g_sdus[sdu_indexP]);
|
||||
|
||||
((struct rlc_am_data_req *) (sdu->data))->data_size = strlen(g_sdus[sdu_indexP])+ 1;
|
||||
((struct rlc_am_data_req *) (sdu->data))->conf = 1;
|
||||
((struct rlc_am_data_req *) (sdu->data))->mui = g_mui++;
|
||||
((struct rlc_am_data_req *) (sdu->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
|
||||
rlc_am_data_req(am_txP, g_frame, sdu);
|
||||
|
||||
g_send_sdu_ids[g_send_id_write_index[am_txP->rb_id]++][am_txP->rb_id] = sdu_indexP;
|
||||
assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU);
|
||||
} else {
|
||||
printf("Out of memory error\n");
|
||||
// exit(-1);
|
||||
// exit(-1);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP,
|
||||
int* dropped_tx_packetsP) //-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
|
||||
mem_block_t* tb_src;
|
||||
mem_block_t* tb_dst;
|
||||
void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int *drop_countP, int *tx_packetsP,
|
||||
int *dropped_tx_packetsP) { //-----------------------------------------------------------------------------
|
||||
mem_block_t *tb_src;
|
||||
mem_block_t *tb_dst;
|
||||
unsigned int tb_size;
|
||||
|
||||
data_indP->no_tb = 0;
|
||||
|
||||
while (data_requestP->data.nb_elements > 0) {
|
||||
@@ -554,10 +532,9 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
|
||||
|
||||
if (tb_src != NULL) {
|
||||
tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
|
||||
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n",
|
||||
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
|
||||
((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
|
||||
tb_size, sizeof (mac_rlc_max_rx_header_size_t));
|
||||
|
||||
*tx_packetsP = *tx_packetsP + 1;
|
||||
|
||||
if (*drop_countP == 0) {
|
||||
@@ -568,16 +545,14 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
|
||||
((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)];
|
||||
((struct mac_tb_ind *) (tb_dst->data))->size = tb_size;
|
||||
((struct mac_tb_ind *) (tb_dst->data))->error_indication = 0;
|
||||
|
||||
memcpy(((struct mac_tb_ind *) (tb_dst->data))->data_ptr,
|
||||
&((struct mac_tb_req *) (tb_src->data))->data_ptr[0],
|
||||
tb_size);
|
||||
|
||||
list_add_tail_eurecom(tb_dst, &data_indP->data);
|
||||
data_indP->no_tb += 1;
|
||||
} else {
|
||||
printf("Out of memory error\n");
|
||||
// exit(-1);
|
||||
// exit(-1);
|
||||
}
|
||||
} else {
|
||||
printf("[RLC-LOOP] DROPPING 1 TB\n");
|
||||
@@ -607,8 +582,6 @@ void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,
|
||||
struct mac_status_ind tx_status;
|
||||
struct mac_status_resp mac_rlc_status_resp_tx;
|
||||
struct mac_status_resp mac_rlc_status_resp_rx;
|
||||
|
||||
|
||||
memset(&data_request_tx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_request_rx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
|
||||
@@ -616,19 +589,15 @@ void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,
|
||||
memset(&tx_status, 0, sizeof(struct mac_status_ind));
|
||||
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
|
||||
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
|
||||
|
||||
mac_rlc_status_resp_tx = rlc_am_mac_status_indication(am_txP, g_frame, bytes_txP, tx_status);
|
||||
data_request_tx = rlc_am_mac_data_request(am_txP, g_frame);
|
||||
mac_rlc_status_resp_rx = rlc_am_mac_status_indication(am_rxP, g_frame, bytes_rxP, tx_status);
|
||||
data_request_rx = rlc_am_mac_data_request(am_rxP, g_frame);
|
||||
|
||||
|
||||
rlc_am_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
|
||||
rlc_am_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
|
||||
rlc_am_mac_data_indication(am_rxP, g_frame, am_txP->is_enb, data_ind_rx);
|
||||
rlc_am_mac_data_indication(am_txP, g_frame, am_txP->is_enb, data_ind_tx);
|
||||
g_frame += 1;
|
||||
|
||||
//rlc_am_tx_buffer_display(am_txP,NULL);
|
||||
//assert(am_txP->t_status_prohibit.time_out != 1);
|
||||
//assert(am_rxP->t_status_prohibit.time_out != 1);
|
||||
@@ -660,14 +629,12 @@ void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si
|
||||
assert(g_send_id_write_index[rb_idP^1] > g_send_id_read_index[rb_idP]);
|
||||
|
||||
if (g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] != i) {
|
||||
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-2,
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]-2][rb_idP^1]);
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-1,
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]-1][rb_idP^1]);
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP],
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1]);
|
||||
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_id_read_index = %d sdu sent = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP], i);
|
||||
}
|
||||
|
||||
@@ -693,17 +660,13 @@ void rlc_am_v9_3_0_test_tx_rx()
|
||||
uint32_t t_reordering = 5000;
|
||||
uint32_t t_status_prohibit = 10;
|
||||
int i,j,r;
|
||||
|
||||
srand (0);
|
||||
|
||||
rlc_am_init(&g_am_tx, g_frame);
|
||||
rlc_am_init(&g_am_rx, g_frame);
|
||||
rlc_am_set_debug_infos(&g_am_tx, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */);
|
||||
rlc_am_set_debug_infos(&g_am_rx, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */);
|
||||
|
||||
rlc_am_configure(&g_am_tx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
|
||||
rlc_am_configure(&g_am_rx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
|
||||
|
||||
#ifdef TEST1
|
||||
srand (0);
|
||||
rlc_am_v9_3_0_test_reset_sdus();
|
||||
@@ -730,7 +693,6 @@ void rlc_am_v9_3_0_test_tx_rx()
|
||||
rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
|
||||
assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
|
||||
printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
|
||||
|
||||
rlc_am_v9_3_0_test_reset_sdus();
|
||||
|
||||
// RANDOM TESTS
|
||||
@@ -800,7 +762,6 @@ void rlc_am_v9_3_0_test_tx_rx()
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
|
||||
|
||||
rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 30, 200);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 31, 200);
|
||||
@@ -957,7 +918,6 @@ void rlc_am_v9_3_0_test_tx_rx()
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
|
||||
rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
|
||||
|
||||
t_poll_retransmit = 6;
|
||||
rlc_am_configure(&g_am_tx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
|
||||
|
||||
@@ -1178,7 +1138,6 @@ void rlc_am_v9_3_0_test_tx_rx()
|
||||
assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
|
||||
printf("REAL BLER TX=%d (TARGET=%d) BLER RX=%d (TARGET=%d) \n",(g_dropped_tx_packets*100)/g_tx_packets, g_target_tx_error_rate,
|
||||
(g_dropped_rx_packets*100)/g_rx_packets, g_target_rx_error_rate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1193,11 +1152,10 @@ void rlc_am_v9_3_0_test_print_trace (void)
|
||||
size_t size;
|
||||
char **strings;
|
||||
size_t i;
|
||||
|
||||
size = backtrace (array, 100);
|
||||
strings = backtrace_symbols (array, size);
|
||||
printf ("Obtained %lu stack frames.\n", (unsigned long)size);
|
||||
|
||||
printf ("Obtained %d stack frames.\n", size);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
printf ("%s\n", strings[i]);
|
||||
@@ -1213,15 +1171,10 @@ void rlc_am_v9_3_0_test(void)
|
||||
// initscr();
|
||||
// cbreak();
|
||||
// keypad(stdscr, TRUE);
|
||||
|
||||
|
||||
|
||||
// under test
|
||||
pool_buffer_init();
|
||||
set_comp_log(RLC, LOG_ERR, LOG_MED, 1);
|
||||
|
||||
rlc_am_v9_3_0_test_tx_rx();
|
||||
|
||||
// already tested
|
||||
rlc_am_v9_3_0_test_windows();
|
||||
rlc_am_v9_3_0_test_read_write_bit_field();
|
||||
|
||||
@@ -125,7 +125,7 @@ static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier m
|
||||
#define RLC_2_PRINT_BUFFER_LEN 10000
|
||||
static char rlc_2_print_buffer[RLC_2_PRINT_BUFFER_LEN];
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, unsigned long sizeP)
|
||||
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, unsigned long sizeP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned long octet_index = 0;
|
||||
@@ -136,7 +136,6 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, uns
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LOG_D(RLC, "------+-------------------------------------------------|\n");
|
||||
LOG_D(RLC, " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
|
||||
LOG_D(RLC, "------+-------------------------------------------------|\n");
|
||||
@@ -149,7 +148,8 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, uns
|
||||
buffer_marker = 0;
|
||||
}
|
||||
|
||||
buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " %04ld |", octet_index);
|
||||
buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker,
|
||||
" %04lu |", octet_index);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -180,17 +180,13 @@ void rlc_um_v9_3_0_test_windows_10()
|
||||
rlc_um_entity_t um1;
|
||||
rlc_um_entity_t um2;
|
||||
unsigned int h,w, sn, result;
|
||||
|
||||
uint32_t timer_reordering = 2000;
|
||||
uint32_t sn_field_length = 10;
|
||||
uint32_t is_mXch = 0; // boolean, true if configured for MTCH or MCCH
|
||||
|
||||
rlc_um_init(&um1);
|
||||
rlc_um_init(&um2);
|
||||
|
||||
rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /*LC-id = RAB-id*/);
|
||||
rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /*LC-id = RAB-id*/);
|
||||
|
||||
rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
|
||||
rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
|
||||
|
||||
@@ -223,7 +219,6 @@ void rlc_um_v9_3_0_test_windows_10()
|
||||
assert(rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_10_BITS_MASK, sn, (um1.vr_uh -1) & RLC_UM_SN_10_BITS_MASK) < 0);
|
||||
assert(rlc_um_in_reordering_window(&um1, g_frame, sn) < 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,17 +229,13 @@ void rlc_um_v9_3_0_test_windows_5()
|
||||
rlc_um_entity_t um1;
|
||||
rlc_um_entity_t um2;
|
||||
unsigned int h,w, sn, result;
|
||||
|
||||
uint32_t timer_reordering = 2000;
|
||||
uint32_t sn_field_length = 5;
|
||||
uint32_t is_mXch = 0; // boolean, true if configured for MTCH or MCCH
|
||||
|
||||
rlc_um_init(&um1);
|
||||
rlc_um_init(&um2);
|
||||
|
||||
rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */);
|
||||
rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */);
|
||||
|
||||
rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
|
||||
rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
|
||||
|
||||
@@ -277,7 +268,6 @@ void rlc_um_v9_3_0_test_windows_5()
|
||||
assert(rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_5_BITS_MASK, sn, (um1.vr_uh -1) & RLC_UM_SN_5_BITS_MASK) < 0);
|
||||
assert(rlc_um_in_reordering_window(&um1, g_frame, sn) < 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,25 +298,23 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP)
|
||||
printf("[FRAME %05d][RLC][MOD %02d][RB %02d] TX SDU %d %04d bytes\n",g_frame,um_txP->module_id, um_txP->rb_id, sdu_indexP, strlen(g_sdus[sdu_indexP]) + 1);
|
||||
memset (sdu->data, 0, sizeof (struct rlc_um_data_req_alloc));
|
||||
strcpy (&sdu->data[sizeof (struct rlc_um_data_req_alloc)],g_sdus[sdu_indexP]);
|
||||
|
||||
((struct rlc_um_data_req *) (sdu->data))->data_size = strlen(g_sdus[sdu_indexP])+ 1;
|
||||
((struct rlc_um_data_req *) (sdu->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
|
||||
rlc_um_data_req(um_txP, g_frame, sdu);
|
||||
|
||||
g_send_sdu_ids[g_send_id_write_index[um_txP->rb_id]++][um_txP->rb_id] = sdu_indexP;
|
||||
assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU);
|
||||
} else {
|
||||
printf("Out of memory error\n");
|
||||
// exit(-1);
|
||||
// exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind* data_indP, signed int time_delayedP)
|
||||
void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind *data_indP, signed int time_delayedP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int frame_modulo;
|
||||
mem_block_t* tb;
|
||||
mem_block_t *tb;
|
||||
|
||||
if (time_delayedP <= 0) {
|
||||
frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
|
||||
@@ -351,11 +339,11 @@ void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind* data_indP
|
||||
assert(data_indP->data.head == NULL);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(struct mac_data_ind* data_indP, signed int time_delayedP)
|
||||
void rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(struct mac_data_ind *data_indP, signed int time_delayedP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int frame_modulo;
|
||||
mem_block_t* tb;
|
||||
mem_block_t *tb;
|
||||
|
||||
if (time_delayedP <= 0) {
|
||||
frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
|
||||
@@ -381,16 +369,13 @@ void rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(struct mac_data_ind* data_indP
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct mac_data_req* data_requestP, int* drop_countP, int* tx_packetsP,
|
||||
int* dropped_tx_packetsP)
|
||||
void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int *drop_countP, int *tx_packetsP,
|
||||
int *dropped_tx_packetsP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
|
||||
mem_block_t* tb_src;
|
||||
mem_block_t* tb_dst;
|
||||
mem_block_t *tb_src;
|
||||
mem_block_t *tb_dst;
|
||||
unsigned int tb_size;
|
||||
|
||||
data_indP->no_tb = 0;
|
||||
|
||||
while (data_requestP->data.nb_elements > 0) {
|
||||
@@ -398,14 +383,14 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
|
||||
|
||||
if (tb_src != NULL) {
|
||||
tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
|
||||
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n",
|
||||
printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
|
||||
((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
|
||||
tb_size, sizeof (mac_rlc_max_rx_header_size_t));
|
||||
|
||||
*tx_packetsP = *tx_packetsP + 1;
|
||||
|
||||
if (*drop_countP == 0) {
|
||||
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
|
||||
|
||||
if (tb_dst != NULL) {
|
||||
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
|
||||
//printf("[RLC-LOOP] Testing tb_dst (1)\n");
|
||||
@@ -415,18 +400,16 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
|
||||
((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)];
|
||||
((struct mac_tb_ind *) (tb_dst->data))->size = tb_size;
|
||||
((struct mac_tb_ind *) (tb_dst->data))->error_indication = 0;
|
||||
|
||||
memcpy(((struct mac_tb_ind *) (tb_dst->data))->data_ptr,
|
||||
&((struct mac_tb_req *) (tb_src->data))->data_ptr[0],
|
||||
tb_size);
|
||||
|
||||
list_add_tail_eurecom(tb_dst, &data_indP->data);
|
||||
data_indP->no_tb += 1;
|
||||
//printf("[RLC-LOOP] Testing tb_dst (2)\n");
|
||||
check_free_mem_block(tb_dst, __func__);
|
||||
} else {
|
||||
printf("Out of memory error\n");
|
||||
// exit(-1);
|
||||
// exit(-1);
|
||||
}
|
||||
} else {
|
||||
printf("[RLC-LOOP] DROPPING 1 TB\n");
|
||||
@@ -434,10 +417,8 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
|
||||
*dropped_tx_packetsP = *dropped_tx_packetsP + 1;
|
||||
}
|
||||
|
||||
|
||||
//printf("[RLC-LOOP] Testing tb_src\n");
|
||||
check_free_mem_block(tb_src, __func__);
|
||||
|
||||
free_mem_block(tb_src, __func__);
|
||||
|
||||
if (data_indP->no_tb > 0) {
|
||||
@@ -460,8 +441,6 @@ void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,
|
||||
struct mac_status_ind tx_status;
|
||||
struct mac_status_resp mac_rlc_status_resp_tx;
|
||||
struct mac_status_resp mac_rlc_status_resp_rx;
|
||||
|
||||
|
||||
memset(&data_request_tx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_request_rx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
|
||||
@@ -469,13 +448,10 @@ void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,
|
||||
memset(&tx_status, 0, sizeof(struct mac_status_ind));
|
||||
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
|
||||
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
|
||||
|
||||
mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
|
||||
data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
|
||||
mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
|
||||
data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
|
||||
|
||||
|
||||
rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
|
||||
rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
|
||||
rlc_um_mac_data_indication(um_rxP, g_frame, um_rxP->is_enb, data_ind_rx);
|
||||
@@ -506,8 +482,6 @@ void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP,
|
||||
struct mac_status_resp mac_rlc_status_resp_tx;
|
||||
struct mac_status_resp mac_rlc_status_resp_rx;
|
||||
int frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
|
||||
|
||||
|
||||
memset(&data_request_tx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_request_rx, 0, sizeof(struct mac_data_req));
|
||||
memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
|
||||
@@ -515,23 +489,16 @@ void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP,
|
||||
memset(&tx_status, 0, sizeof(struct mac_status_ind));
|
||||
memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
|
||||
memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
|
||||
|
||||
mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
|
||||
data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
|
||||
mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
|
||||
data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
|
||||
|
||||
|
||||
rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
|
||||
rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
|
||||
|
||||
rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(&data_ind_rx, time_tx_delayedP);
|
||||
rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(&data_ind_tx, time_rx_delayedP);
|
||||
|
||||
|
||||
rlc_um_mac_data_indication(um_rxP, g_frame, um_rxP->is_enb, g_rx_delayed_indications[frame_modulo]);
|
||||
memset(&g_rx_delayed_indications[frame_modulo], 0, sizeof(struct mac_data_ind));
|
||||
|
||||
rlc_um_mac_data_indication(um_txP, g_frame, um_txP->is_enb, g_tx_delayed_indications[frame_modulo]);
|
||||
memset(&g_tx_delayed_indications[frame_modulo], 0, sizeof(struct mac_data_ind));
|
||||
|
||||
@@ -564,14 +531,12 @@ void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si
|
||||
assert(g_send_id_write_index[rb_idP^1] > g_send_id_read_index[rb_idP]);
|
||||
|
||||
if (g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] != i) {
|
||||
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-2,
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]-2][rb_idP^1]);
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-1,
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]-1][rb_idP^1]);
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP],
|
||||
g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1]);
|
||||
|
||||
printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_id_read_index = %d sdu sent = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP], i);
|
||||
}
|
||||
|
||||
@@ -607,23 +572,15 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
|
||||
{
|
||||
rlc_um_info_t um_info;
|
||||
int i,j,r;
|
||||
|
||||
um_info.timer_reordering = (32 * sn_field_lengthP * sn_field_lengthP)/100;
|
||||
um_info.sn_field_length = sn_field_lengthP;
|
||||
um_info.is_mXch = 0;
|
||||
|
||||
srand (0);
|
||||
config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
|
||||
rlc_um_display_rx_window(&um_tx);
|
||||
|
||||
rlc_um_display_rx_window(&um_rx);
|
||||
|
||||
|
||||
srand (0);
|
||||
|
||||
|
||||
// BIG SDU SMALL PDUS NO ERRORS
|
||||
rlc_um_v9_3_0_test_reset_sdus();
|
||||
|
||||
@@ -665,21 +622,16 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
|
||||
assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
|
||||
printf("\n\n\n\n\n\n\n\n");
|
||||
|
||||
}
|
||||
|
||||
printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_reordering 3: END OF TEST BIG SDU, SMALL PDUs\n\n\n\n");
|
||||
|
||||
rlc_um_v9_3_0_test_reset_sdus();
|
||||
|
||||
for (j = 0; j < 16; j++) {
|
||||
//i = getchar();
|
||||
|
||||
rlc_um_v9_3_0_test_reset_sdus();
|
||||
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
@@ -688,8 +640,6 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
|
||||
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
|
||||
|
||||
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
@@ -702,7 +652,6 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
printf("g_send_id_read_index[1]=%d g_send_id_write_index[0]=%d Loop %d (1)\n", g_send_id_read_index[1], g_send_id_write_index[0], j);
|
||||
assert (g_send_id_read_index[1] != g_send_id_write_index[0]);
|
||||
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
|
||||
@@ -716,7 +665,6 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
|
||||
|
||||
rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
|
||||
printf("g_send_id_read_index[1]=%d g_send_id_write_index[0]=%d Loop %d (2)\n", g_send_id_read_index[1], g_send_id_write_index[0], j);
|
||||
|
||||
assert (g_send_id_read_index[1] != g_send_id_write_index[0]);
|
||||
}
|
||||
|
||||
@@ -728,21 +676,14 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
{
|
||||
rlc_um_info_t um_info;
|
||||
int i,j,r;
|
||||
|
||||
|
||||
um_info.timer_reordering = 32;
|
||||
um_info.sn_field_length = 10;
|
||||
um_info.is_mXch = 0;
|
||||
|
||||
srand (0);
|
||||
config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
|
||||
rlc_um_display_rx_window(&um_tx);
|
||||
|
||||
rlc_um_display_rx_window(&um_rx);
|
||||
|
||||
|
||||
#ifdef TEST1
|
||||
srand (0);
|
||||
rlc_um_v9_3_0_test_reset_sdus();
|
||||
@@ -765,7 +706,6 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
|
||||
assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
|
||||
printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
|
||||
sleep(2);
|
||||
@@ -837,7 +777,6 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 30, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 31, 200);
|
||||
@@ -983,8 +922,6 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
|
||||
g_random_sdu = rand() % 37;
|
||||
//rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
|
||||
|
||||
|
||||
g_random_nb_frames = rand() % 4;
|
||||
|
||||
for (j = 0; j < g_random_nb_frames; j++) {
|
||||
@@ -995,7 +932,6 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
|
||||
//rlc_um_display_rx_window(&um_tx);
|
||||
rlc_um_display_rx_window(&um_rx);
|
||||
|
||||
int dropped = (rand() % 3);
|
||||
|
||||
if ((dropped == 0) && (g_tx_packets > 0)) {
|
||||
@@ -1028,7 +964,6 @@ void rlc_um_v9_3_0_test_tx_rx_10(void)
|
||||
g_target_tx_error_rate,
|
||||
(g_rx_packets >0)?(g_dropped_rx_packets*100)/g_rx_packets:0,
|
||||
g_target_rx_error_rate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,21 +992,14 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
{
|
||||
rlc_um_info_t um_info;
|
||||
int i,j,r;
|
||||
|
||||
|
||||
um_info.timer_reordering = 32;
|
||||
um_info.sn_field_length = 5;
|
||||
um_info.is_mXch = 0;
|
||||
|
||||
srand (0);
|
||||
config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
|
||||
|
||||
rlc_um_display_rx_window(&um_tx);
|
||||
|
||||
rlc_um_display_rx_window(&um_rx);
|
||||
|
||||
|
||||
#ifdef TEST1
|
||||
srand (0);
|
||||
printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_5 1: START OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
|
||||
@@ -1095,7 +1023,6 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
|
||||
|
||||
assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
|
||||
printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_5 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
|
||||
sleep(2);
|
||||
@@ -1163,7 +1090,6 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
|
||||
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 26, 200);
|
||||
rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 27, 200);
|
||||
@@ -1301,8 +1227,6 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
|
||||
g_random_sdu = rand() % 37;
|
||||
//rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
|
||||
|
||||
|
||||
g_random_nb_frames = rand() % 4;
|
||||
|
||||
for (j = 0; j < g_random_nb_frames; j++) {
|
||||
@@ -1313,7 +1237,6 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
|
||||
//rlc_um_display_rx_window(&um_tx);
|
||||
rlc_um_display_rx_window(&um_rx);
|
||||
|
||||
int dropped = (rand() % 3);
|
||||
|
||||
if ((dropped == 0) && (g_tx_packets > 0)) {
|
||||
@@ -1346,7 +1269,6 @@ void rlc_um_v9_3_0_test_tx_rx_5(void)
|
||||
g_target_tx_error_rate,
|
||||
(g_rx_packets >0)?(g_dropped_rx_packets*100)/g_rx_packets:0,
|
||||
g_target_rx_error_rate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1378,11 +1300,9 @@ void rlc_um_v9_3_0_test_print_trace (void)
|
||||
size_t size;
|
||||
char **strings;
|
||||
size_t i;
|
||||
|
||||
size = backtrace (array, 100);
|
||||
strings = backtrace_symbols (array, size);
|
||||
|
||||
printf ("Obtained %d stack frames.\n", size);
|
||||
printf ("Obtained %lu stack frames.\n", (unsigned long)size);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
printf ("%s\n", strings[i]);
|
||||
@@ -1395,23 +1315,15 @@ void rlc_um_v9_3_0_test(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
pool_buffer_init();
|
||||
|
||||
set_comp_log(RLC, LOG_TRACE, LOG_MED, 1);
|
||||
|
||||
|
||||
// tested OK
|
||||
rlc_um_v9_3_0_test_reordering(10);
|
||||
|
||||
rlc_um_v9_3_0_test_tx_rx_10();
|
||||
|
||||
// tested OK
|
||||
rlc_um_v9_3_0_test_windows_10();
|
||||
|
||||
rlc_um_v9_3_0_test_tx_rx_5();
|
||||
rlc_um_v9_3_0_test_windows_5();
|
||||
rlc_um_v9_3_0_test_reordering(5);
|
||||
|
||||
|
||||
printf("rlc_um_v9_3_0_test: END OF TESTS\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ void
|
||||
rlc_module_cleanup (void)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
hashtable_destroy(rlc_coll_p);
|
||||
hashtable_destroy(&rlc_coll_p);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
|
||||
+528
-586
File diff suppressed because it is too large
Load Diff
@@ -46,22 +46,22 @@
|
||||
|
||||
|
||||
#define NIPADDR(addr) \
|
||||
(uint8_t)(addr & 0x000000FF), \
|
||||
(uint8_t)((addr & 0x0000FF00) >> 8), \
|
||||
(uint8_t)((addr & 0x00FF0000) >> 16), \
|
||||
(uint8_t)((addr & 0xFF000000) >> 24)
|
||||
(uint8_t)(addr & 0x000000FF), \
|
||||
(uint8_t)((addr & 0x0000FF00) >> 8), \
|
||||
(uint8_t)((addr & 0x00FF0000) >> 16), \
|
||||
(uint8_t)((addr & 0xFF000000) >> 24)
|
||||
|
||||
|
||||
|
||||
#define NIP6ADDR(addr) \
|
||||
ntohs((addr)->s6_addr16[0]), \
|
||||
ntohs((addr)->s6_addr16[1]), \
|
||||
ntohs((addr)->s6_addr16[2]), \
|
||||
ntohs((addr)->s6_addr16[3]), \
|
||||
ntohs((addr)->s6_addr16[4]), \
|
||||
ntohs((addr)->s6_addr16[5]), \
|
||||
ntohs((addr)->s6_addr16[6]), \
|
||||
ntohs((addr)->s6_addr16[7])
|
||||
ntohs((addr)->s6_addr16[0]), \
|
||||
ntohs((addr)->s6_addr16[1]), \
|
||||
ntohs((addr)->s6_addr16[2]), \
|
||||
ntohs((addr)->s6_addr16[3]), \
|
||||
ntohs((addr)->s6_addr16[4]), \
|
||||
ntohs((addr)->s6_addr16[5]), \
|
||||
ntohs((addr)->s6_addr16[6]), \
|
||||
ntohs((addr)->s6_addr16[7])
|
||||
|
||||
|
||||
// Global variables
|
||||
@@ -76,12 +76,9 @@ struct oai_nw_drv_ioctl gifr;
|
||||
void IAL_NAS_ioctl_init(int inst)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
struct oai_nw_drv_msg_statistic_reply *msgrep;
|
||||
int err,rc;
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
@@ -91,7 +88,6 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
}
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
@@ -160,7 +156,6 @@ int main(int argc,char **argv)
|
||||
char addr_str[46];
|
||||
char mask_len_delims[] = "/";
|
||||
char *result;
|
||||
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
@@ -171,156 +166,155 @@ int main(int argc,char **argv)
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:f:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
strcpy(classref,optarg);
|
||||
classrefset = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&saddr_ipv4);
|
||||
printf("Arg Source Addr IPv4 string: %s\n",result);
|
||||
saddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv4 string: ERROR\n");
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv4 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&daddr_ipv4);
|
||||
printf("Arg Dest Addr IPv4 string: %s\n",result);
|
||||
daddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv4 string: ERROR\n");
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Dest Addr IPv4 mask len: %d\n",dplen);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Source Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv6 string: ERROR\n");
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 128;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv6 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Dest Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv6 string: ERROR\n");
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 128;
|
||||
}
|
||||
case 'f':
|
||||
strcpy(classref,optarg);
|
||||
classrefset = 1;
|
||||
break;
|
||||
|
||||
printf("Arg Dest Addr IPv6 mask len: %d\n",dplen);
|
||||
break;
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
case 's':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
return 1;
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&saddr_ipv4);
|
||||
printf("Arg Source Addr IPv4 string: %s\n",result);
|
||||
saddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
abort ();
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv4 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&daddr_ipv4);
|
||||
printf("Arg Dest Addr IPv4 string: %s\n",result);
|
||||
daddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Dest Addr IPv4 mask len: %d\n",dplen);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Source Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 128;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv6 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Dest Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 128;
|
||||
}
|
||||
|
||||
printf("Arg Dest Addr IPv6 mask len: %d\n",dplen);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
|
||||
if (rbset==0) {
|
||||
@@ -364,13 +358,11 @@ int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct oai_nw_drv_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
printf("OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST: RB %d LCR %d QOS %d\n ", msgreq->rab_id, msgreq->lcr, msgreq->qos);
|
||||
@@ -405,8 +397,6 @@ int main(int argc,char **argv)
|
||||
printf(" IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
@@ -420,7 +410,6 @@ int main(int argc,char **argv)
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
|
||||
printf("IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
@@ -443,7 +432,6 @@ int main(int argc,char **argv)
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
@@ -451,7 +439,6 @@ int main(int argc,char **argv)
|
||||
printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->dplen = splen;
|
||||
@@ -468,7 +455,6 @@ int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
@@ -483,40 +469,26 @@ int main(int argc,char **argv)
|
||||
//msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct=OAI_NW_DRV_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS outlabel %u with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
//msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS inlabel %u with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
@@ -108,12 +108,9 @@ int NAS_RALconnect(void)
|
||||
void IAL_NAS_ioctl_init(int inst)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
struct nas_msg_statistic_reply *msgrep;
|
||||
int err;
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
@@ -123,7 +120,6 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
}
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
gifr.type = NAS_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
@@ -139,8 +135,6 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -160,11 +154,7 @@ int main(int argc,char **argv)
|
||||
in_addr_t saddr_ipv4 = 0,daddr_ipv4 = 0;
|
||||
struct in6_addr saddr_ipv6,daddr_ipv6;
|
||||
unsigned int mpls_outlabel=0,mpls_inlabel=0;
|
||||
|
||||
char addr_str[46];
|
||||
|
||||
|
||||
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
@@ -174,89 +164,87 @@ int main(int argc,char **argv)
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case 's': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
saddr_ipv4 = a.s_addr;
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
case 's': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
saddr_ipv4 = a.s_addr;
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 't': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
daddr_ipv4 = a.s_addr;
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
case 't': {
|
||||
struct in_addr a;
|
||||
inet_aton(optarg,&a);
|
||||
daddr_ipv4 = a.s_addr;
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
|
||||
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
@@ -293,31 +281,27 @@ int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct nas_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
|
||||
msgreq_class->classref = 0 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct = NAS_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
@@ -326,21 +310,20 @@ int main(int argc,char **argv)
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 1+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
}
|
||||
|
||||
@@ -358,38 +341,32 @@ int main(int argc,char **argv)
|
||||
msgreq_class->classref = 2+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
|
||||
inet_ntop(AF_INET6,(void *)&saddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Source %s\n",addr_str);
|
||||
inet_ntop(AF_INET6,(void *)&daddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Dest %s\n",addr_str);
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 3+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
@@ -403,50 +380,34 @@ int main(int argc,char **argv)
|
||||
msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS outlabel %u with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
printf("Setting MPLS inlabel %u with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
|
||||
|
||||
}
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err == -1) perror("ioctl");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
//#define MPLS
|
||||
|
||||
#ifdef MPLS
|
||||
#include <net/mpls.h>
|
||||
#include <net/mpls.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,12 +46,9 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Add a new classifier rule (send direction)
|
||||
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_ADD_SCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
|
||||
#endif
|
||||
@@ -91,8 +88,7 @@ struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_
|
||||
// Add a new classifier rule (receive direction)
|
||||
struct classifier_entity *nas_CLASS_add_rclassifier(uint8_t dscp,
|
||||
uint16_t classref,
|
||||
struct nas_priv *gpriv)
|
||||
{
|
||||
struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -125,8 +121,7 @@ struct classifier_entity *nas_CLASS_add_rclassifier(uint8_t dscp,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Add a new classifier rule (forwarding)
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -166,8 +161,7 @@ struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_sclassifier(struct cx_entity *cx)
|
||||
{
|
||||
void nas_CLASS_flush_sclassifier(struct cx_entity *cx) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -196,8 +190,7 @@ void nas_CLASS_flush_sclassifier(struct cx_entity *cx)
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_fclassifier(struct cx_entity *cx)
|
||||
{
|
||||
void nas_CLASS_flush_fclassifier(struct cx_entity *cx) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -227,8 +220,7 @@ void nas_CLASS_flush_fclassifier(struct cx_entity *cx)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv)
|
||||
{
|
||||
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t dscpi;
|
||||
struct classifier_entity *gc;
|
||||
@@ -251,8 +243,7 @@ void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (send direction)
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -295,8 +286,7 @@ void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t clas
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (send direction)
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
|
||||
{
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -339,8 +329,7 @@ void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t clas
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete a classifier rule (receive direction)
|
||||
void nas_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref,struct nas_priv *gpriv)
|
||||
{
|
||||
void nas_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref,struct nas_priv *gpriv) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p,*np;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
@@ -379,8 +368,7 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
unsigned char dscp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
unsigned int *addr,*dst=NULL;
|
||||
@@ -388,17 +376,12 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
struct classifier_entity *p=NULL;
|
||||
|
||||
if (skb!=NULL) {
|
||||
|
||||
for (cxi=*cx_searcher; cxi<NAS_CX_MAX; cxi++) {
|
||||
|
||||
(*cx_searcher)++;
|
||||
|
||||
p = gpriv->cx[cxi].sclassifier[dscp];
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == 6) { // verify that this is an IPv4 rule
|
||||
|
||||
|
||||
if ((addr = (unsigned int *)(&(p->daddr.ipv6)))== NULL) {
|
||||
printk("nas_CLASS_cx6: addr is null \n");
|
||||
p = p->next;
|
||||
@@ -409,9 +392,8 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
printk("cx %d : %X,%X.%X,%X\n",cxi,addr[0],addr[1],addr[2],addr[3]);
|
||||
#endif //NAS_DEBUG_CLASS
|
||||
|
||||
//if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
|
||||
if ( (dst = &((struct iphdr*)(skb_network_header(skb)))->daddr) == NULL) {
|
||||
|
||||
if ( (dst = &((struct iphdr *)(skb_network_header(skb)))->daddr) == NULL) {
|
||||
printk("nas_CLASS_cx6: dst addr is null \n");
|
||||
p = p->next;
|
||||
continue;
|
||||
@@ -446,11 +428,15 @@ struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
|
||||
}
|
||||
}
|
||||
|
||||
printk("nas_CLASS_cx6 NOT FOUND: %X.%X.%X.%X\n",
|
||||
dst[0],
|
||||
dst[1],
|
||||
dst[2],
|
||||
dst[3]);
|
||||
|
||||
if (dst ) {
|
||||
printk("nas_CLASS_cx6 NOT FOUND: %X.%X.%X.%X\n",
|
||||
dst[0],
|
||||
dst[1],
|
||||
dst[2],
|
||||
dst[3]);
|
||||
}
|
||||
|
||||
return default_ip;
|
||||
}
|
||||
|
||||
@@ -460,8 +446,7 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
unsigned char dscp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
unsigned char *addr;
|
||||
@@ -473,10 +458,9 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
// return(gpriv->cx); //dump to clusterhead
|
||||
|
||||
if (skb!=NULL) {
|
||||
daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
|
||||
daddr = ((struct iphdr *)(skb_network_header(skb)))->daddr;
|
||||
|
||||
if (daddr!=0) {
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][CLASS][IPv4] Searching for %d.%d.%d.%d\n",
|
||||
((unsigned char *)&daddr)[0],
|
||||
@@ -491,7 +475,6 @@ struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == 4) { // verify that this is an IPv4 rule
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
addr = (char *)(&(p->daddr.ipv4));
|
||||
printk("found classifier cx %d for destination: %d.%d.%d.%d\n",cxi,addr[0],addr[1],addr[2],addr[3]);
|
||||
@@ -536,32 +519,23 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
unsigned char exp,
|
||||
struct nas_priv *gpriv,
|
||||
int inst,
|
||||
unsigned char *cx_searcher)
|
||||
{
|
||||
unsigned char *cx_searcher) {
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char cxi;
|
||||
|
||||
struct cx_entity *default_label=NULL;
|
||||
struct classifier_entity *p=NULL;
|
||||
|
||||
// if (inst >0)
|
||||
// return(gpriv->cx); //dump to clusterhead
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
|
||||
printk("[NAS][CLASS][MPLS] Searching for label %d\n",MPLSCB(skb)->label);
|
||||
#endif
|
||||
|
||||
for (cxi=*cx_searcher; cxi<NAS_CX_MAX; ++cxi) {
|
||||
|
||||
(*cx_searcher)++;
|
||||
p = gpriv->cx[cxi].sclassifier[exp];
|
||||
|
||||
while (p!=NULL) {
|
||||
if (p->version == NAS_MPLS_VERSION_CODE) { // verify that this is an MPLS rule
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("cx %d : label %d\n",cxi,p->daddr.mpls_label);
|
||||
#endif //NAS_DEBUG_CLASS
|
||||
@@ -588,11 +562,8 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
// goto to next classification rule for the connection
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return default_label;
|
||||
}
|
||||
|
||||
@@ -600,8 +571,7 @@ struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Search the sending function
|
||||
void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
{
|
||||
void nas_CLASS_send(struct sk_buff *skb,int inst) {
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *p, *sp;
|
||||
uint8_t *protocolh,version;
|
||||
@@ -609,15 +579,10 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
uint16_t classref;
|
||||
struct cx_entity *cx;
|
||||
//unsigned int i;
|
||||
|
||||
//unsigned int router_adv = 0;
|
||||
struct net_device *dev=nasdev[inst];
|
||||
|
||||
struct nas_priv *gpriv=netdev_priv(dev);
|
||||
|
||||
unsigned char cx_searcher,no_connection=1;
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: begin - inst %d\n",inst);
|
||||
#endif
|
||||
@@ -629,9 +594,7 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
|
||||
printk("[NAS][CLASS][SEND] Got packet from kernel:\n");
|
||||
|
||||
for (i=0; i<256; i++)
|
||||
@@ -641,80 +604,65 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
#endif
|
||||
// find all connections related to socket
|
||||
cx_searcher = 0;
|
||||
|
||||
no_connection = 1;
|
||||
|
||||
//while (cx_searcher<NAS_CX_MAX) {
|
||||
|
||||
cx = NULL;
|
||||
|
||||
// Address classification
|
||||
switch (ntohs(skb->protocol)) {
|
||||
case ETH_P_IPV6:
|
||||
version = 6;
|
||||
|
||||
protocolh=nas_TOOL_get_protocol6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
dscp=nas_TOOL_get_dscp6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb))
|
||||
);
|
||||
case ETH_P_IPV6:
|
||||
version = 6;
|
||||
protocolh=nas_TOOL_get_protocol6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
dscp=nas_TOOL_get_dscp6(
|
||||
(struct ipv6hdr *)(skb_network_header(skb))
|
||||
);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: %p %d %p %d %p \n",skb, dscp, gpriv, inst, &cx_searcher);
|
||||
printk("NAS_CLASS_SEND: %p %d %p %d %p \n",skb, dscp, gpriv, inst, &cx_searcher);
|
||||
#endif
|
||||
cx=nas_CLASS_cx6(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
|
||||
|
||||
cx=nas_CLASS_cx6(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got IPv6 packet, dscp = %d\n",dscp);
|
||||
printk("NAS_CLASS_SEND: Got IPv6 packet, dscp = %d\n",dscp);
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
|
||||
case ETH_P_IP:
|
||||
|
||||
|
||||
dscp=nas_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
|
||||
cx=nas_CLASS_cx4(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
protocolh=nas_TOOL_get_protocol4(
|
||||
(struct iphdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
case ETH_P_IP:
|
||||
dscp=nas_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
|
||||
cx=nas_CLASS_cx4(skb,dscp,gpriv,inst,&cx_searcher);
|
||||
protocolh=nas_TOOL_get_protocol4(
|
||||
(struct iphdr *)(skb_network_header(skb)),
|
||||
&protocol);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got IPv4 packet (%x), dscp = %d, cx = %x\n",ntohs(skb->protocol),dscp,cx);
|
||||
printk("NAS_CLASS_SEND: Got IPv4 packet (%x), dscp = %d, cx = %x\n",ntohs(skb->protocol),dscp,cx);
|
||||
#endif
|
||||
version = 4;
|
||||
|
||||
break;
|
||||
version = 4;
|
||||
break;
|
||||
#ifdef MPLS
|
||||
|
||||
case ETH_P_MPLS_UC:
|
||||
cx=nas_CLASS_MPLS(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
|
||||
|
||||
case ETH_P_MPLS_UC:
|
||||
cx=nas_CLASS_MPLS(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: Got MPLS unicast packet, exp = %d, label = %d, cx = %x\n",MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
|
||||
printk("NAS_CLASS_SEND: Got MPLS unicast packet, exp = %d, label = %d, cx = %x\n",MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
|
||||
#endif
|
||||
dscp = MPLSCB(skb)->exp;
|
||||
version = NAS_MPLS_VERSION_CODE;
|
||||
protocol = version;
|
||||
break;
|
||||
#endif
|
||||
|
||||
dscp = MPLSCB(skb)->exp;
|
||||
version = NAS_MPLS_VERSION_CODE;
|
||||
protocol = version;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
printk("NAS_CLASS_SEND: Unknown protocol\n");
|
||||
version = 0;
|
||||
return;
|
||||
default:
|
||||
printk("NAS_CLASS_SEND: Unknown protocol\n");
|
||||
version = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If a valid connection for the DSCP/EXP with destination address
|
||||
// is found scan all protocol-based classification rules
|
||||
|
||||
if (cx) {
|
||||
|
||||
classref=0;
|
||||
sp=NULL;
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][CLASSIFIER] DSCP/EXP %d : looking for classifier entry\n",dscp);
|
||||
#endif
|
||||
@@ -738,12 +686,10 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
classref=sp->classref;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sp!=NULL) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
char sfct[10], sprotocol[10];
|
||||
|
||||
if (sp->fct==nas_COMMON_QOS_send)
|
||||
@@ -759,41 +705,38 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
strcpy(sfct, "dc");
|
||||
|
||||
switch(protocol) {
|
||||
case NAS_PROTOCOL_UDP:
|
||||
strcpy(sprotocol, "udp");
|
||||
printk("udp packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_UDP:
|
||||
strcpy(sprotocol, "udp");
|
||||
printk("udp packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_TCP:
|
||||
strcpy(sprotocol, "tcp");
|
||||
printk("tcp packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_TCP:
|
||||
strcpy(sprotocol, "tcp");
|
||||
printk("tcp packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_ICMP4:
|
||||
strcpy(sprotocol, "icmp4");
|
||||
printk("icmp4 packet\n");
|
||||
break;
|
||||
case NAS_PROTOCOL_ICMP4:
|
||||
strcpy(sprotocol, "icmp4");
|
||||
printk("icmp4 packet\n");
|
||||
break;
|
||||
|
||||
case NAS_PROTOCOL_ICMP6:
|
||||
strcpy(sprotocol, "icmp6");
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
|
||||
break;
|
||||
case NAS_PROTOCOL_ICMP6:
|
||||
strcpy(sprotocol, "icmp6");
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr *)protocolh);
|
||||
break;
|
||||
#ifdef MPLS
|
||||
|
||||
case NAS_MPLS_VERSION_CODE:
|
||||
strcpy(sprotocol,"mpls");
|
||||
break;
|
||||
case NAS_MPLS_VERSION_CODE:
|
||||
strcpy(sprotocol,"mpls");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
printk("NAS_CLASS_SEND: (dscp %u, %s) received, (classref %u, fct %s, rab_id %u) classifier rule\n",
|
||||
dscp, sprotocol, sp->classref, sfct, sp->rab_id);
|
||||
#endif
|
||||
|
||||
sp->fct(skb, cx, sp,inst, NULL);
|
||||
|
||||
} // if classifier entry match found
|
||||
|
||||
else {
|
||||
printk("NAS_CLASS_SEND: no corresponding item in the classifier, so the message is dropped\n");
|
||||
// nas_COMMON_del_send(skb, cx, NULL,inst);
|
||||
@@ -802,20 +745,14 @@ void nas_CLASS_send(struct sk_buff *skb,int inst)
|
||||
no_connection = 0;
|
||||
} // if connection found
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
|
||||
if (no_connection == 1)
|
||||
printk("NAS_CLASS_SEND: no corresponding connection, so the message is dropped\n");
|
||||
|
||||
#endif /* NAS_DEBUG_CLASS */
|
||||
|
||||
|
||||
// } // while loop over connections
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_CLASS_SEND: end\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ int ue_ip_netlink_init(void)
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
|
||||
THIS_MODULE,
|
||||
# endif
|
||||
&cfg
|
||||
&cfg);
|
||||
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
nas_nl_sk = netlink_kernel_create(
|
||||
&init_net,
|
||||
@@ -120,7 +120,7 @@ int ue_ip_netlink_init(void)
|
||||
&nasmesh_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (nas_nl_sk == NULL) {
|
||||
|
||||
@@ -1401,16 +1401,12 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
|
||||
}
|
||||
}
|
||||
|
||||
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid];
|
||||
DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid];
|
||||
SRB_configList2 = &(ue_context_pP->ue_context.SRB_configList2[next_xid]);
|
||||
DRB_configList2 = &(ue_context_pP->ue_context.DRB_configList2[next_xid]);
|
||||
|
||||
if(SRB_configList2!=NULL) {
|
||||
if (*SRB_configList2) {
|
||||
free(*SRB_configList2);
|
||||
LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RRC, "SRB_configList2 is null\n");
|
||||
if (*SRB_configList2) {
|
||||
free(*SRB_configList2);
|
||||
LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
|
||||
}
|
||||
|
||||
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
|
||||
@@ -1428,13 +1424,9 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
|
||||
LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n");
|
||||
}
|
||||
|
||||
if(DRB_configList2!=NULL) {
|
||||
if (*DRB_configList2) {
|
||||
free(*DRB_configList2);
|
||||
LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RRC, "DRB_configList2 is null\n");
|
||||
if (*DRB_configList2) {
|
||||
free(*DRB_configList2);
|
||||
LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
|
||||
}
|
||||
|
||||
*DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
|
||||
|
||||
@@ -276,7 +276,7 @@ rrc_eNB_S1AP_get_ue_ids(
|
||||
} else {
|
||||
LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n",
|
||||
rrc_instance_pP - RC.rrc[0],
|
||||
ue_context_p->ue_context.eNB_ue_s1ap_id,
|
||||
(ue_context_p==NULL)?99999:ue_context_p->ue_context.eNB_ue_s1ap_id,
|
||||
eNB_ue_s1ap_id,
|
||||
result->ue_rnti);
|
||||
}
|
||||
@@ -306,8 +306,7 @@ rrc_eNB_S1AP_remove_ue_ids(
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id;
|
||||
const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id;
|
||||
|
||||
hashtable_rc_t h_rc;
|
||||
|
||||
if (rrc_instance_pP == NULL) {
|
||||
@@ -319,7 +318,8 @@ rrc_eNB_S1AP_remove_ue_ids(
|
||||
LOG_E(RRC, "Trying to free a NULL S1AP UE IDs\n");
|
||||
return;
|
||||
}
|
||||
|
||||
const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id;
|
||||
const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id;
|
||||
if (eNB_ue_s1ap_id > 0) {
|
||||
h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id);
|
||||
|
||||
|
||||
@@ -193,10 +193,11 @@ int main(void)
|
||||
sprintf(s, "hello");
|
||||
if (message_put(q, s, 6, 0)) goto error;
|
||||
destroy_message_queue(q);
|
||||
|
||||
free(s);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
free(s);
|
||||
printf("error\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -35,25 +35,19 @@
|
||||
//#include <mpi.h>
|
||||
|
||||
|
||||
void job_list_init (Job_List_t * listP)
|
||||
{
|
||||
|
||||
void job_list_init (Job_List_t *listP) {
|
||||
listP->tail = NULL;
|
||||
listP->head = NULL;
|
||||
listP->nb_elements = 0;
|
||||
}
|
||||
|
||||
void event_list_init (Event_List_t * listP)
|
||||
{
|
||||
|
||||
void event_list_init (Event_List_t *listP) {
|
||||
listP->tail = NULL;
|
||||
listP->head = NULL;
|
||||
listP->nb_elements = 0;
|
||||
}
|
||||
|
||||
void pkt_list_init (Packet_OTG_List_t * listP)
|
||||
{
|
||||
|
||||
void pkt_list_init (Packet_OTG_List_t *listP) {
|
||||
listP->tail = NULL;
|
||||
listP->head = NULL;
|
||||
listP->nb_elements = 0;
|
||||
@@ -61,8 +55,7 @@ void pkt_list_init (Packet_OTG_List_t * listP)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void job_list_free (Job_List_t * listP)
|
||||
{
|
||||
void job_list_free (Job_List_t *listP) {
|
||||
Job_elt_t *le;
|
||||
|
||||
while ((le = job_list_remove_head (listP))) {
|
||||
@@ -70,8 +63,7 @@ void job_list_free (Job_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void event_list_free (Event_List_t * listP)
|
||||
{
|
||||
void event_list_free (Event_List_t *listP) {
|
||||
Event_elt_t *le;
|
||||
|
||||
while ((le = event_list_remove_head (listP))) {
|
||||
@@ -79,8 +71,7 @@ void event_list_free (Event_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void pkt_list_free (Packet_OTG_List_t * listP)
|
||||
{
|
||||
void pkt_list_free (Packet_OTG_List_t *listP) {
|
||||
Packet_otg_elt_t *le;
|
||||
|
||||
while ((le = pkt_list_remove_head (listP))) {
|
||||
@@ -90,18 +81,15 @@ void pkt_list_free (Packet_OTG_List_t * listP)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Job_elt_t * job_list_get_head (Job_List_t * listP)
|
||||
{
|
||||
Job_elt_t *job_list_get_head (Job_List_t *listP) {
|
||||
return listP->head;
|
||||
}
|
||||
|
||||
Event_elt_t * event_list_get_head (Event_List_t * listP)
|
||||
{
|
||||
Event_elt_t *event_list_get_head (Event_List_t *listP) {
|
||||
return listP->head;
|
||||
}
|
||||
|
||||
Packet_otg_elt_t * pkt_list_get_head (Packet_OTG_List_t * listP)
|
||||
{
|
||||
Packet_otg_elt_t *pkt_list_get_head (Packet_OTG_List_t *listP) {
|
||||
return listP->head;
|
||||
}
|
||||
|
||||
@@ -112,9 +100,7 @@ Packet_otg_elt_t * pkt_list_get_head (Packet_OTG_List_t * listP)
|
||||
* @param pointer on targeted list
|
||||
* @return pointer on removed Job_elt_t
|
||||
*/
|
||||
Job_elt_t * job_list_remove_head (Job_List_t * listP)
|
||||
{
|
||||
|
||||
Job_elt_t *job_list_remove_head (Job_List_t *listP) {
|
||||
// access optimisation
|
||||
Job_elt_t *head;
|
||||
head = listP->head;
|
||||
@@ -137,9 +123,7 @@ Job_elt_t * job_list_remove_head (Job_List_t * listP)
|
||||
return head;
|
||||
}
|
||||
|
||||
Event_elt_t * event_list_remove_head (Event_List_t * listP)
|
||||
{
|
||||
|
||||
Event_elt_t *event_list_remove_head (Event_List_t *listP) {
|
||||
// access optimisation
|
||||
Event_elt_t *head;
|
||||
head = listP->head;
|
||||
@@ -162,9 +146,7 @@ Event_elt_t * event_list_remove_head (Event_List_t * listP)
|
||||
return head;
|
||||
}
|
||||
|
||||
Packet_otg_elt_t * pkt_list_remove_head (Packet_OTG_List_t * listP)
|
||||
{
|
||||
|
||||
Packet_otg_elt_t *pkt_list_remove_head (Packet_OTG_List_t *listP) {
|
||||
// access optimisation
|
||||
Packet_otg_elt_t *head;
|
||||
head = listP->head;
|
||||
@@ -189,9 +171,7 @@ Packet_otg_elt_t * pkt_list_remove_head (Packet_OTG_List_t * listP)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Job_elt_t * job_list_remove_element (Job_elt_t * elementP, Job_List_t * listP)
|
||||
{
|
||||
|
||||
Job_elt_t *job_list_remove_element (Job_elt_t *elementP, Job_List_t *listP) {
|
||||
// access optimisation;
|
||||
Job_elt_t *head;
|
||||
|
||||
@@ -233,9 +213,7 @@ Job_elt_t * job_list_remove_element (Job_elt_t * elementP, Job_List_t * listP)
|
||||
return elementP;
|
||||
}
|
||||
|
||||
Event_elt_t * event_list_remove_element (Event_elt_t * elementP, Event_List_t * listP)
|
||||
{
|
||||
|
||||
Event_elt_t *event_list_remove_element (Event_elt_t *elementP, Event_List_t *listP) {
|
||||
// access optimisation;
|
||||
Event_elt_t *head;
|
||||
|
||||
@@ -277,9 +255,7 @@ Event_elt_t * event_list_remove_element (Event_elt_t * elementP, Event_List_t *
|
||||
return elementP;
|
||||
}
|
||||
|
||||
Packet_otg_elt_t * pkt_list_remove_element (Packet_otg_elt_t * elementP, Packet_OTG_List_t * listP)
|
||||
{
|
||||
|
||||
Packet_otg_elt_t *pkt_list_remove_element (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
|
||||
// access optimisation;
|
||||
Packet_otg_elt_t *head;
|
||||
|
||||
@@ -328,9 +304,7 @@ Packet_otg_elt_t * pkt_list_remove_element (Packet_otg_elt_t * elementP, Packet_
|
||||
* @return pointer on removed Job_elt_t
|
||||
*/
|
||||
|
||||
void job_list_add_head (Job_elt_t * elementP, Job_List_t * listP)
|
||||
{
|
||||
|
||||
void job_list_add_head (Job_elt_t *elementP, Job_List_t *listP) {
|
||||
// access optimisation;
|
||||
Job_elt_t *head;
|
||||
|
||||
@@ -349,9 +323,7 @@ void job_list_add_head (Job_elt_t * elementP, Job_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void event_list_add_head (Event_elt_t * elementP, Event_List_t * listP)
|
||||
{
|
||||
|
||||
void event_list_add_head (Event_elt_t *elementP, Event_List_t *listP) {
|
||||
// access optimisation;
|
||||
Event_elt_t *head;
|
||||
|
||||
@@ -370,9 +342,7 @@ void event_list_add_head (Event_elt_t * elementP, Event_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void pkt_list_add_head (Packet_otg_elt_t * elementP, Packet_OTG_List_t * listP)
|
||||
{
|
||||
|
||||
void pkt_list_add_head (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
|
||||
// access optimisation;
|
||||
Packet_otg_elt_t *head;
|
||||
|
||||
@@ -391,14 +361,12 @@ void pkt_list_add_head (Packet_otg_elt_t * elementP, Packet_OTG_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void event_list_add_element (Event_elt_t * elementP, Event_elt_t * previous, Event_List_t * listP)
|
||||
{
|
||||
|
||||
void event_list_add_element (Event_elt_t *elementP, Event_elt_t *previous, Event_List_t *listP) {
|
||||
// access optimisation;
|
||||
Event_elt_t *next;
|
||||
elementP->next = NULL;
|
||||
|
||||
if (elementP != NULL && previous != NULL) {
|
||||
elementP->next = NULL;
|
||||
next = previous->next;
|
||||
listP->nb_elements = listP->nb_elements + 1;
|
||||
|
||||
@@ -420,8 +388,7 @@ void event_list_add_element (Event_elt_t * elementP, Event_elt_t * previous, Eve
|
||||
* @param pointer on targeted list
|
||||
* @return pointer on removed Job_elt_t
|
||||
*/
|
||||
void job_list_add_tail_eurecom (Job_elt_t * elementP, Job_List_t * listP)
|
||||
{
|
||||
void job_list_add_tail_eurecom (Job_elt_t *elementP, Job_List_t *listP) {
|
||||
Job_elt_t *tail;
|
||||
|
||||
if (elementP != NULL) {
|
||||
@@ -443,8 +410,7 @@ void job_list_add_tail_eurecom (Job_elt_t * elementP, Job_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void event_list_add_tail_eurecom (Event_elt_t * elementP, Event_List_t * listP)
|
||||
{
|
||||
void event_list_add_tail_eurecom (Event_elt_t *elementP, Event_List_t *listP) {
|
||||
Event_elt_t *tail;
|
||||
|
||||
if (elementP != NULL) {
|
||||
@@ -466,8 +432,7 @@ void event_list_add_tail_eurecom (Event_elt_t * elementP, Event_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void pkt_list_add_tail_eurecom (Packet_otg_elt_t * elementP, Packet_OTG_List_t * listP)
|
||||
{
|
||||
void pkt_list_add_tail_eurecom (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
|
||||
Packet_otg_elt_t *tail;
|
||||
|
||||
if (elementP != NULL) {
|
||||
@@ -490,14 +455,11 @@ void pkt_list_add_tail_eurecom (Packet_otg_elt_t * elementP, Packet_OTG_List_t *
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void job_list_add_list (Job_List_t * sublistP, Job_List_t * listP)
|
||||
{
|
||||
|
||||
void job_list_add_list (Job_List_t *sublistP, Job_List_t *listP) {
|
||||
if (sublistP) {
|
||||
if (sublistP->head) {
|
||||
// access optimisation
|
||||
Job_elt_t *tail;
|
||||
|
||||
tail = listP->tail;
|
||||
|
||||
// almost one element
|
||||
@@ -517,14 +479,11 @@ void job_list_add_list (Job_List_t * sublistP, Job_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void event_list_add_list (Event_List_t * sublistP, Event_List_t * listP)
|
||||
{
|
||||
|
||||
void event_list_add_list (Event_List_t *sublistP, Event_List_t *listP) {
|
||||
if (sublistP) {
|
||||
if (sublistP->head) {
|
||||
// access optimisation
|
||||
Event_elt_t *tail;
|
||||
|
||||
tail = listP->tail;
|
||||
|
||||
// almost one element
|
||||
@@ -544,14 +503,11 @@ void event_list_add_list (Event_List_t * sublistP, Event_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void pkt_list_add_list (Packet_OTG_List_t * sublistP, Packet_OTG_List_t * listP)
|
||||
{
|
||||
|
||||
void pkt_list_add_list (Packet_OTG_List_t *sublistP, Packet_OTG_List_t *listP) {
|
||||
if (sublistP) {
|
||||
if (sublistP->head) {
|
||||
// access optimisation
|
||||
Packet_otg_elt_t *tail;
|
||||
|
||||
tail = listP->tail;
|
||||
|
||||
// almost one element
|
||||
@@ -572,11 +528,8 @@ void pkt_list_add_list (Packet_OTG_List_t * sublistP, Packet_OTG_List_t * listP)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void job_list_display (Job_List_t * listP)
|
||||
{
|
||||
|
||||
void job_list_display (Job_List_t *listP) {
|
||||
//Correct the output once the content of struct Job is fixed
|
||||
|
||||
/*Job_elt_t *cursor;
|
||||
unsigned short nb_elements = 0;
|
||||
|
||||
@@ -605,8 +558,7 @@ void job_list_display (Job_List_t * listP)
|
||||
}*/
|
||||
}
|
||||
|
||||
void event_list_display (Event_List_t * listP)
|
||||
{
|
||||
void event_list_display (Event_List_t *listP) {
|
||||
Event_elt_t *cursor;
|
||||
unsigned short nb_elements = 0;
|
||||
|
||||
@@ -630,8 +582,7 @@ void event_list_display (Event_List_t * listP)
|
||||
}
|
||||
}
|
||||
|
||||
void pkt_list_display (Packet_OTG_List_t * listP)
|
||||
{
|
||||
void pkt_list_display (Packet_OTG_List_t *listP) {
|
||||
Packet_otg_elt_t *cursor;
|
||||
unsigned short nb_elements = 0;
|
||||
|
||||
|
||||
+20
-30
@@ -41,9 +41,7 @@ unsigned int s0[MAX_NUM_COMPS], s1[MAX_NUM_COMPS], s2[MAX_NUM_COMPS], b[MAX_NUM_
|
||||
|
||||
|
||||
|
||||
inline unsigned int taus(unsigned int comp)
|
||||
{
|
||||
|
||||
inline unsigned int taus(unsigned int comp) {
|
||||
b[comp] = (((s0[comp] << 13) ^ s0[comp]) >> 19);
|
||||
s0[comp] = (((s0[comp] & 0xFFFFFFFE) << 12)^ b[comp]);
|
||||
b[comp] = (((s1[comp] << 2) ^ s1[comp]) >> 25);
|
||||
@@ -54,42 +52,36 @@ 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 ++) {
|
||||
|
||||
switch (seed_type) {
|
||||
case 0: // use rand func
|
||||
if (i == 0) srand(time(NULL));
|
||||
case 0: // use rand func
|
||||
if (i == 0) srand(time(NULL));
|
||||
|
||||
s0[i] = ((unsigned int)rand());
|
||||
s1[i] = ((unsigned int)rand());
|
||||
s2[i] = ((unsigned int)rand());
|
||||
printf("Initial seeds use rand: s0[%d] = 0x%x, s1[%d] = 0x%x, s2[%d] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
|
||||
break;
|
||||
s0[i] = ((unsigned int)rand());
|
||||
s1[i] = ((unsigned int)rand());
|
||||
s2[i] = ((unsigned int)rand());
|
||||
printf("Initial seeds use rand: s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
|
||||
break;
|
||||
|
||||
case 1: // use rand with seed
|
||||
if (i == 0) srand(0x1e23d851);
|
||||
case 1: // use rand with seed
|
||||
if (i == 0) srand(0x1e23d851);
|
||||
|
||||
s0[i] = ((unsigned int)rand());
|
||||
s1[i] = ((unsigned int)rand());
|
||||
s2[i] = ((unsigned int)rand());
|
||||
printf("Initial seeds use rand with seed : s0[%d] = 0x%x, s1[%d] = 0x%x, s2[%d] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
s0[i] = ((unsigned int)rand());
|
||||
s1[i] = ((unsigned int)rand());
|
||||
s2[i] = ((unsigned int)rand());
|
||||
printf("Initial seeds use rand with seed : s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int get_rand (unsigned int comp)
|
||||
{
|
||||
int get_rand (unsigned int comp) {
|
||||
if ((comp > MIN_NUM_COMPS) && (comp < MAX_NUM_COMPS))
|
||||
return r[comp];
|
||||
else {
|
||||
@@ -98,9 +90,7 @@ int get_rand (unsigned int comp)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int dtaus(unsigned int comp, unsigned int a, unsigned b)
|
||||
{
|
||||
|
||||
unsigned int dtaus(unsigned int comp, unsigned int a, unsigned b) {
|
||||
return (int) (((double)taus(comp)/(double)0xffffffff)* (double)(b-a) + (double)a);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -39,84 +39,60 @@
|
||||
#include "OCG_config_mobi.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int config_mobi(char mobigen_filename[FILENAME_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX])
|
||||
{
|
||||
int config_mobi(char mobigen_filename[FILENAME_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX]) {
|
||||
// for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html
|
||||
|
||||
char dir_to_mobigen_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
|
||||
char dir_to_mobigen_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX];
|
||||
char mobi_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
|
||||
xmlTextWriterPtr writer;
|
||||
|
||||
strcpy(dir_to_mobigen_file, DIR_TO_MOBIGEN);
|
||||
strcat(dir_to_mobigen_file, mobigen_filename);
|
||||
/* Create a new XmlWriter for uri, with no compression. */
|
||||
writer = xmlNewTextWriterFilename(dir_to_mobigen_file, 0);
|
||||
|
||||
// set the output format of the XML file
|
||||
xmlTextWriterSetIndent(writer, 1);
|
||||
xmlTextWriterSetIndentString(writer, " ");
|
||||
|
||||
/* Start the document with the xml default for the version,
|
||||
* encoding ISO 8859-1 and the default for the standalone
|
||||
* declaration. */
|
||||
xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
|
||||
|
||||
/* Start an element named "EXAMPLE". Since this is the first
|
||||
* element, this will be the root element of the document. */
|
||||
xmlTextWriterStartElement(writer, "universe");
|
||||
|
||||
/* Write an element named "X_ORDER_ID" as child of HEADER. */
|
||||
xmlTextWriterWriteFormatElement(writer, "dimx", "%lf", oai_emulation.topo_config.area.x);
|
||||
|
||||
/* Write an element named "X_ORDER_ID" as child of HEADER. */
|
||||
xmlTextWriterWriteFormatElement(writer, "dimy", "%lf", oai_emulation.topo_config.area.y);
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "seed", "%d", 1);
|
||||
|
||||
xmlTextWriterStartElement(writer, "extension");
|
||||
xmlTextWriterWriteAttribute(writer, "class", "de.uni_stuttgart.informatik.canu.mobisim.simulations.TimeSimulation");
|
||||
xmlTextWriterWriteFormatAttribute(writer, "param", "%lf", oai_emulation.emu_config.emu_time);
|
||||
xmlTextWriterEndElement(writer);
|
||||
|
||||
xmlTextWriterStartElement(writer, "extension");
|
||||
xmlTextWriterWriteAttribute(writer, "class", "de.uni_stuttgart.informatik.canu.spatialmodel.core.SpatialModel");
|
||||
xmlTextWriterWriteFormatAttribute(writer, "max_x", "%lf", oai_emulation.topo_config.area.x);
|
||||
xmlTextWriterWriteFormatAttribute(writer, "max_y", "%lf", oai_emulation.topo_config.area.y);
|
||||
xmlTextWriterWriteAttribute(writer, "min_x", "0");
|
||||
xmlTextWriterWriteAttribute(writer, "min_y", "0");
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "dump_boundary_points", "%s", "false");
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "separated_flow", "%s", "false");
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "max_traffic_lights", "%d", 500);
|
||||
|
||||
xmlTextWriterEndElement(writer);
|
||||
|
||||
xmlTextWriterStartElement(writer, "extension");
|
||||
xmlTextWriterWriteAttribute(writer, "class", "de.uni_stuttgart.informatik.canu.mobisim.extensions.ReportNodeMobility");
|
||||
|
||||
strcpy(mobi_file, MOBI_XML_FOLDER);
|
||||
strcat(mobi_file, filename);
|
||||
xmlTextWriterWriteAttribute(writer, "output", mobi_file);
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "step", "%d", 1);
|
||||
|
||||
xmlTextWriterEndElement(writer);
|
||||
|
||||
xmlTextWriterStartElement(writer, "nodegroup");
|
||||
xmlTextWriterWriteAttribute(writer, "car2x", "false");
|
||||
xmlTextWriterWriteAttribute(writer, "id", "");
|
||||
xmlTextWriterWriteAttribute(writer, "n", "50");
|
||||
xmlTextWriterWriteAttribute(writer, "type", "car");
|
||||
|
||||
xmlTextWriterStartElement(writer, "position");
|
||||
xmlTextWriterWriteAttribute(writer, "random", "true");
|
||||
|
||||
xmlTextWriterWriteFormatElement(writer, "z", "%s", "0.0");
|
||||
|
||||
xmlTextWriterEndElement(writer);
|
||||
|
||||
xmlTextWriterStartElement(writer, "extension");
|
||||
xmlTextWriterWriteAttribute(writer, "class", "de.uni_stuttgart.informatik.canu.mobisim.mobilitymodels.RandomWaypointWalk");
|
||||
|
||||
@@ -134,12 +110,8 @@ int config_mobi(char mobigen_filename[FILENAME_LENGTH_MAX], char filename[FILENA
|
||||
|
||||
// Close the element named HEADER.
|
||||
xmlTextWriterEndElement(writer);
|
||||
|
||||
|
||||
xmlTextWriterEndDocument(writer);
|
||||
|
||||
xmlFreeTextWriter(writer);
|
||||
|
||||
return MODULE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,39 +42,29 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX])
|
||||
{
|
||||
int generate_report(char dst_dir[DIR_LENGTH_MAX], char filename[FILENAME_LENGTH_MAX]) {
|
||||
// for the xml writer, refer to http://xmlsoft.org/html/libxml-xmlwriter.html
|
||||
|
||||
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX] = "";
|
||||
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);
|
||||
|
||||
char dst_file[FILENAME_LENGTH_MAX + DIR_LENGTH_MAX];
|
||||
strncpy(dst_file, dst_dir, FILENAME_LENGTH_MAX + DIR_LENGTH_MAX - strlen(filename) - 1);
|
||||
strcat(dst_file, filename);
|
||||
xmlTextWriterPtr writer;
|
||||
|
||||
writer = xmlNewTextWriterFilename(dst_file, 0);
|
||||
|
||||
// set the output format of the XML file
|
||||
xmlTextWriterSetIndent(writer, 1);
|
||||
xmlTextWriterSetIndentString(writer,(unsigned char*) " ");
|
||||
|
||||
xmlTextWriterSetIndentString(writer,(unsigned char *) " ");
|
||||
xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
|
||||
|
||||
/* Write an element named "X_ORDER_ID" as child of HEADER. */
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "COMMENT ", " in this output file, %d means NOT_PROCESSED; %d means NO_FILE; %d means ERROR; %d means OK ", MODULE_NOT_PROCESSED,
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "COMMENT ", " in this output file, %d means NOT_PROCESSED; %d means NO_FILE; %d means ERROR; %d means OK ", MODULE_NOT_PROCESSED,
|
||||
NO_FILE, MODULE_ERROR, MODULE_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_GET_OPT ", " %d ", get_opt_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_DETECT_FILE ", " %d ", detect_file_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_PARSE_FILENAME", " %d ", parse_filename_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_CREATE_DIR ", " %d ", create_dir_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_PARSE_XML ", " %d ", parse_XML_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char*) "OCG_SAVE_XML ", " %d ", save_XML_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_GET_OPT ", " %d ", get_opt_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_DETECT_FILE ", " %d ", detect_file_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_PARSE_FILENAME", " %d ", parse_filename_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_CREATE_DIR ", " %d ", create_dir_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_PARSE_XML ", " %d ", parse_XML_OK);
|
||||
xmlTextWriterWriteFormatElement(writer,(unsigned char *) "OCG_SAVE_XML ", " %d ", save_XML_OK);
|
||||
// xmlTextWriterWriteFormatElement(writer, "OCG_CALL_EMU ", " %d ", call_emu_OK);
|
||||
|
||||
xmlTextWriterEndDocument(writer);
|
||||
|
||||
xmlFreeTextWriter(writer);
|
||||
|
||||
LOG_I(OCG, "A report of OCG is generated in directory \"%s\"\n\n", dst_dir);
|
||||
return MODULE_OK;
|
||||
}
|
||||
|
||||
+488
-537
File diff suppressed because it is too large
Load Diff
@@ -43,8 +43,7 @@
|
||||
* @returns hash_table_element_t object when success
|
||||
* @returns NULL when no memory
|
||||
*/
|
||||
hash_table_element_t * hash_table_element_new(void)
|
||||
{
|
||||
hash_table_element_t *hash_table_element_new(void) {
|
||||
//INFO("creating a new hash table element");
|
||||
return calloc(1, hash_table_element_s);
|
||||
}
|
||||
@@ -54,8 +53,7 @@ hash_table_element_t * hash_table_element_new(void)
|
||||
* @param table table from which element has to be deleted
|
||||
* @param element hash table element to be deleted
|
||||
*/
|
||||
void hash_table_element_delete(omg_hash_table_t * table, hash_table_element_t * element)
|
||||
{
|
||||
void hash_table_element_delete(omg_hash_table_t *table, hash_table_element_t *element) {
|
||||
//INFO("Deleting an hash table element");
|
||||
if (table->mode == MODE_COPY) {
|
||||
free(element->value);
|
||||
@@ -74,8 +72,7 @@ void hash_table_element_delete(omg_hash_table_t * table, hash_table_element_t *
|
||||
* @returns omg_hash_table_t object which references the hash table
|
||||
* @returns NULL when no memory
|
||||
*/
|
||||
omg_hash_table_t * hash_table_new(hash_table_mode_t mode)
|
||||
{
|
||||
omg_hash_table_t *hash_table_new(hash_table_mode_t mode) {
|
||||
//INFO("Creating a new hash table");
|
||||
omg_hash_table_t *table = calloc(1, SIZEOF_HASH_TABLE);
|
||||
|
||||
@@ -102,14 +99,13 @@ omg_hash_table_t * hash_table_new(hash_table_mode_t mode)
|
||||
* Function to delete the hash table
|
||||
* @param table hash table to be deleted
|
||||
*/
|
||||
void hash_table_delete(omg_hash_table_t * table)
|
||||
{
|
||||
void hash_table_delete(omg_hash_table_t *table) {
|
||||
//INFO("Deleating a hash table");
|
||||
size_t i=0;
|
||||
|
||||
for (; i<HASH_LEN; i++) {
|
||||
while (table->store_house[i]) {
|
||||
hash_table_element_t * temp = table->store_house[i];
|
||||
hash_table_element_t *temp = table->store_house[i];
|
||||
table->store_house[i] = table->store_house[i]->next;
|
||||
hash_table_element_delete(table, temp);
|
||||
}
|
||||
@@ -129,8 +125,7 @@ void hash_table_delete(omg_hash_table_t * table)
|
||||
* @returns 0 on sucess
|
||||
* @returns -1 when no memory
|
||||
*/
|
||||
int hash_table_add(omg_hash_table_t * table, void * key, size_t key_len, void * value, size_t value_len)
|
||||
{
|
||||
int hash_table_add(omg_hash_table_t *table, void *key, size_t key_len, void *value, size_t value_len) {
|
||||
if ((table->key_count / table->key_num) >= table->key_ratio) {
|
||||
//LOG("Ratio(%d) reached the set limit %d\nExpanding hash_table", (table->key_count / table->key_num), table->key_ratio);
|
||||
hash_table_resize(table, table->key_num*2);
|
||||
@@ -138,7 +133,7 @@ int hash_table_add(omg_hash_table_t * table, void * key, size_t key_len, void *
|
||||
}
|
||||
|
||||
size_t hash = HASH(key, key_len);
|
||||
hash_table_element_t * element = hash_table_element_new();
|
||||
hash_table_element_t *element = hash_table_element_new();
|
||||
|
||||
if (!element) {
|
||||
//INFO("Cannot allocate memory for element");
|
||||
@@ -197,7 +192,7 @@ int hash_table_add(omg_hash_table_t * table, void * key, size_t key_len, void *
|
||||
table->key_count++;
|
||||
} else {
|
||||
//LOG("Conflicts adding element at %d", (int)hash);
|
||||
hash_table_element_t * temp = table->store_house[hash];
|
||||
hash_table_element_t *temp = table->store_house[hash];
|
||||
|
||||
while(temp->next) {
|
||||
while(temp->next && temp->next->key_len!=key_len) {
|
||||
@@ -234,8 +229,7 @@ int hash_table_add(omg_hash_table_t * table, void * key, size_t key_len, void *
|
||||
* @returns 0 on sucess
|
||||
* @returns -1 when key is not found
|
||||
*/
|
||||
int hash_table_remove(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
{
|
||||
int hash_table_remove(omg_hash_table_t *table, void *key, size_t key_len) {
|
||||
//INFO("Deleting a key-value pair from the hash table");
|
||||
if ((table->key_num/ table->key_count) >= table->key_ratio) {
|
||||
//LOG("Ratio(%d) reached the set limit %d\nContracting hash_table", (table->key_num / table->key_count), table->key_ratio);
|
||||
@@ -290,8 +284,7 @@ int hash_table_remove(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
* @returns NULL when key is not found in the hash table
|
||||
* @returns void* pointer to the value in the table
|
||||
*/
|
||||
void * hash_table_lookup(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
{
|
||||
void *hash_table_lookup(omg_hash_table_t *table, void *key, size_t key_len) {
|
||||
size_t hash = HASH(key, key_len);
|
||||
|
||||
//LOG("Looking up a key-value pair for hash -> %d", (int)hash);
|
||||
@@ -328,8 +321,7 @@ void * hash_table_lookup(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
* @returns 0 when key is not found
|
||||
* @returns 1 when key is found
|
||||
*/
|
||||
int hash_table_has_key(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
{
|
||||
int hash_table_has_key(omg_hash_table_t *table, void *key, size_t key_len) {
|
||||
size_t hash = HASH(key, key_len);
|
||||
|
||||
//LOG("Searching for key with hash -> %d", (int)hash);
|
||||
@@ -365,11 +357,10 @@ int hash_table_has_key(omg_hash_table_t * table, void * key, size_t key_len)
|
||||
* @param keys a void** pointer where keys are filled in (memory allocated internally and must be freed)
|
||||
* @return total number of keys filled in keys
|
||||
*/
|
||||
size_t hash_table_get_keys(omg_hash_table_t * table, void ** keys)
|
||||
{
|
||||
size_t hash_table_get_keys(omg_hash_table_t *table, void **keys) {
|
||||
size_t i = 0;
|
||||
size_t count = 0;
|
||||
keys = calloc(table->key_count, sizeof(void *));
|
||||
keys = calloc(table->key_count, sizeof(void *)*HASH_LEN);
|
||||
|
||||
for(i=0; i<HASH_LEN; i++) {
|
||||
if (table->store_house[i]) {
|
||||
@@ -403,8 +394,7 @@ size_t hash_table_get_keys(omg_hash_table_t * table, void ** keys)
|
||||
* @returns 1 when no memory
|
||||
* @returns count of elements
|
||||
*/
|
||||
size_t hash_table_get_elements(omg_hash_table_t * table, hash_table_element_t *** elements)
|
||||
{
|
||||
size_t hash_table_get_elements(omg_hash_table_t *table, hash_table_element_t *** elements) {
|
||||
size_t i = 0;
|
||||
size_t count = 0;
|
||||
(*elements) = (hash_table_element_t **) calloc(table->key_count, sizeof(hash_table_element_t *));
|
||||
@@ -446,8 +436,7 @@ size_t hash_table_get_elements(omg_hash_table_t * table, hash_table_element_t **
|
||||
* @param max_key max value of the hash to be returned by the function
|
||||
* @returns hash value belonging to [0, max_key)
|
||||
*/
|
||||
uint16_t hash_table_do_hash(void * key, size_t key_len, uint16_t max_key)
|
||||
{
|
||||
uint16_t hash_table_do_hash(void *key, size_t key_len, uint16_t max_key) {
|
||||
uint16_t *ptr = (uint16_t *) key;
|
||||
uint16_t hash = 0xbabe; // WHY NOT
|
||||
size_t i = 0;
|
||||
@@ -469,10 +458,9 @@ uint16_t hash_table_do_hash(void * key, size_t key_len, uint16_t max_key)
|
||||
* @returns -2 when no emmory for new store house
|
||||
* @returns 0 when sucess
|
||||
*/
|
||||
int hash_table_resize(omg_hash_table_t *table, size_t len)
|
||||
{
|
||||
int hash_table_resize(omg_hash_table_t *table, size_t len) {
|
||||
//LOG("resizing hash table from %d to %d", table->key_num, len);
|
||||
hash_table_element_t ** elements;
|
||||
hash_table_element_t **elements;
|
||||
size_t count;
|
||||
// FIXME traversing the elements twice, change it some time soon
|
||||
count = hash_table_get_elements(table, &elements);
|
||||
@@ -483,7 +471,7 @@ int hash_table_resize(omg_hash_table_t *table, size_t len)
|
||||
}
|
||||
|
||||
// keep the current store house in case we dont get more memory
|
||||
hash_table_element_t ** temp = table->store_house;
|
||||
hash_table_element_t **temp = table->store_house;
|
||||
table->store_house = calloc(len, sizeof(hash_table_element_t *));
|
||||
|
||||
if (!table->store_house) {
|
||||
|
||||
+23
-128
@@ -53,9 +53,7 @@ int simu_time=0, duration=0, seed=0, simu_mode=0;
|
||||
|
||||
// init OTG with config parameters
|
||||
|
||||
void init_config_otg(char *protocol, char *ip_version)
|
||||
{
|
||||
|
||||
void init_config_otg(char *protocol, char *ip_version) {
|
||||
int i, j, k;
|
||||
|
||||
if (simu_time>0)
|
||||
@@ -70,25 +68,19 @@ void init_config_otg(char *protocol, char *ip_version)
|
||||
|
||||
printf("duration %d, seeds %d \n", duration, g_otg->seed);
|
||||
|
||||
|
||||
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
|
||||
|
||||
|
||||
|
||||
if (duration>0)
|
||||
g_otg->duration[i]=duration;
|
||||
else
|
||||
g_otg->duration[i]=10000;
|
||||
|
||||
|
||||
g_otg->dst_port[i]=DST_PORT;
|
||||
g_otg->dst_ip[i]=(char*)malloc(100*sizeof(char*));
|
||||
g_otg->dst_ip[i]=(char *)malloc(100*sizeof(char *));
|
||||
g_otg->dst_ip[i]=DST_IP;
|
||||
g_otg->dst_ip[i]=DST_IP;
|
||||
|
||||
//config ip version
|
||||
|
||||
|
||||
if (ip_version !=NULL) {
|
||||
if ((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0))
|
||||
g_otg->ip_v[i]=IPV4;
|
||||
@@ -97,7 +89,6 @@ void init_config_otg(char *protocol, char *ip_version)
|
||||
} else
|
||||
g_otg->ip_v[i]=IPV4;
|
||||
|
||||
|
||||
//config transport protocol version
|
||||
if (protocol!=NULL) {
|
||||
if ((strcmp(protocol,"TCP")==0) ||(strcmp(protocol,"tcp")==0))
|
||||
@@ -123,20 +114,13 @@ void init_config_otg(char *protocol, char *ip_version)
|
||||
g_otg->size_std_dev[i][j][k]=PKTS_SIZE_STD_DEV;
|
||||
g_otg->size_lambda[i][j][k]=PKTS_SIZE_LAMBDA;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main_below_ip()
|
||||
{
|
||||
int main_below_ip() {
|
||||
int i, j, k, l, rtt_owd ,rx_otg=0, simu_time=0, ctime=0, nb_round=0;
|
||||
float p;
|
||||
char *packet;
|
||||
@@ -145,25 +129,17 @@ int main_below_ip()
|
||||
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
|
||||
|
||||
do {
|
||||
|
||||
nb_round=nb_round+1;
|
||||
|
||||
// for (stime=0; stime < SIMU_TIME; stime++) // discrete event generation : tick, stime generate the ctime
|
||||
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
|
||||
|
||||
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
|
||||
|
||||
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++) {
|
||||
LOG_I(OTG,"OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
|
||||
|
||||
|
||||
|
||||
ctime=0; // set the ctime to 0
|
||||
|
||||
do {
|
||||
|
||||
if (simu_time> SIMU_TIME) {
|
||||
|
||||
otg_info->ctime=SIMU_TIME;
|
||||
return(0);
|
||||
}
|
||||
@@ -172,21 +148,16 @@ int main_below_ip()
|
||||
char *packet=NULL;
|
||||
/*packet=packet_gen(i, j, k, ctime);*/ packet=packet_gen(i, j, ctime, &pkt_size);
|
||||
|
||||
|
||||
|
||||
if (packet!=NULL) {
|
||||
if ((ceil(g_otg->duration[i]*uniform_rng()))==ctime) {
|
||||
printf("DROP PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
|
||||
|
||||
printf("DROP PACKET (i=%d,j=%d) seq num=%d\n",i, j, (int)otg_info->seq_num[i][j]);
|
||||
} else {
|
||||
printf("SEND PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
|
||||
|
||||
printf("SEND PACKET (i=%d,j=%d) seq num=%d\n",i, j, (int)otg_info->seq_num[i][j]);
|
||||
rtt_owd=ceil(uniform_rng()*8.56);
|
||||
LOG_I(OTG,"one way delay= %d , (src=%d, dst=%d, state=%d)\n", rtt_owd, i, j, k);
|
||||
ctime+=rtt_owd;
|
||||
otg_info->rx_pkt_owd[i][j]=rtt_owd;
|
||||
simu_time+=rtt_owd;
|
||||
|
||||
//rx_packet_out=check_packet(i, j, ctime, packet);
|
||||
rx_packet_out=otg_rx_pkt(i,j, ctime, packet, pkt_size);
|
||||
//if (rx_packet_out==NULL)
|
||||
@@ -196,18 +167,15 @@ int main_below_ip()
|
||||
// rx_packet_out=NULL;
|
||||
free(packet);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
//Do not increase the ctime and simu_time with the one way delay.
|
||||
ctime-=rtt_owd;
|
||||
simu_time-=rtt_owd;
|
||||
|
||||
|
||||
LOG_I(OTG,"PKTS INFO:: (src=%d, dst=%d, state=%d),NB PKTS=%d ,sequence NB=%d, RTT (one way)ms= %d \n ",i, j, k, otg_info->tx_num_pkt[i][j], otg_info->seq_num[i][j], otg_info->rx_pkt_owd[i][j]);
|
||||
LOG_I(OTG,"PKTS INFO:: (src=%d, dst=%d, state=%d),NB PKTS=%d ,sequence NB=%d, RTT (one way)ms= %d \n ",
|
||||
i, j, k, (int)otg_info->tx_num_pkt[i][j], (int)otg_info->seq_num[i][j], (int)otg_info->rx_pkt_owd[i][j]);
|
||||
}
|
||||
} else
|
||||
printf("Node (i=%d,j=%d) seq num=%d, ctime %d, prb %lf\n",i, j, otg_info->seq_num[i][j], ctime,(ceil(g_otg->duration[i]*uniform_rng())));
|
||||
printf("Node (i=%d,j=%d) seq num=%d, ctime %d, prb %lf\n",i, j, (int)otg_info->seq_num[i][j], ctime,(ceil(g_otg->duration[i]*uniform_rng())));
|
||||
|
||||
LOG_I(OTG,"Time:: ctime=%d, duration=%d, simu_time=%d, max=%d, (src=%d, dst=%d, state=%d) \n", ctime, g_otg->duration[i],simu_time, SIMU_TIME, i, j,k);
|
||||
ctime+=1;
|
||||
@@ -215,27 +183,19 @@ int main_below_ip()
|
||||
} while (ctime<=g_otg->duration[i]) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (otg_info->tx_num_pkt[i][j]>otg_info->rx_num_pkt[i][j])
|
||||
LOG_I(OTG,"STAT: (LOSS):: (src=%d, dst=%d) NB packet TX= %d, NB packet RX = %d, seq NUM=%d\n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j],otg_info->seq_num[i][j] );
|
||||
LOG_I(OTG,"STAT: (LOSS):: (src=%d, dst=%d) NB packet TX= %d, NB packet RX = %d, seq NUM=%d\n ",
|
||||
i, j, (int)otg_info->tx_num_pkt[i][j], (int)otg_info->rx_num_pkt[i][j],(int)otg_info->seq_num[i][j] );
|
||||
else
|
||||
LOG_I(OTG,"STAT: :: (src=%d, dst=%d) NB packet TX= %d, NB packet RX= %d, seq NUM=%d \n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j], otg_info->seq_num[i][j]);
|
||||
|
||||
|
||||
|
||||
LOG_I(OTG,"STAT: :: (src=%d, dst=%d) NB packet TX= %d, NB packet RX= %d, seq NUM=%d \n ",
|
||||
i, j, (int)otg_info->tx_num_pkt[i][j], (int)otg_info->rx_num_pkt[i][j], (int)otg_info->seq_num[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} while (simu_time<=SIMU_TIME);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main_above_ip()
|
||||
{
|
||||
int main_above_ip() {
|
||||
int i, j, k, simu_time=0, ctime=0, nb_round=0;
|
||||
char *packet=NULL;
|
||||
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
|
||||
@@ -244,9 +204,7 @@ int main_above_ip()
|
||||
nb_round=nb_round+1;
|
||||
|
||||
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
|
||||
|
||||
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
|
||||
|
||||
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++) {
|
||||
LOG_I(OTG,"SOCKET:: OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
|
||||
ctime=0;
|
||||
@@ -255,57 +213,44 @@ int main_above_ip()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ctime+=1;
|
||||
simu_time+=1;
|
||||
} while (simu_time<=SIMU_TIME);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void config_traffic_type(char *traffic)
|
||||
{
|
||||
void config_traffic_type(char *traffic) {
|
||||
Application application;
|
||||
int i,j;
|
||||
|
||||
if (strcmp(traffic, "SCBR")==0)
|
||||
application=SCBR;
|
||||
|
||||
else if (strcmp(traffic, "OPENARENA")==0)
|
||||
application=OPENARENA;
|
||||
|
||||
else if (strcmp(traffic, "BICYCLE_RACE")==0)
|
||||
application=BICYCLE_RACE;
|
||||
|
||||
else if (strcmp(traffic, "AUTO_PILOT")==0)
|
||||
application=AUTO_PILOT;
|
||||
|
||||
else if (strcmp(traffic, "TEAM_FORTRESS")==0)
|
||||
application=TEAM_FORTRESS;
|
||||
|
||||
else
|
||||
application=NO_PREDEFINED_TRAFFIC;
|
||||
|
||||
printf("Config Application: %d \n", application);
|
||||
|
||||
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
|
||||
|
||||
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
|
||||
|
||||
g_otg->application_type[i][j] =application;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
cunstom_config(simu_time, duration)
|
||||
{
|
||||
cunstom_config(simu_time, duration) {
|
||||
int i;
|
||||
|
||||
//--config introduced Global simulation time for each node
|
||||
@@ -321,37 +266,23 @@ cunstom_config(simu_time, duration)
|
||||
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int i,j, tx;
|
||||
|
||||
char *protocol=NULL;
|
||||
char *ip_version=NULL;
|
||||
char *traffic=NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
init_all_otg();
|
||||
otg_info->ctime=0;
|
||||
LOG_I(OTG,"Emulation time %d \n ", otg_info->ctime);
|
||||
g_otg->num_nodes=NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX;
|
||||
LOG_I(OTG,"OTG emulation number of nodes= %d \n", g_otg->num_nodes);
|
||||
|
||||
|
||||
|
||||
for (i = 1; i <argc ; i ++) {
|
||||
if ('-' == argv[i][0]) {
|
||||
|
||||
if(('h' == argv[i][1]) || ('H' == argv[i][1])) {
|
||||
printf("Help OTG: \n./otg [-M [s (socket mode)] [b (Below IP)]] [-T (Simu Time)] [-d (duration per node)] [-s (seed)] [-P (protocol: TCP or UDP)] [-I (ip version: IP4 or IP6)] -A [(application: CBR, AUTO_PILOT, BICYCLE_RACE, OPENARENA, TEAM_FORTRESS)]\n");
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
else if ('M' == argv[i][1]) {
|
||||
} else if ('M' == argv[i][1]) {
|
||||
if (strcmp("s",argv[i+1])==0) {
|
||||
printf("Above IP: SOCKET MODE \n");
|
||||
simu_mode=1;
|
||||
@@ -359,89 +290,53 @@ int main (int argc, char **argv)
|
||||
printf("Below IP: IPC/RPC MODE\n");
|
||||
simu_mode=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if ('T' == argv[i][1]) {
|
||||
} else if ('T' == argv[i][1]) {
|
||||
simu_time=atoi(argv[i+1]);
|
||||
printf("simu_time=%d\n", simu_time);
|
||||
}
|
||||
|
||||
|
||||
else if ('d' == argv[i][1]) {
|
||||
} else if ('d' == argv[i][1]) {
|
||||
duration=atoi(argv[i+1]);
|
||||
printf("duration node=%d\n", duration);
|
||||
}
|
||||
|
||||
else if ('s' == argv[i][1]) {
|
||||
} else if ('s' == argv[i][1]) {
|
||||
seed=atoi(argv[i+1]);
|
||||
printf("seed val =%d\n", seed);
|
||||
}
|
||||
|
||||
|
||||
else if ('P' == argv[i][1]) {
|
||||
} else if ('P' == argv[i][1]) {
|
||||
protocol=argv[i+1];
|
||||
|
||||
if ((strcmp(argv[i+1],"TCP")==0) || (strcmp(argv[i+1],"UDP")==0) || (strcmp(argv[i+1],"tcp")==0) || (strcmp(argv[i+1],"udp")==0)) {
|
||||
protocol=argv[i+1];
|
||||
printf("Protocol=%s\n", protocol);
|
||||
}
|
||||
}
|
||||
|
||||
else if ('I' == argv[i][1]) {
|
||||
} else if ('I' == argv[i][1]) {
|
||||
if ((strcmp(argv[i+1],"IP4")==0) || (strcmp(argv[i+1],"IP6")==0) || (strcmp(argv[i+1],"ip4")==0) || (strcmp(argv[i+1],"ip6")==0)) {
|
||||
ip_version=argv[i+1];
|
||||
printf("IP version=%s\n", ip_version);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if ('A' == argv[i][1]) {
|
||||
} else if ('A' == argv[i][1]) {
|
||||
if ((strcmp(argv[i+1],"CBR")==0) || (strcmp(argv[i+1],"AUTO_PILOT")==0) || (strcmp(argv[i+1],"BICYCLE_RACE")==0) || (strcmp(argv[i+1],"OPENARENA")==0) || (strcmp(argv[i+1],"TEAM_FORTRESS")==0))
|
||||
traffic=argv[i+1];
|
||||
|
||||
config_traffic_type(traffic);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (traffic!=NULL)
|
||||
init_predef_traffic();
|
||||
else
|
||||
init_config_otg(protocol, ip_version);
|
||||
|
||||
|
||||
init_seeds(g_otg->seed);
|
||||
cunstom_config(simu_time, duration);
|
||||
|
||||
|
||||
|
||||
if (simu_mode==0)
|
||||
tx=main_below_ip();
|
||||
|
||||
else if (simu_mode==1)
|
||||
tx=main_above_ip();
|
||||
|
||||
|
||||
|
||||
// Compute KPI after the end of the simu
|
||||
kpi_gen();
|
||||
|
||||
free_otg();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,31 +38,25 @@
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
|
||||
FD_otg * form_dl, *form_ul;
|
||||
FD_otg *form_dl, *form_ul;
|
||||
FL_FORM *fclock;
|
||||
unsigned int clear_cmpt_ul=0;
|
||||
unsigned int clear_cmpt_dl=0;
|
||||
|
||||
|
||||
FD_otg *create_form_otg(void)
|
||||
{
|
||||
FD_otg *create_form_otg(void) {
|
||||
FL_OBJECT *obj;
|
||||
FD_otg *fdui = (FD_otg *) fl_calloc(1, sizeof(*fdui));
|
||||
|
||||
fdui->otg = fl_bgn_form(FL_NO_BOX, 550, 550);
|
||||
obj = fl_add_box(FL_UP_BOX,0,0,900,700,"");
|
||||
fdui->owd = fl_add_xyplot(FL_NORMAL_XYPLOT,50,30,450,190,"Delay(ms)");
|
||||
fl_set_object_color(fdui->owd,FL_BLACK,FL_YELLOW);
|
||||
fdui->throughput = fl_add_xyplot(FL_NORMAL_XYPLOT,50,300,450,190,"Throughput(Kbit/s)");
|
||||
fl_set_object_color(fdui->throughput,FL_BLACK,FL_YELLOW);
|
||||
|
||||
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON,250,510,50,30,"Exit");
|
||||
fl_set_object_callback(obj, exit_cb, 0);
|
||||
fdui->loss_ratio=fl_add_text(FL_NORMAL_TEXT,5,510,220,20,"NB Loss pkts");
|
||||
fdui->simu_time=fl_add_text(FL_NORMAL_TEXT,370,510,250,30,"Simulation Time");
|
||||
|
||||
|
||||
fl_end_form();
|
||||
fdui->otg->fdui = fdui;
|
||||
return fdui;
|
||||
@@ -70,18 +64,15 @@ FD_otg *create_form_otg(void)
|
||||
|
||||
//For more details about object parameters, refer to: http://xforms-toolkit.org/doc/xforms_25.html
|
||||
|
||||
void show_otg_form()
|
||||
{
|
||||
void show_otg_form() {
|
||||
int eNB_id;
|
||||
char title[255];
|
||||
char *tArgv[] = { "OTG", "OTG" };
|
||||
int tArgc = 2;
|
||||
|
||||
int major_owd = 6;
|
||||
int minor_owd = 3;
|
||||
int major_thr = 5;
|
||||
int minor_thr = 2;
|
||||
|
||||
fl_initialize(&tArgc,tArgv,"OTG",0,0);
|
||||
|
||||
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { //NB_eNB_INST
|
||||
@@ -98,9 +89,6 @@ void show_otg_form()
|
||||
|
||||
fl_set_xyplot_ytics(form_dl->throughput,major_thr, minor_thr);
|
||||
fl_set_xyplot_ybounds(form_dl->throughput,0,1000);
|
||||
|
||||
|
||||
|
||||
form_ul= create_form_otg ();
|
||||
sprintf (title, "LTE UE->eNB (UL)");
|
||||
fl_show_form (form_ul->otg, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
@@ -116,20 +104,15 @@ void show_otg_form()
|
||||
//fl_set_xyplot_xgrid (form_ul->throughput, FL_GRID_MAJOR);
|
||||
fl_set_xyplot_ytics(form_ul->throughput,major_thr, minor_thr);
|
||||
fl_set_xyplot_ybounds(form_ul->throughput,0,1000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//create_form_clock();
|
||||
//fl_show_form(fclock, FL_PLACE_CENTER,FL_TRANSIENT,"clocks");
|
||||
//fl_do_forms();
|
||||
|
||||
fl_check_forms();
|
||||
}
|
||||
|
||||
void add_tab_metric(int src, int dst, float owd, float throughput, int ctime)
|
||||
{
|
||||
|
||||
void add_tab_metric(int src, int dst, float owd, float throughput, int ctime) {
|
||||
if (otg_forms_info->init_forms==0) {
|
||||
show_otg_form();
|
||||
otg_forms_info->init_forms=1;
|
||||
@@ -158,9 +141,7 @@ void add_tab_metric(int src, int dst, float owd, float throughput, int ctime)
|
||||
}
|
||||
|
||||
|
||||
void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
{
|
||||
|
||||
void plot_graphes_ul(int src, int dst, int ctime) { //UE -->eNB
|
||||
int i, src_idx=1, curve_id=1;
|
||||
char loss_rate[100];
|
||||
char simu_time[100];
|
||||
@@ -169,12 +150,8 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
int y_key_position=75;
|
||||
|
||||
if (otg_forms_info->idx_ul[src][dst]==MAX_SAMPLES-1) {
|
||||
|
||||
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
|
||||
|
||||
|
||||
|
||||
|
||||
if (otg_forms_info->is_data_plot_ul == -1)
|
||||
otg_forms_info->is_data_plot_ul=src;
|
||||
|
||||
@@ -184,17 +161,13 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
sprintf(curve_label, "%d%s%d", src,"-->", dst);
|
||||
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
|
||||
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[src][dst],
|
||||
otg_forms_info->data_throughput_ul[src][dst], otg_forms_info->idx_ul[src][dst], "", "time", "kbit/s");
|
||||
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
|
||||
fl_set_xyplot_key_font(form_ul->throughput, FL_BOLD_STYLE, FL_HUGE_SIZE);
|
||||
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
|
||||
|
||||
otg_kpi_nb_loss_pkts();
|
||||
sprintf(loss_rate, "%s%d","NB Loss pkts UL=", otg_info->total_loss_ul);
|
||||
sprintf(loss_rate, "%s%u","NB Loss pkts UL=", otg_info->total_loss_ul);
|
||||
fl_set_object_label(form_ul->loss_ratio, loss_rate);
|
||||
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
|
||||
fl_set_object_label(form_ul->simu_time, simu_time);
|
||||
@@ -204,20 +177,16 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
|
||||
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
|
||||
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
|
||||
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[otg_forms_info->is_data_plot_ul][dst],
|
||||
otg_forms_info->data_throughput_ul[otg_forms_info->is_data_plot_ul][dst], otg_forms_info->idx_ul[otg_forms_info->is_data_plot_ul][dst], "", "time", "kbit/s");
|
||||
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
|
||||
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
|
||||
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
otg_kpi_nb_loss_pkts();
|
||||
sprintf(loss_rate, "%s%d","NB Loss pkts UL=",otg_info->total_loss_ul);
|
||||
sprintf(loss_rate, "%s%u","NB Loss pkts UL=",otg_info->total_loss_ul);
|
||||
fl_set_object_label(form_ul->loss_ratio, loss_rate);
|
||||
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
|
||||
fl_set_object_label(form_ul->simu_time, simu_time);
|
||||
|
||||
}
|
||||
|
||||
for (src_idx=1; src_idx<=NB_UE_INST; src_idx++) {
|
||||
@@ -229,9 +198,6 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
sprintf(curve_label, "%d%s%d", src_idx,"-->", dst);
|
||||
fl_set_xyplot_key(form_ul->owd, curve_id-1, curve_label);
|
||||
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
|
||||
|
||||
fl_add_xyplot_overlay(form_ul->throughput,curve_id++,
|
||||
otg_forms_info->data_ctime_ul[src_idx][dst],
|
||||
otg_forms_info->data_throughput_ul[src_idx][dst],
|
||||
@@ -242,7 +208,6 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<otg_forms_info->idx_ul[src][dst]; i++) {
|
||||
otg_forms_info->data_ctime_ul[src][dst][otg_forms_info->idx_ul[src][dst]]=i;
|
||||
otg_forms_info->data_owd_ul[src][dst][i]= otg_forms_info->data_owd_ul[src][dst][i+1];
|
||||
@@ -253,14 +218,11 @@ void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
|
||||
}
|
||||
|
||||
fl_check_forms();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
{
|
||||
|
||||
void plot_graphes_dl(int src, int dst, int ctime) { //eNB -->UE
|
||||
int i, dst_idx=1, curve_id=1;
|
||||
char loss_rate[100];
|
||||
char curve_label[100];
|
||||
@@ -269,11 +231,8 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
int y_key_position=75;
|
||||
|
||||
if (otg_forms_info->idx_dl[src][dst]==MAX_SAMPLES-1) {
|
||||
|
||||
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
|
||||
|
||||
|
||||
|
||||
if (otg_forms_info->is_data_plot_dl == -1)
|
||||
otg_forms_info->is_data_plot_dl=dst;
|
||||
|
||||
@@ -289,12 +248,10 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
|
||||
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
otg_kpi_nb_loss_pkts();
|
||||
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
|
||||
sprintf(loss_rate, "%s%u","NB Loss pkts DL=",otg_info->total_loss_dl);
|
||||
fl_set_object_label(form_dl->loss_ratio, loss_rate);
|
||||
|
||||
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
|
||||
fl_set_object_label(form_dl->simu_time, simu_time);
|
||||
|
||||
} else {
|
||||
fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
|
||||
otg_forms_info->data_owd_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "ms");
|
||||
@@ -306,9 +263,8 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
sprintf(curve_label, "%d%s%d", src,"-->",otg_forms_info->is_data_plot_dl);
|
||||
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
|
||||
fl_set_xyplot_key_position(form_dl->throughput,x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
otg_kpi_nb_loss_pkts();
|
||||
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
|
||||
sprintf(loss_rate, "%s%u","NB Loss pkts DL=",otg_info->total_loss_dl);
|
||||
fl_set_object_label(form_dl->loss_ratio, loss_rate);
|
||||
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
|
||||
fl_set_object_label(form_dl->simu_time, simu_time);
|
||||
@@ -323,7 +279,6 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
|
||||
fl_set_xyplot_key(form_dl->owd, curve_id-1, curve_label);
|
||||
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
fl_add_xyplot_overlay(form_dl->throughput,curve_id++,
|
||||
otg_forms_info->data_ctime_dl[src][dst_idx],
|
||||
otg_forms_info->data_throughput_dl[src][dst_idx],
|
||||
@@ -331,8 +286,6 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
|
||||
fl_set_xyplot_key(form_dl->throughput, curve_id-1, curve_label);
|
||||
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +299,6 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
}
|
||||
|
||||
fl_check_forms();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -354,14 +306,12 @@ void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
|
||||
|
||||
|
||||
|
||||
void exit_cb(FL_OBJECT *ob, long q)
|
||||
{
|
||||
void exit_cb(FL_OBJECT *ob, long q) {
|
||||
fl_finish();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void create_form_clock(void)
|
||||
{
|
||||
void create_form_clock(void) {
|
||||
FL_OBJECT *obj;
|
||||
|
||||
if (fclock)
|
||||
@@ -369,22 +319,18 @@ void create_form_clock(void)
|
||||
|
||||
fclock = fl_bgn_form(FL_NO_BOX,500,350);
|
||||
obj = fl_add_box(FL_UP_BOX,0,0,500,350,"");
|
||||
|
||||
obj = fl_add_clock(FL_DIGITAL_CLOCK,185,20,150,35,"");
|
||||
fl_set_object_boxtype(obj,FL_ROUNDED_BOX);
|
||||
fl_set_object_color(obj,FL_COL1,FL_BLACK);
|
||||
fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
|
||||
fl_set_object_lstyle(obj,FL_BOLD_STYLE);
|
||||
|
||||
obj = fl_add_clock(FL_ANALOG_CLOCK,30,70,220,200,"");
|
||||
fl_set_object_boxtype(obj,FL_UP_BOX);
|
||||
|
||||
obj = fl_add_clock(FL_ANALOG_CLOCK,260,70,220,200,"");
|
||||
fl_set_object_boxtype(obj,FL_OVAL3D_UPBOX);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON,375,300,110,35,"Exit");
|
||||
fl_set_object_callback(obj, exit_cb, 0);
|
||||
fl_end_form();
|
||||
|
||||
fl_scale_form(fclock, 0.7, 0.7);
|
||||
}
|
||||
|
||||
|
||||
+44
-109
@@ -43,23 +43,22 @@ unsigned int start_log_jitter=0;
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern unsigned char NB_UE_INST;
|
||||
|
||||
void tx_throughput(int src, int dst, int application)
|
||||
{
|
||||
|
||||
void tx_throughput(int src, int dst, int application) {
|
||||
if (otg_info->tx_num_bytes[src][dst][application]>0) {
|
||||
// otg_info->tx_throughput[src][dst][application]=((double)otg_info->tx_num_bytes[src][dst][application] *1000*8)/ (get_ctime()*1024); // unit Kbit/sec, if ctime in ms
|
||||
if ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application]) < get_ctime() )
|
||||
otg_info->tx_throughput[src][dst][application]=((double)otg_info->tx_num_bytes[src][dst][application] *1000*8)/ ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application])*1024); // unit Kbit/sec, if ctime in ms
|
||||
otg_info->tx_throughput[src][dst][application]=((double)otg_info->tx_num_bytes[src][dst][application] *1000*8)/ ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application])
|
||||
*1024); // unit Kbit/sec, if ctime in ms
|
||||
else if (g_otg->flow_start[src][dst][application] < get_ctime() )
|
||||
otg_info->tx_throughput[src][dst][application]=((double)otg_info->tx_num_bytes[src][dst][application] *1000*8)/ ((get_ctime() - g_otg->flow_start[src][dst][application])*1024);
|
||||
else
|
||||
else
|
||||
LOG_W(OTG, "[src %d][dst %d][app %d] flow start time less than the simu time (start %d, duration %d, ctime %d)\n",
|
||||
src, dst, application,
|
||||
g_otg->flow_start[src][dst][application],
|
||||
g_otg->flow_duration[src][dst][application],
|
||||
get_ctime());
|
||||
src, dst, application,
|
||||
g_otg->flow_start[src][dst][application],
|
||||
g_otg->flow_duration[src][dst][application],
|
||||
get_ctime());
|
||||
}
|
||||
|
||||
|
||||
if (otg_info->tx_num_bytes_background[src][dst]>0)
|
||||
otg_info->tx_throughput_background[src][dst]=((double)otg_info->tx_num_bytes_background[src][dst]*1000*8)/ (get_ctime()*1024); // unit Kbit/sec, if ctime in ms
|
||||
|
||||
@@ -71,26 +70,24 @@ void tx_throughput(int src, int dst, int application)
|
||||
// LOG_I(OTG,"DUY, get_ctime() [i=%d,j=%d,k=%d] = %.d\n", src,dst,application,get_ctime());
|
||||
LOG_I(OTG,"otg_multicast_info->tx_num_bytes[i=%d,j=%d,k=%d] = %.d\n", src,dst,application,otg_multicast_info->tx_num_bytes[src][dst][application]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rx_goodput(int src, int dst, int application)
|
||||
{
|
||||
|
||||
void rx_goodput(int src, int dst, int application) {
|
||||
if (otg_info->rx_num_bytes[src][dst][application]>0) {
|
||||
// otg_info->rx_goodput[src][dst][application]=((double)otg_info->rx_num_bytes[src][dst][application]*1000*8)/(get_ctime()*1024); // unit kB/sec, if ctime in ms
|
||||
if ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application]) < get_ctime() )
|
||||
otg_info->rx_goodput[src][dst][application]=((double)otg_info->rx_num_bytes[src][dst][application] *1000*8)/ ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application])*1024); // unit Kbit/sec, if ctime in ms
|
||||
if ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application]) < get_ctime() )
|
||||
otg_info->rx_goodput[src][dst][application]=((double)otg_info->rx_num_bytes[src][dst][application] *1000*8)/ ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][application])
|
||||
*1024); // unit Kbit/sec, if ctime in ms
|
||||
else if (g_otg->flow_start[src][dst][application] < get_ctime() )
|
||||
otg_info->rx_goodput[src][dst][application]=((double)otg_info->rx_num_bytes[src][dst][application] *1000*8)/ ((get_ctime() - g_otg->flow_start[src][dst][application])*1024);
|
||||
else
|
||||
else
|
||||
LOG_W(OTG, "[src %d][dst %d][app %d] flow start time less than the simu time (start %d, duration %d, ctime %d)\n",
|
||||
src, dst, application,
|
||||
g_otg->flow_start[src][dst][application],
|
||||
g_otg->flow_duration[src][dst][application],
|
||||
get_ctime());
|
||||
src, dst, application,
|
||||
g_otg->flow_start[src][dst][application],
|
||||
g_otg->flow_duration[src][dst][application],
|
||||
get_ctime());
|
||||
}
|
||||
|
||||
if (otg_info->rx_num_bytes_background[src][dst]>0)
|
||||
@@ -105,9 +102,7 @@ if ((g_otg->flow_start[src][dst][application]+g_otg->flow_duration[src][dst][app
|
||||
|
||||
|
||||
|
||||
void rx_loss_rate_pkts(int src, int dst, int application)
|
||||
{
|
||||
|
||||
void rx_loss_rate_pkts(int src, int dst, int application) {
|
||||
if (otg_info->rx_num_pkt[src][dst][application]<otg_info->tx_num_pkt[src][dst][application])
|
||||
otg_info->rx_loss_rate[src][dst][application]= 1 - ((double)otg_info->rx_num_pkt[src][dst][application]/otg_info->tx_num_pkt[src][dst][application]);
|
||||
else
|
||||
@@ -127,26 +122,20 @@ void rx_loss_rate_pkts(int src, int dst, int application)
|
||||
otg_multicast_info->rx_loss_rate[src][dst]= 1 - ((double)otg_multicast_info->rx_num_pkt[src][dst][application]/otg_multicast_info->tx_num_pkt[src][dst][0]);
|
||||
else
|
||||
otg_multicast_info->rx_loss_rate[src][dst]=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void rx_loss_rate_bytes(int src, int dst, int application)
|
||||
{
|
||||
|
||||
void rx_loss_rate_bytes(int src, int dst, int application) {
|
||||
if (otg_info->rx_num_pkt[src][dst][application]<otg_info->tx_num_pkt[src][dst][application])
|
||||
otg_info->rx_loss_rate[src][dst][application]= 1 - ((double)otg_info->rx_num_bytes[src][dst][application]/otg_info->tx_num_bytes[src][dst][application]);
|
||||
else
|
||||
otg_info->rx_loss_rate[src][dst][application]=0;
|
||||
|
||||
LOG_I(OTG, "loss rate (src=%d, dst=%d, appli %d ):: = %lf(bytes) \n",src, dst, application, otg_info->rx_loss_rate[src][dst][application]);
|
||||
|
||||
}
|
||||
|
||||
void otg_kpi_nb_loss_pkts(void)
|
||||
{
|
||||
void otg_kpi_nb_loss_pkts(void) {
|
||||
unsigned int i,j,k;
|
||||
|
||||
otg_info->total_loss_dl=0;
|
||||
otg_info->total_loss_ul=0;
|
||||
|
||||
@@ -162,9 +151,7 @@ void otg_kpi_nb_loss_pkts(void)
|
||||
}
|
||||
}
|
||||
|
||||
void average_pkt_jitter(int src, int dst, int application)
|
||||
{
|
||||
|
||||
void average_pkt_jitter(int src, int dst, int application) {
|
||||
if (otg_info->rx_jitter_sample[src][dst][application] > 0 ) {
|
||||
otg_info->rx_jitter_avg[src][dst][application]/= otg_info->rx_jitter_sample[src][dst][application];
|
||||
otg_info->rx_jitter_avg_e2e[src][dst][application]/= otg_info->rx_jitter_sample[src][dst][application];
|
||||
@@ -189,13 +176,10 @@ void average_pkt_jitter(int src, int dst, int application)
|
||||
|
||||
LOG_T(OTG,"average_jitter_dl %lf average_jitter_ul %lf \n",otg_info->average_jitter_dl_e2e,otg_info->average_jitter_ul_e2e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void average_total_jitter(void)
|
||||
{
|
||||
void average_total_jitter(void) {
|
||||
unsigned int i,j,k;
|
||||
|
||||
otg_info->average_jitter_dl=0;
|
||||
otg_info->average_jitter_ul=0;
|
||||
otg_info->average_jitter_dl_e2e=0;
|
||||
@@ -207,7 +191,6 @@ void average_total_jitter(void)
|
||||
if (i<NB_eNB_INST) {
|
||||
otg_info->average_jitter_dl+=otg_info->rx_jitter_avg[i][j][k];
|
||||
otg_info->average_jitter_dl_e2e+=otg_info->rx_jitter_avg_e2e[i][j][k];
|
||||
|
||||
} else {
|
||||
otg_info->average_jitter_ul+=otg_info->rx_jitter_avg[i][j][k];
|
||||
otg_info->average_jitter_ul_e2e+=otg_info->rx_jitter_avg_e2e[i][j][k];
|
||||
@@ -221,10 +204,8 @@ void average_total_jitter(void)
|
||||
// otg_info->average_jitter_ul/= (float)NB_UE_INST;
|
||||
}
|
||||
|
||||
void kpi_gen()
|
||||
{
|
||||
void kpi_gen() {
|
||||
int i, j,k;
|
||||
|
||||
int tx_total_bytes_dl=0;
|
||||
int tx_total_pkts_dl=0;
|
||||
int rx_total_bytes_dl=0;
|
||||
@@ -233,13 +214,10 @@ void kpi_gen()
|
||||
int tx_total_pkts_ul=0;
|
||||
int rx_total_bytes_ul=0;
|
||||
int rx_total_pkts_ul=0;
|
||||
|
||||
float min_owd_dl=0;
|
||||
float max_owd_dl=0;
|
||||
|
||||
float min_owd_dl_e2e=0;
|
||||
float max_owd_dl_e2e=0;
|
||||
|
||||
int tx_total_bytes_dl_background=0;
|
||||
int tx_total_pkts_dl_background=0;
|
||||
int rx_total_bytes_dl_background=0;
|
||||
@@ -248,27 +226,18 @@ void kpi_gen()
|
||||
int tx_total_pkts_ul_background=0;
|
||||
int rx_total_bytes_ul_background=0;
|
||||
int rx_total_pkts_ul_background=0;
|
||||
|
||||
float min_owd_ul=0;
|
||||
float max_owd_ul=0;
|
||||
float min_owd_ul_e2e=0;
|
||||
float max_owd_ul_e2e=0;
|
||||
|
||||
|
||||
int tx_total_bytes_dl_multicast=0;
|
||||
int tx_total_pkts_dl_multicast=0;
|
||||
int rx_total_bytes_dl_multicast=0;
|
||||
int rx_total_pkts_dl_multicast=0;
|
||||
|
||||
|
||||
int num_active_source=0;
|
||||
|
||||
|
||||
int dl_ok=1,ul_ok=1;
|
||||
|
||||
char traffic_type[12];
|
||||
char traffic[30];
|
||||
|
||||
#ifdef STANDALONE
|
||||
FILE *file;
|
||||
file = fopen("log_OTG.txt", "w");
|
||||
@@ -281,11 +250,8 @@ void kpi_gen()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
for (i=0; i<(NB_eNB_INST + NB_UE_INST); i++) {
|
||||
for (j=0; j<(NB_eNB_INST + NB_UE_INST); j++) {
|
||||
|
||||
/*background stats*/
|
||||
if (i<NB_eNB_INST) {
|
||||
tx_total_bytes_dl_background+=otg_info->tx_num_bytes_background[i][j];
|
||||
@@ -300,7 +266,6 @@ void kpi_gen()
|
||||
}
|
||||
|
||||
for (k=0; k<MAX_NUM_APPLICATION; k++) {
|
||||
|
||||
tx_throughput(i,j,k);
|
||||
rx_goodput(i,j,k);
|
||||
rx_loss_rate_pkts(i,j,k);
|
||||
@@ -319,7 +284,6 @@ void kpi_gen()
|
||||
tx_total_pkts_dl_multicast+=otg_multicast_info->tx_num_pkt[i][j][k];
|
||||
rx_total_bytes_dl_multicast+=otg_multicast_info->rx_num_bytes[i][j][k];
|
||||
rx_total_pkts_dl_multicast+=otg_multicast_info->rx_num_pkt[i][j][k];
|
||||
|
||||
#ifdef STANDALONE
|
||||
LOG_I(OTG,"No stats for multicast "); // do nothing
|
||||
#else
|
||||
@@ -329,21 +293,17 @@ void kpi_gen()
|
||||
if (otg_multicast_info->tx_num_bytes[i][j][k]>0) {
|
||||
LOG_I(OTG,"----------------------------------------------------------\n");
|
||||
LOG_I(OTG,"Total Time (multicast) (ms)= %d \n", otg_info->ctime+1);
|
||||
|
||||
// LOG_I(OTG,"[%s] Multicast [eNB:%d -> UE:%d] \n",traffic_type, i, j);
|
||||
|
||||
LOG_I(OTG,"[MULTICAST] Total packets(TX)= %d \n", otg_multicast_info->tx_num_pkt[i][j][k]);
|
||||
LOG_I(OTG,"[MULTICAST] Total bytes(TX)= %d \n", otg_multicast_info->tx_num_bytes[i][j][k]);
|
||||
LOG_I(OTG,"[MULTICAST] Total packets(RX)= %d \n", otg_multicast_info->rx_num_pkt[i][j][k]);
|
||||
LOG_I(OTG,"[MULTICAST] Total bytes(RX)= %d \n", otg_multicast_info->rx_num_bytes[i][j][k]);
|
||||
|
||||
LOG_I(OTG,"[MULTICAST] TX throughput = %.7f (Kbit/s) \n", otg_multicast_info->tx_throughput[i][j]);
|
||||
LOG_I(OTG,"[MULTICAST] RX goodput = %.7f (Kbit/s) \n", otg_multicast_info->rx_goodput[i][j]);
|
||||
// if (otg_multicast_info->rx_loss_rate[i][j]>0){
|
||||
// LOG_I(OTG,"[MULTICAST] Loss rate = %lf \n", (otg_multicast_info->rx_loss_rate[i][j]));
|
||||
// LOG_I(OTG,"[MULTICAST] NB Lost packets=%d \n", (otg_multicast_info->tx_num_pkt[i][j][k]-otg_multicast_info->rx_num_pkt[i][j][k]));
|
||||
//}
|
||||
|
||||
// if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){
|
||||
LOG_F(OTG,"----------------------------------------------------------\n");
|
||||
LOG_F(OTG,"Total Time (multicast) (ms)= %d \n", otg_info->ctime+1);
|
||||
@@ -363,12 +323,9 @@ void kpi_gen()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}// end for multicast
|
||||
|
||||
|
||||
if ((otg_info->tx_throughput[i][j][k]>0)||((otg_info->tx_throughput_background[i][j]>0) && (otg_info->tx_num_bytes[i][j][k]>0))) {
|
||||
|
||||
num_active_source+=1;
|
||||
|
||||
if (i<NB_eNB_INST) { // DL
|
||||
@@ -392,7 +349,6 @@ void kpi_gen()
|
||||
|
||||
if ((max_owd_dl_e2e<otg_info->rx_owd_max_e2e[i][j][k]) || (max_owd_dl_e2e==0))
|
||||
max_owd_dl_e2e=otg_info->rx_owd_max_e2e[i][j][k];
|
||||
|
||||
} else { // UL
|
||||
tx_total_bytes_ul+=otg_info->tx_num_bytes[i][j][k];
|
||||
tx_total_pkts_ul+=otg_info->tx_num_pkt[i][j][k];
|
||||
@@ -414,7 +370,6 @@ void kpi_gen()
|
||||
|
||||
if ((max_owd_ul_e2e<otg_info->rx_owd_max_e2e[i][j][k]) || (max_owd_ul_e2e==0))
|
||||
max_owd_ul_e2e=otg_info->rx_owd_max_e2e[i][j][k];
|
||||
|
||||
}
|
||||
|
||||
//LOG_D(OTG,"KPI: (src=%d, dst=%d, appli %d) NB packet TX= %d, NB packet RX= %d\n ",i, j, otg_info->tx_num_pkt[i][j][k], otg_info->rx_num_pkt[i][j][k]);
|
||||
@@ -432,9 +387,7 @@ void kpi_gen()
|
||||
traffic[sizeof(traffic) - 1] = 0; // terminate string
|
||||
}
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
fprintf(file,"----------------------------------------------------------\n");
|
||||
fprintf(file,"Total Time (ms)= %d \n", otg_info->ctime+1);
|
||||
|
||||
@@ -467,8 +420,6 @@ void kpi_gen()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#else
|
||||
LOG_I(OTG,"----------------------------------------------------------\n");
|
||||
LOG_I(OTG,"Total Time (ms)= %d \n", otg_info->ctime+1);
|
||||
@@ -555,15 +506,11 @@ void kpi_gen()
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// if ((otg_multicast_info->tx_throughput[i][j]>0) && (otg_info->tx_num_bytes[i][j][k]>0)) {
|
||||
|
||||
}// end loop of k
|
||||
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)) {
|
||||
@@ -629,14 +576,10 @@ void kpi_gen()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}// end loop of j
|
||||
}// end loop of i
|
||||
|
||||
|
||||
// average_total_jitter();
|
||||
|
||||
#ifdef STANDALONE
|
||||
fprintf (file,"**************** TOTAL DL RESULTS ******************\n");
|
||||
fprintf(file,"Total Time= %d \n", otg_info->ctime+1);
|
||||
@@ -723,7 +666,6 @@ void kpi_gen()
|
||||
LOG_I(OTG,"[MULTICAST] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_dl_multicast*1000*8)/(otg_info->ctime*1024));
|
||||
}
|
||||
|
||||
|
||||
LOG_F(OTG,"**************** TOTAL DL RESULTS ******************\n");
|
||||
LOG_F(OTG,"Total Time (ms)= %d \n", otg_info->ctime+1);
|
||||
LOG_F(OTG,"[DATA] Total packets(TX)= %d \n", tx_total_pkts_dl);
|
||||
@@ -762,8 +704,6 @@ void kpi_gen()
|
||||
LOG_F(OTG,"[MULTICAST] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_dl_multicast*1000*8)/(otg_info->ctime*1024));
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOG_I(OTG,"**************** TOTAL UL RESULTS ******************\n");
|
||||
LOG_I(OTG,"Total Time (ms)= %d \n", otg_info->ctime+1);
|
||||
LOG_I(OTG,"[DATA] Total packets(TX)= %d \n", tx_total_pkts_ul);
|
||||
@@ -795,7 +735,6 @@ void kpi_gen()
|
||||
LOG_I(OTG,"[BACKGROUND] Total bytes(RX)= %d \n", rx_total_bytes_ul_background);
|
||||
LOG_I(OTG,"[BACKGROUND] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul_background*1000*8)/(otg_info->ctime*1024));
|
||||
LOG_I(OTG,"[BACKGROUND] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul_background*1000*8)/(otg_info->ctime*1024));
|
||||
|
||||
}
|
||||
|
||||
LOG_F(OTG,"**************** TOTAL UL RESULTS ******************\n");
|
||||
@@ -825,7 +764,6 @@ void kpi_gen()
|
||||
LOG_F(OTG,"[BACKGROUND] Total bytes(RX)= %d \n", rx_total_bytes_ul_background);
|
||||
LOG_F(OTG,"[BACKGROUND] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul_background*1000*8)/(otg_info->ctime*1024));
|
||||
LOG_F(OTG,"[BACKGROUND] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul_background*1000*8)/(otg_info->ctime*1024));
|
||||
|
||||
}
|
||||
|
||||
if ((dl_ok == 1 ) && (ul_ok ==1))
|
||||
@@ -837,8 +775,7 @@ void kpi_gen()
|
||||
}
|
||||
|
||||
|
||||
void add_log_metric(int src, int dst, int ctime, double metric, unsigned int label)
|
||||
{
|
||||
void add_log_metric(int src, int dst, int ctime, double metric, unsigned int label) {
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
unsigned int node_actif=0;
|
||||
@@ -846,28 +783,27 @@ void add_log_metric(int src, int dst, int ctime, double metric, unsigned int lab
|
||||
//LOG_I(OTG,"[%d][%d] LOGG_ADDED ctime=%d, metric=%.2f \n", src, dst, ctime, metric);
|
||||
|
||||
switch (label) {
|
||||
case OTG_LATENCY:
|
||||
add_log_label(label, &start_log_latency);
|
||||
break;
|
||||
case OTG_LATENCY:
|
||||
add_log_label(label, &start_log_latency);
|
||||
break;
|
||||
|
||||
case OTG_LATENCY_BG:
|
||||
add_log_label(label, &start_log_latency_bg);
|
||||
break;
|
||||
case OTG_LATENCY_BG:
|
||||
add_log_label(label, &start_log_latency_bg);
|
||||
break;
|
||||
|
||||
case OTG_GP:
|
||||
add_log_label(label, &start_log_GP);
|
||||
break;
|
||||
case OTG_GP:
|
||||
add_log_label(label, &start_log_GP);
|
||||
break;
|
||||
|
||||
case OTG_GP_BG:
|
||||
add_log_label(label, &start_log_GP_bg);
|
||||
break;
|
||||
case OTG_GP_BG:
|
||||
add_log_label(label, &start_log_GP_bg);
|
||||
break;
|
||||
|
||||
case OTG_JITTER:
|
||||
add_log_label(label, &start_log_GP_bg);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(OTG, "File label unknown %d \n", label);
|
||||
case OTG_JITTER:
|
||||
add_log_label(label, &start_log_GP_bg);
|
||||
break;
|
||||
default:
|
||||
LOG_E(OTG, "File label unknown %u \n", label);
|
||||
}
|
||||
|
||||
LOG_F(label,"%d ", ctime);
|
||||
@@ -892,8 +828,7 @@ void add_log_metric(int src, int dst, int ctime, double metric, unsigned int lab
|
||||
|
||||
|
||||
|
||||
void add_log_label(unsigned int label, unsigned int * start_log_metric)
|
||||
{
|
||||
void add_log_label(unsigned int label, unsigned int *start_log_metric) {
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
unsigned int node_actif=0;
|
||||
@@ -910,7 +845,7 @@ void add_log_label(unsigned int label, unsigned int * start_log_metric)
|
||||
node_actif++;
|
||||
|
||||
if (node_actif>0)
|
||||
LOG_F(label,"%d->%d ", i, j);
|
||||
LOG_F(label,"%u->%u ", i, j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+29
-61
@@ -38,9 +38,9 @@
|
||||
#include "otg_kpi.h"
|
||||
|
||||
#ifdef ENABLE_DB_STATS
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <sql_common.h>
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include <sql_common.h>
|
||||
#endif
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
@@ -54,12 +54,10 @@ extern unsigned char NB_UE_INST;
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
|
||||
// Check if the packet is well received or not and extract data
|
||||
int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const 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;
|
||||
otg_hdr_info_t * otg_hdr_info_rx;
|
||||
otg_hdr_t * otg_hdr_rx;
|
||||
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;
|
||||
@@ -70,26 +68,22 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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: destination %d, size %d, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %d \n",
|
||||
LOG_D(OTG,"otg_rx_pkt functions: destination %d, size %u, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %u \n",
|
||||
dst_instanceP,
|
||||
size,
|
||||
otg_hdr_info_rx->flag,
|
||||
otg_hdr_info_rx->size);
|
||||
|
||||
|
||||
if (((otg_hdr_info_rx->flag == 0xffff) ||
|
||||
(otg_hdr_info_rx->flag == 0xbbbb) ||
|
||||
(otg_hdr_info_rx->flag == 0x1000)) &&
|
||||
(otg_hdr_info_rx->size == size )) { //data traffic
|
||||
|
||||
LOG_I(OTG,"MAX_RX_INFO %d %d \n",NB_eNB_INST, NB_UE_INST);
|
||||
|
||||
/*is_size_ok= 0;
|
||||
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",
|
||||
LOG_I(OTG,"[SRC %u][DST %u] [FLOW_idx %u][APP TYPE %u] RX INFO pkt at time %d: flag 0x %x, seq number %u, tx time %u, size (hdr %u, pdcp %u) \n",
|
||||
otg_hdr_rx->src_instance,
|
||||
otg_hdr_rx->dst_instance,
|
||||
otg_hdr_rx->flow_id,
|
||||
@@ -99,14 +93,12 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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"
|
||||
//#warning "LG: TODO think about multicast traffic"
|
||||
/* TODO: fix this LOG, a lot of missing parameters, replaced by a simple basic version */
|
||||
/*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);*/
|
||||
@@ -114,7 +106,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
}
|
||||
|
||||
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",
|
||||
LOG_W(OTG,"RX packet: application type out of range %u for the pair of (src %u, dst %u) \n",
|
||||
otg_hdr_rx->traffic_type, src_instance, dst_instance);
|
||||
otg_hdr_rx->traffic_type=0;
|
||||
}
|
||||
@@ -135,7 +127,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
// 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",
|
||||
LOG_I(OTG,"received a multicast packet with size %u sn %u ran owd %u loss rate %u\n",
|
||||
otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts);
|
||||
//return 0;
|
||||
} /** background traffic **/
|
||||
@@ -148,10 +140,8 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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_instance, dst_instance, otg_hdr_rx->aggregation_level);
|
||||
LOG_D(OTG,"[%u][%u] AGGREGATION LEVEL (RX) %u \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_instance,
|
||||
@@ -161,11 +151,9 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
&seq_num_rx,
|
||||
&nb_loss_pkts);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/******/
|
||||
/*
|
||||
float owd_const_capillary_v=owd_const_capillary()/2;
|
||||
@@ -185,7 +173,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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_I(OTG,"received packet has tx time %d greater than the current time %d\n",otg_hdr_rx->time,ctime );
|
||||
LOG_I(OTG,"received packet has tx time %u greater than the current time %d\n",otg_hdr_rx->time,ctime );
|
||||
otg_info->radio_access_delay[src_instance][dst_instance] = 0;
|
||||
otg_multicast_info->radio_access_delay[src_instance][dst_instance]=0;
|
||||
}
|
||||
@@ -196,8 +184,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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",
|
||||
LOG_D(OTG, "[src %u][dst %u] ctime %d tx time %u: OWD %lf E2E OWD %lf \n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
ctime,
|
||||
@@ -217,7 +204,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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",
|
||||
LOG_D(OTG,"The packet jitter for the pair (src %u, dst %u)) at %d is %lf (current %lf, previous %lf) \n",
|
||||
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
|
||||
@@ -230,26 +217,24 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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",
|
||||
LOG_D(OTG,"The packet jitter for the pair (src %u, dst %u)) at %d is %lf (current %lf, previous %lf) \n",
|
||||
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",
|
||||
LOG_I(OTG,"[SRC%u -> DST %u] Received a multicast packet at time %d with size %u, seq num %u, ran owd %u number loss packet %u\n",
|
||||
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:%d (ms):\n",
|
||||
LOG_I(OTG,"INFO LATENCY :: [SRC %u][DST %u] radio access %.2f (tx time %u, ctime %d), OWD:%d (ms):\n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
otg_multicast_info->radio_access_delay[src_instance][dst_instance],
|
||||
@@ -286,8 +271,7 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
|
||||
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",
|
||||
LOG_I(OTG,"[SRC %u][DST %u] Stats :: radio access latency %.2f (tx time %u, ctime %d) jitter %.2f, Estimated E2E OWD:%.2f (ms):\n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
otg_info->radio_access_delay[src_instance][dst_instance],
|
||||
@@ -296,7 +280,6 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
otg_info->rx_pkt_owd_e2e[src_instance][dst_instance]);
|
||||
|
||||
if (otg_hdr_info_rx->flag == 0xffff) {
|
||||
|
||||
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];
|
||||
@@ -332,7 +315,6 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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) {
|
||||
@@ -355,15 +337,12 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
otg_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
|
||||
else
|
||||
otg_info->rx_total_bytes_ul+=otg_hdr_info_rx->size;
|
||||
|
||||
}
|
||||
|
||||
//LOG_I(OTG,"RX INFO :: RTT MIN(one way) ms: %.2f, RTT MAX(one way) ms: %.2f \n", otg_info->rx_owd_min[src][dst], otg_info->rx_owd_max[src][dst]);
|
||||
|
||||
/* xforms part: add metrics */
|
||||
|
||||
//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",
|
||||
LOG_I(OTG,"[RX] OTG packet, PACKET SIZE [SRC %u][DST %u]: Flag (0x%x), Traffic %u, time(%d), Seq num (%u), Total size (%u)\n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
otg_hdr_info_rx->flag,
|
||||
@@ -372,7 +351,6 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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_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;
|
||||
@@ -402,7 +380,6 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
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_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;
|
||||
@@ -446,18 +423,17 @@ int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buff
|
||||
|
||||
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",
|
||||
LOG_W(OTG,"[SRC %u][DST %u] RX pkt: seq number %u size mis-matche (hdr %u, pdcp %u) \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",
|
||||
LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %u, pdcp_size %u) FIX ME \n",
|
||||
otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size);
|
||||
return(1); //to be fixed on the real case to one
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
@@ -471,10 +447,8 @@ int rx_check_loss(
|
||||
const int dst,
|
||||
const unsigned int flag,
|
||||
const int seq_num,
|
||||
unsigned int * const seq_num_rx,
|
||||
unsigned int * const nb_loss_pkts)
|
||||
{
|
||||
|
||||
unsigned int *const seq_num_rx,
|
||||
unsigned int *const nb_loss_pkts) {
|
||||
/* Loss and out of sequence data management, we have 3 case : */
|
||||
/* (1) Receieved packet corresponds to the expected one, in terms of the sequence number*/
|
||||
int lost_packet=0;
|
||||
@@ -509,8 +483,7 @@ void owd_const_gen(
|
||||
const int src,
|
||||
const int dst,
|
||||
const int flow_id,
|
||||
const unsigned int flag)
|
||||
{
|
||||
const unsigned int flag) {
|
||||
otg_info->owd_const[src][dst][flow_id]=(owd_const_mobile_core()+owd_const_IP_backbone()+owd_const_application())/2;
|
||||
|
||||
if ((flag==M2M)||(flag==M2M_TRAFFIC)||(flag==AUTO_PILOT_L)||(flag==AUTO_PILOT_M)||(flag==AUTO_PILOT_H)||(flag==VIRTUAL_GAME_L)||(flag==VIRTUAL_GAME_M)|| (flag==VIRTUAL_GAME_H)||(flag==VIRTUAL_GAME_F)
|
||||
@@ -523,8 +496,7 @@ void owd_const_gen(
|
||||
|
||||
|
||||
|
||||
float owd_const_capillary(void)
|
||||
{
|
||||
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) +
|
||||
@@ -534,8 +506,7 @@ float owd_const_capillary(void)
|
||||
}
|
||||
|
||||
|
||||
float owd_const_mobile_core(void)
|
||||
{
|
||||
float owd_const_mobile_core(void) {
|
||||
/*double delay;
|
||||
// this is a delay model for a loaded GGSN according to
|
||||
//"M. Laner, P. Svoboda and M. Rupp, Latency Analysis of 3G Network Components, EW'12, Poznan, Poland, 2012", table 2, page 6.
|
||||
@@ -559,15 +530,12 @@ float owd_const_mobile_core(void)
|
||||
return ((double)MIN_U_PLANE_CORE_IP_ACCESS_DELAY+ (double)MAX_U_PLANE_CORE_IP_ACCESS_DELAY + (double)MIN_FW_PROXY_DELAY + (double)MAX_FW_PROXY_DELAY)/2;
|
||||
}
|
||||
|
||||
float owd_const_IP_backbone(void)
|
||||
{
|
||||
float owd_const_IP_backbone(void) {
|
||||
/*return uniform_dist(MIN_NETWORK_ACCESS_DELAY,MAX_NETWORK_ACCESS_DELAY);*/
|
||||
return ((double)MIN_NETWORK_ACCESS_DELAY+(double)MAX_NETWORK_ACCESS_DELAY)/2;
|
||||
|
||||
}
|
||||
|
||||
float owd_const_application(void)
|
||||
{
|
||||
float owd_const_application(void) {
|
||||
/*return uniform_dist(MIN_APPLICATION_ACESS_DELAY, MAX_APPLICATION_ACESS_DELAY);*/
|
||||
return ((double)MIN_APPLICATION_ACESS_DELAY+(double)MAX_APPLICATION_ACESS_DELAY)/2;
|
||||
}
|
||||
|
||||
+35
-35
@@ -305,10 +305,10 @@ unsigned char *packet_gen(
|
||||
otg_info->tx_num_pkt[src_instance][dst_instance][otg_info->traffic_type[src_instance][dst_instance]]+=1;
|
||||
|
||||
if (size!=strlen(payload))
|
||||
LOG_E(OTG,"[%d][%d] [0x %x] The expected packet size does not match the payload size : size %d, strlen %zu, seq_num %d packet: |%s|%s| \n",
|
||||
LOG_E(OTG,"[%d][%d] [0x %x] The expected packet size does not match the payload size : size %u, strlen %zu, seq_num %u packet: |%s|%s| \n",
|
||||
src_instance, dst_instance, flag, size, strlen(payload), seq_num, header, payload);
|
||||
else
|
||||
LOG_D(OTG,"[%d][%d] 0x %x][m2m Aggre %d][Flow %d][Type %d/%s] TX INFO pkt at time %d Size= [payload %d] [Total %zu] with seq num %d, state=%d : |%s|%s| \n",
|
||||
LOG_D(OTG,"[%d][%d] 0x %x][m2m Aggre %u][Flow %u][Type %u/%s] TX INFO pkt at time %d Size= [payload %u] [Total %zu] with seq num %u, state=%u : |%s|%s| \n",
|
||||
src_instance, dst_instance, flag,
|
||||
otg_info->m2m_aggregation[src_instance][dst_instance],
|
||||
otg_info->flow_id[src_instance][dst_instance],
|
||||
@@ -316,7 +316,7 @@ unsigned char *packet_gen(
|
||||
map_int_to_str(otg_app_type_names,otg_info->traffic_type[src_instance][dst_instance]),
|
||||
ctime, size, header_size+strlen(payload), seq_num,state, header, payload);
|
||||
|
||||
LOG_D(OTG, "[%d]MY_SEQ %d \n", otg_info->traffic_type[src_instance][dst_instance], otg_info->seq_num[src_instance][dst_instance][otg_info->traffic_type[src_instance][dst_instance]] );
|
||||
LOG_D(OTG, "[%u]MY_SEQ %d \n", otg_info->traffic_type[src_instance][dst_instance], otg_info->seq_num[src_instance][dst_instance][otg_info->traffic_type[src_instance][dst_instance]] );
|
||||
} else {
|
||||
if ((g_otg->aggregation_level[src_instance][dst_instance][application]*otg_info->size_background[src_instance][dst_instance])<=PAYLOAD_MAX)
|
||||
otg_info->size_background[src_instance][dst_instance]=g_otg->aggregation_level[src_instance][dst_instance][application]*otg_info->size_background[src_instance][dst_instance];
|
||||
@@ -335,7 +335,7 @@ unsigned char *packet_gen(
|
||||
otg_info->seq_num_background[src_instance][dst_instance]+=1;
|
||||
|
||||
if (otg_info->size_background[src_instance][dst_instance]!=strlen(payload))
|
||||
LOG_E(OTG,"[%d][%d] [0x %x] The expected packet size does not match the payload size : size %d, strlen %zu, seq num %d, packet |%s|%s| \n",
|
||||
LOG_E(OTG,"[%d][%d] [0x %x] The expected packet size does not match the payload size : size %d, strlen %zu, seq num %u, packet |%s|%s| \n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
flag,
|
||||
@@ -345,7 +345,7 @@ unsigned char *packet_gen(
|
||||
header,
|
||||
payload);
|
||||
else
|
||||
LOG_D(OTG,"[%d][%d][0x %x][%d] TX INFO pkt at time %s size is %d with seq num %d, state=%d : |%s|%s| \n",
|
||||
LOG_D(OTG,"[%d][%d][0x %x][%d] TX INFO pkt at time %s size is %d with seq num %u, state=%u : |%s|%s| \n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
flag,
|
||||
@@ -367,7 +367,7 @@ unsigned char *packet_gen(
|
||||
otg_info->tx_total_bytes_ul+=buffer_size;
|
||||
|
||||
if (otg_info->traffic_type[src_instance][dst_instance] > MAX_NUM_APPLICATION) {
|
||||
LOG_W(OTG,"application type out of range %d for the pair of (src %d, dst %d) \n",
|
||||
LOG_W(OTG,"application type out of range %u for the pair of (src %d, dst %d) \n",
|
||||
otg_info->traffic_type[src_instance][dst_instance], src_instance, dst_instance);
|
||||
otg_info->traffic_type[src_instance][dst_instance]=0;
|
||||
}
|
||||
@@ -425,7 +425,7 @@ unsigned char *packet_gen_multicast(
|
||||
g_otg_multicast->idt_max[src_instance][dst_instance][app]));
|
||||
size = ceil(uniform_dist(g_otg_multicast->size_min[src_instance][dst_instance][app],
|
||||
g_otg_multicast->size_max[src_instance][dst_instance][app]));
|
||||
LOG_D(OTG, "ptime %d, ctime %d idt %d (min %d, max %d) size %d (min %d, max %d)\n",
|
||||
LOG_D(OTG, "ptime %d, ctime %d idt %d (min %d, max %d) size %u (min %d, max %d)\n",
|
||||
otg_multicast_info->ptime[src_instance][dst_instance][application],
|
||||
ctime,
|
||||
otg_multicast_info->idt[src_instance][dst_instance][app],
|
||||
@@ -459,10 +459,10 @@ unsigned char *packet_gen_multicast(
|
||||
otg_multicast_info->tx_num_bytes[src_instance][dst_instance][app]);
|
||||
|
||||
if (size!=strlen(payload))
|
||||
LOG_E(OTG,"[src %d][dst %d] The expected packet size does not match the payload size : size %d, strlen %zu \n",
|
||||
LOG_E(OTG,"[src %d][dst %d] The expected packet size does not match the payload size : size %u, strlen %zu \n",
|
||||
src_instance, dst_instance, size, strlen(payload));
|
||||
else {
|
||||
LOG_I(OTG,"[src %d][dst %d]TX INFO pkt at time %d Size= [payload %d] [Total %zu] with seq num %d: |%s|%s| \n",
|
||||
LOG_I(OTG,"[src %d][dst %d]TX INFO pkt at time %d Size= [payload %u] [Total %zu] with seq num %d: |%s|%s| \n",
|
||||
src_instance,
|
||||
dst_instance,
|
||||
ctime,
|
||||
@@ -557,7 +557,7 @@ int check_data_transmit(
|
||||
// for (application=0; application<g_otg->application_idx[src_instance][dst_instance]; application++){
|
||||
otg_info->gen_pkts=0;
|
||||
|
||||
LOG_T(OTG,"FLOW_INFO [src %d][dst %d] [IDX %d] [APPLICATION TYPE %d] MAX %d [M2M %d ]\n",
|
||||
LOG_T(OTG,"FLOW_INFO [src %d][dst %d] [IDX %d] [APPLICATION TYPE %d] MAX %u [M2M %u ]\n",
|
||||
src_instance, dst_instance, app,
|
||||
g_otg->application_type[src_instance][dst_instance][app],
|
||||
g_otg->application_idx[src_instance][dst_instance],
|
||||
@@ -605,7 +605,7 @@ int check_data_transmit(
|
||||
|
||||
if (((state==PU_STATE)||(state==ED_STATE))|| (otg_info->idt[src_instance][dst_instance][app]==0)
|
||||
|| (( (ctime-otg_info->ptime[src_instance][dst_instance][app]) >= otg_info->idt[src_instance][dst_instance][app] ) )) {
|
||||
LOG_D(OTG,"[TX] OTG packet: Time To Transmit::OK (Source= %d, Destination= %d, Application %d, State= %d) , (IDT= %d ,ctime= %d, ptime= %d) \n",
|
||||
LOG_D(OTG,"[TX] OTG packet: Time To Transmit::OK (Source= %d, Destination= %d, Application %d, State= %u) , (IDT= %d ,ctime= %d, ptime= %d) \n",
|
||||
src_instance,
|
||||
dst_instance ,
|
||||
app,
|
||||
@@ -654,7 +654,7 @@ int check_data_transmit(
|
||||
if (g_otg->m2m[src_instance][dst_instance][app]==M2M)
|
||||
otg_info->traffic_type[src_instance][dst_instance]=app;//g_otg->application_idx[src_instance][dst_instance];//M2M;
|
||||
|
||||
LOG_D(OTG,"[BACKGROUND=%d] Time To Transmit [SRC %d][DST %d][APPLI %d] \n", otg_info->traffic_type_background[src_instance][dst_instance], src_instance, dst_instance, app);
|
||||
LOG_D(OTG,"[BACKGROUND=%u] Time To Transmit [SRC %d][DST %d][APPLI %d] \n", otg_info->traffic_type_background[src_instance][dst_instance], src_instance, dst_instance, app);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -720,7 +720,7 @@ void header_size_gen(
|
||||
if ((g_otg->application_type[src_instance][dst_instance][application]==VOIP_G711)||(g_otg->application_type[src_instance][dst_instance][application]==VOIP_G729))
|
||||
size_header+=RTP_HEADER;
|
||||
|
||||
LOG_D(OTG,"Header size is %d [IP V=%d][PROTO=%d]\n", size_header, g_otg->ip_v[src_instance][dst_instance][application],g_otg->trans_proto[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"Header size is %u [IP V=%d][PROTO=%d]\n", size_header, g_otg->ip_v[src_instance][dst_instance][application],g_otg->trans_proto[src_instance][dst_instance][application]);
|
||||
otg_info->header_size_app[src_instance][dst_instance][application]=size_header;
|
||||
}
|
||||
}
|
||||
@@ -889,7 +889,7 @@ unsigned char * serialize_buffer(
|
||||
otg_hdr_p->traffic_type=traffic_type;
|
||||
byte_tx_count += sizeof(otg_hdr_t);
|
||||
|
||||
LOG_I(OTG,"traffic type %d\n",otg_hdr_p->traffic_type);
|
||||
LOG_I(OTG,"traffic type %u\n",otg_hdr_p->traffic_type);
|
||||
// copy the header first
|
||||
memcpy(&tx_buffer[byte_tx_count], header, strlen(header));
|
||||
byte_tx_count += strlen(header);
|
||||
@@ -1953,7 +1953,7 @@ int header_size_gen_background(
|
||||
otg_info->header_size_background[src_instance][dst_instance]=size_header;
|
||||
}
|
||||
|
||||
LOG_D(OTG," [SRC %d][DST %d] BACKGROUND TRAFFIC:: size header %d \n", src_instance, dst_instance, otg_info->header_size_background[src_instance][dst_instance]);
|
||||
LOG_D(OTG," [SRC %d][DST %d] BACKGROUND TRAFFIC:: size header %u \n", src_instance, dst_instance, otg_info->header_size_background[src_instance][dst_instance]);
|
||||
return otg_info->header_size_background[src_instance][dst_instance];
|
||||
}
|
||||
|
||||
@@ -1987,7 +1987,7 @@ void state_management(
|
||||
|
||||
if (ctime>otg_info->start_holding_time_off[src_instance][dst_instance][application]) {
|
||||
otg_info->c_holding_time_off[src_instance][dst_instance][application]= ctime - otg_info->start_holding_time_off[src_instance][dst_instance][application];
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] STATE:: OFF Holding Time %d (%d, %d)\n", src_instance, dst_instance,application , g_otg->aggregation_level[src_instance][dst_instance][application],
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] STATE:: OFF Holding Time %u (%d, %u)\n", src_instance, dst_instance,application , g_otg->aggregation_level[src_instance][dst_instance][application],
|
||||
otg_info->c_holding_time_off[src_instance][dst_instance][application], ctime, otg_info->start_holding_time_off[src_instance][dst_instance][application]);
|
||||
}
|
||||
|
||||
@@ -1997,7 +1997,7 @@ void state_management(
|
||||
+g_otg->prob_off_pe[src_instance][dst_instance][application])))
|
||||
&& (otg_info->c_holding_time_off[src_instance][dst_instance][application]>=g_otg->holding_time_off_pu[src_instance][dst_instance][application])) {
|
||||
otg_info->state[src_instance][dst_instance][application]=PU_STATE;
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: OFF-->PU %d (ctime %d, start %d )\n", src_instance, dst_instance,application,
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: OFF-->PU %u (ctime %d, start %u )\n", src_instance, dst_instance,application,
|
||||
g_otg->aggregation_level[src_instance][dst_instance][application], otg_info->c_holding_time_off[src_instance][dst_instance][application], ctime,
|
||||
otg_info->start_holding_time_off[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
@@ -2007,7 +2007,7 @@ void state_management(
|
||||
&& (otg_info->state_transition_prob[src_instance][dst_instance][application]< 1-g_otg->prob_off_pe[src_instance][dst_instance][application]))
|
||||
&& (otg_info->c_holding_time_off[src_instance][dst_instance][application]>=g_otg->holding_time_off_ed[src_instance][dst_instance][application])) {
|
||||
otg_info->state[src_instance][dst_instance][application]=ED_STATE;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: OFF-->ED \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: OFF-->ED \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
}
|
||||
|
||||
@@ -2015,13 +2015,13 @@ void state_management(
|
||||
&& (otg_info->state_transition_prob[src_instance][dst_instance][application]<=1))
|
||||
&& (otg_info->c_holding_time_off[src_instance][dst_instance]>=g_otg->holding_time_off_pe[src_instance][dst_instance])) {
|
||||
otg_info->state[src_instance][dst_instance][application]=PE_STATE;
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: OFF-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: OFF-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
|
||||
} else {
|
||||
otg_info->c_holding_time_off[src_instance][dst_instance][application]= ctime - otg_info->start_holding_time_off[src_instance][dst_instance][application];
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] STATE:: OFF\n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] STATE:: OFF\n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2033,20 +2033,20 @@ void state_management(
|
||||
otg_info->state[src_instance][dst_instance][application]=OFF_STATE;
|
||||
otg_info->start_holding_time_off[src_instance][dst_instance][application]=ctime;
|
||||
otg_info->c_holding_time_off[src_instance][dst_instance][application]=0;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: PU-->OFF \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: PU-->OFF \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
} else if ((otg_info->state_transition_prob[src_instance][dst_instance][application]<=1-g_otg->prob_pu_pe[src_instance][dst_instance][application])
|
||||
&& (otg_info->state_transition_prob[src_instance][dst_instance][application]>1-(g_otg->prob_pu_ed[src_instance][dst_instance][application]
|
||||
+g_otg->prob_pu_pe[src_instance][dst_instance][application]))) {
|
||||
//otg_info->state[src_instance][dst_instance]=ON_STATE;
|
||||
otg_info->state[src_instance][dst_instance][application]=ED_STATE;
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: PU-->ED \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: PU-->ED \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
} else { /*if (otg_info->state_transition_prob[src_instance][dst_instance]>=g_otg->prob_pu_ed)*/
|
||||
//otg_info->state[src_instance][dst_instance]=ON_STATE;
|
||||
otg_info->state[src_instance][dst_instance][application]=PE_STATE;
|
||||
otg_info->start_holding_time_pe_off[src_instance][dst_instance][application]=ctime;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: PU-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: PU-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
}
|
||||
|
||||
@@ -2059,20 +2059,20 @@ void state_management(
|
||||
otg_info->state[src_instance][dst_instance][application]=OFF_STATE;
|
||||
otg_info->start_holding_time_off[src_instance][dst_instance][application]=ctime;
|
||||
otg_info->c_holding_time_off[src_instance][dst_instance][application]=0;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: ED-->OFF \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: ED-->OFF \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
} else if ((otg_info->state_transition_prob[src_instance][dst_instance][application]>=1-(g_otg->prob_ed_pu[src_instance][dst_instance][application] +
|
||||
g_otg->prob_ed_pe[src_instance][dst_instance][application] ))
|
||||
&& (otg_info->state_transition_prob[src_instance][dst_instance][application]<1-g_otg->prob_ed_pe[src_instance][dst_instance][application])) {
|
||||
//otg_info->state[src_instance][dst_instance]=ON_STATE;
|
||||
otg_info->state[src_instance][dst_instance][application]=PE_STATE;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: ED-->PU \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: ED-->PU \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
} else { /*if ((otg_info->state_transition_prob[src_instance][dst_instance]>=1-g_otg->prob_ed_pe)&&(otg_info->state_transition_prob[src_instance][dst_instance]<=1)) */
|
||||
//otg_info->state[src_instance][dst_instance]=ON_STATE;
|
||||
otg_info->state[src_instance][dst_instance][application]=PE_STATE;
|
||||
otg_info->start_holding_time_pe_off[src_instance][dst_instance][application]=ctime;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: ED-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: ED-->PE \n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
}
|
||||
|
||||
@@ -2082,7 +2082,7 @@ void state_management(
|
||||
if (g_otg->holding_time_pe_off[src_instance][dst_instance][application]<=otg_info->c_holding_time_pe_off[src_instance][dst_instance][application]) {
|
||||
//otg_info->state[src_instance][dst_instance]=OFF_STATE;
|
||||
otg_info->state[src_instance][dst_instance][application]=OFF_STATE;
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%d] NEW STATE:: PE->OFF\n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d][Agg Level=%u] NEW STATE:: PE->OFF\n", src_instance, dst_instance,application, g_otg->aggregation_level[src_instance][dst_instance][application]);
|
||||
otg_info->c_holding_time_pe_off[src_instance][dst_instance][application]=0;
|
||||
otg_info->state_transition_prob[src_instance][dst_instance][application]=uniform_dist(0,1);
|
||||
otg_info->start_holding_time_off[src_instance][dst_instance][application]=ctime;
|
||||
@@ -2097,7 +2097,7 @@ void state_management(
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_W(OTG,"Unknown state(%d) \n", otg_info->state[src_instance][dst_instance][application]);
|
||||
LOG_W(OTG,"Unknown state(%u) \n", otg_info->state[src_instance][dst_instance][application]);
|
||||
otg_info->state[src_instance][dst_instance][application]= OFF_STATE; // switch to default state
|
||||
|
||||
break;
|
||||
@@ -2145,13 +2145,13 @@ void voip_traffic(
|
||||
if (ctime>otg_info->start_voip_silence[src_instance][dst_instance][application])
|
||||
otg_info->c_holding_time_silence[src_instance][dst_instance][application]= ctime - otg_info->start_voip_silence[src_instance][dst_instance][application];
|
||||
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d] VOIP STATE:: SILENCE %d (ctime=%d, start=%d)\n", src_instance, dst_instance,application,
|
||||
LOG_D(OTG,"[%d][%d][Appli id %d] VOIP STATE:: SILENCE %u (ctime=%d, start=%u)\n", src_instance, dst_instance,application,
|
||||
otg_info->c_holding_time_silence[src_instance][dst_instance][application], ctime, otg_info->start_voip_silence[src_instance][dst_instance][application]);
|
||||
}
|
||||
|
||||
if (otg_info->c_holding_time_silence[src_instance][dst_instance][application]>=otg_info->silence_time[src_instance][dst_instance][application]) {
|
||||
otg_info->voip_state[src_instance][dst_instance][application]=SIMPLE_TALK;
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] NEW VOIP STATE :: SILENCE-->TALK %d (ctime=%d, start=%d )\n", src_instance, dst_instance,application ,
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] NEW VOIP STATE :: SILENCE-->TALK %u (ctime=%d, start=%u )\n", src_instance, dst_instance,application ,
|
||||
otg_info->c_holding_time_silence[src_instance][dst_instance][application], ctime, otg_info->start_voip_silence[src_instance][dst_instance][application]);
|
||||
otg_info->start_voip_talk[src_instance][dst_instance][application]=ctime;
|
||||
otg_info->c_holding_time_talk[src_instance][dst_instance][application]=0;
|
||||
@@ -2160,7 +2160,7 @@ void voip_traffic(
|
||||
if (ctime>otg_info->start_voip_silence[src_instance][dst_instance][application])
|
||||
otg_info->c_holding_time_silence[src_instance][dst_instance][application]= ctime - otg_info->start_voip_silence[src_instance][dst_instance][application];
|
||||
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] STATE:: SILENCE [timer:%d] \n", src_instance, dst_instance,application, otg_info->c_holding_time_silence[src_instance][dst_instance][application]);
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] STATE:: SILENCE [timer:%u] \n", src_instance, dst_instance,application, otg_info->c_holding_time_silence[src_instance][dst_instance][application]);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2168,7 +2168,7 @@ void voip_traffic(
|
||||
case SIMPLE_TALK:
|
||||
if (otg_info->c_holding_time_talk[src_instance][dst_instance][application]>=otg_info->simple_talk_time[src_instance][dst_instance][application]) {
|
||||
otg_info->voip_state[src_instance][dst_instance][application]=SILENCE;
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] NEW VOIP STATE:: TALK-->SILENCE %d (ctime=%d, start=%d )\n", src_instance, dst_instance,application ,
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] NEW VOIP STATE:: TALK-->SILENCE %u (ctime=%d, start=%u )\n", src_instance, dst_instance,application ,
|
||||
otg_info->c_holding_time_talk[src_instance][dst_instance][application], ctime, otg_info->start_voip_talk[src_instance][dst_instance][application]);
|
||||
otg_info->start_voip_silence[src_instance][dst_instance][application]=ctime;
|
||||
otg_info->c_holding_time_silence[src_instance][dst_instance][application]=0;
|
||||
@@ -2177,15 +2177,15 @@ void voip_traffic(
|
||||
if (ctime>otg_info->start_voip_talk[src_instance][dst_instance][application])
|
||||
otg_info->c_holding_time_talk[src_instance][dst_instance][application]= ctime - otg_info->start_voip_talk[src_instance][dst_instance][application];
|
||||
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] VOIP STATE:: TALK [timer:%d]\n", src_instance, dst_instance,application, otg_info->c_holding_time_talk[src_instance][dst_instance][application]);
|
||||
LOG_I(OTG, "test_talk [ctime %d] [start talk %d] [%d] \n",ctime, otg_info->start_voip_talk[src_instance][dst_instance][application],
|
||||
LOG_I(OTG,"[%d][%d][Appli id %d] VOIP STATE:: TALK [timer:%u]\n", src_instance, dst_instance,application, otg_info->c_holding_time_talk[src_instance][dst_instance][application]);
|
||||
LOG_I(OTG, "test_talk [ctime %d] [start talk %u] [%u] \n",ctime, otg_info->start_voip_talk[src_instance][dst_instance][application],
|
||||
otg_info->c_holding_time_talk[src_instance][dst_instance][application] );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_W(OTG,"Unknown VOIP state(%d) \n", otg_info->voip_state[src_instance][dst_instance][application]);
|
||||
LOG_W(OTG,"Unknown VOIP state(%u) \n", otg_info->voip_state[src_instance][dst_instance][application]);
|
||||
otg_info->voip_state[src_instance][dst_instance][application]= SILENCE; // switch to default state
|
||||
|
||||
break;
|
||||
|
||||
@@ -36,28 +36,28 @@
|
||||
|
||||
#ifdef WIN32 /* si vous êtes sous Windows */
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#elif defined (linux) /* si vous êtes sous Linux */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h> /* close */
|
||||
#include <netdb.h> /* gethostbyname */
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h> /* close */
|
||||
#include <netdb.h> /* gethostbyname */
|
||||
#include <errno.h>
|
||||
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKET_ERROR -1
|
||||
#define closesocket(s) close(s)
|
||||
typedef int SOCKET;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
typedef struct in_addr IN_ADDR;
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKET_ERROR -1
|
||||
#define closesocket(s) close(s)
|
||||
typedef int SOCKET;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
typedef struct in_addr IN_ADDR;
|
||||
#else /* sinon vous êtes sur une plateforme non supportée */
|
||||
|
||||
#error not defined for this platform
|
||||
#error not defined for this platform
|
||||
|
||||
#endif
|
||||
|
||||
@@ -67,11 +67,8 @@ control_hdr_t *control_hdr;
|
||||
|
||||
|
||||
|
||||
void socket_packet_send(int src, int dst, int state,int ctime)
|
||||
{
|
||||
|
||||
void socket_packet_send(int src, int dst, int state,int ctime) {
|
||||
init_control_header();
|
||||
|
||||
LOG_I(OTG,"SOCKET:: IP version %d, Transport Protocol %d \n", g_otg->ip_v[src], g_otg->trans_proto[src]);
|
||||
|
||||
if ((g_otg->ip_v[src]==1) && (g_otg->trans_proto[src]==2))
|
||||
@@ -85,29 +82,20 @@ void socket_packet_send(int src, int dst, int state,int ctime)
|
||||
|
||||
if ((g_otg->ip_v[src]==2) && (g_otg->trans_proto[src]==1))
|
||||
client_socket_udp_ip6(src, dst, state, ctime);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void client_socket_tcp_ip4(int src, int dst, int state, int ctime)
|
||||
{
|
||||
|
||||
void client_socket_tcp_ip4(int src, int dst, int state, int ctime) {
|
||||
#define PORT 7777
|
||||
|
||||
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
|
||||
|
||||
#if defined (WIN32)
|
||||
WSADATA WSAData;
|
||||
int erreur = WSAStartup(MAKEWORD(2,2), &WSAData);
|
||||
#else
|
||||
int erreur = 0;
|
||||
#endif
|
||||
|
||||
SOCKET sock;
|
||||
SOCKADDR_IN sin;
|
||||
int sock_err;
|
||||
@@ -118,94 +106,69 @@ void client_socket_tcp_ip4(int src, int dst, int state, int ctime)
|
||||
if(!erreur) {
|
||||
/* Create socket */
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
/* Configure the connection */
|
||||
sin.sin_addr.s_addr = inet_addr(g_otg->dst_ip[src]);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(PORT);
|
||||
|
||||
/* connection is ok */
|
||||
|
||||
printf("SOCKET:: TCP-IP4 :: \n");
|
||||
|
||||
if(connect(sock, (SOCKADDR*)&sin, sizeof(sin)) != SOCKET_ERROR) {
|
||||
if(connect(sock, (SOCKADDR *)&sin, sizeof(sin)) != SOCKET_ERROR) {
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Create socket %s with dst port %d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
|
||||
ctime=0;
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: ctime=%d, duration=%d \n", ctime, g_otg->duration[src]);
|
||||
|
||||
init_control_header();
|
||||
|
||||
|
||||
do {
|
||||
//payload=NULL;
|
||||
//payload=packet_gen_socket(src, dst, state, ctime);
|
||||
//payload="CCCCC";
|
||||
|
||||
char *payload_rest;
|
||||
payload_rest=packet_gen_socket(src, dst, state, ctime);
|
||||
|
||||
if (payload_rest!=NULL) {
|
||||
|
||||
|
||||
|
||||
payload_t *payload;
|
||||
payload= malloc(sizeof(payload_t));
|
||||
// Data serialization
|
||||
char *tx_buffer;
|
||||
tx_buffer= (char *)malloc(PAYLOAD_MAX);
|
||||
|
||||
payload->control_hdr=otg_info_hdr_gen(src, dst, TCP, IPV4);
|
||||
|
||||
payload->payload_rest=payload_rest;
|
||||
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
|
||||
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
|
||||
|
||||
|
||||
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
|
||||
|
||||
|
||||
if((sock_err = send(sock, tx_buffer, total_size, 0)) != SOCKET_ERROR)
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Payload to send size :: %d \n",sock_err);
|
||||
else
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Transmission Error\n");
|
||||
|
||||
free(payload);
|
||||
free(tx_buffer);
|
||||
}
|
||||
|
||||
ctime+=1;
|
||||
|
||||
|
||||
} while (ctime<=g_otg->duration[src]) ;
|
||||
|
||||
|
||||
}
|
||||
/* connection is not possible..." */
|
||||
else
|
||||
LOG_I(OTG,"SOCKET:: TCP-IP4 :: connection is not possible to connect \n");
|
||||
|
||||
|
||||
/* close the socket */
|
||||
closesocket(sock);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void client_socket_udp_ip4(int src, int dst, int state,int ctime)
|
||||
{
|
||||
|
||||
void client_socket_udp_ip4(int src, int dst, int state,int ctime) {
|
||||
char *payload_rest;
|
||||
signed int udp_send;
|
||||
|
||||
|
||||
|
||||
int sockfd, ok, addr_in_size;
|
||||
u_short portnum = 12345;
|
||||
struct sockaddr_in *to;
|
||||
struct hostent *toinfo;
|
||||
char *htoname = "127.0.0.1";
|
||||
u_long toaddr;
|
||||
|
||||
LOG_I(OTG,"SOCKET:: UDP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
|
||||
to = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));
|
||||
|
||||
@@ -226,7 +189,6 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime)
|
||||
|
||||
to->sin_port = portnum;
|
||||
|
||||
|
||||
//
|
||||
/*
|
||||
|
||||
@@ -238,8 +200,6 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime)
|
||||
memset(control_hdr, 0, sizeof(control_hdr_t));
|
||||
*/
|
||||
//
|
||||
|
||||
|
||||
if((sockfd = socket (PF_INET, SOCK_DGRAM, 0)) == -1) {
|
||||
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in socket: %s\n",errno,sys_errlist[errno]);
|
||||
exit(errno);
|
||||
@@ -249,21 +209,20 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime)
|
||||
payload_rest=packet_gen_socket(src, dst, state, ctime);
|
||||
|
||||
if (payload_rest!=NULL) {
|
||||
|
||||
payload_t *payload;
|
||||
payload= malloc(sizeof(payload_t));
|
||||
// Data serialization
|
||||
char *tx_buffer;
|
||||
tx_buffer= (char *)malloc(PAYLOAD_MAX);
|
||||
|
||||
|
||||
if (tx_buffer == NULL || payload == NULL) {
|
||||
LOG_E(OTG,"Memory allocation failed\n");
|
||||
return;
|
||||
}
|
||||
payload->control_hdr=otg_info_hdr_gen(src, dst, UDP, IPV4);
|
||||
payload->payload_rest=payload_rest;
|
||||
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
|
||||
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
|
||||
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
|
||||
|
||||
|
||||
udp_send=sendto(sockfd, tx_buffer,total_size ,0,(struct sockaddr *)to,addr_in_size);
|
||||
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Payload to send :: data sent:%d \n", udp_send);
|
||||
// Update TX OTG info
|
||||
@@ -271,69 +230,42 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime)
|
||||
//otg_info->rx_num_bytes[src][dst]+= udp_send + (HDR_IP_v4 + HDR_UDP);
|
||||
//
|
||||
|
||||
if (NULL != payload) {
|
||||
payload=NULL;
|
||||
free(payload);
|
||||
}
|
||||
|
||||
if (NULL != tx_buffer) {
|
||||
tx_buffer=NULL;
|
||||
free(tx_buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
free(payload);
|
||||
free(tx_buffer);
|
||||
}
|
||||
|
||||
if(udp_send == -1) {
|
||||
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Transmission Error\n");
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
else
|
||||
} else
|
||||
LOG_I(OTG,"SOCKET:: UDP-IP4 :: No data to transmit\n");
|
||||
|
||||
ctime+=1;
|
||||
|
||||
|
||||
} while (ctime<=g_otg->duration[src]) ;
|
||||
|
||||
closesocket(sockfd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void client_socket_tcp_ip6(int src, int dst, int state,int ctime)
|
||||
{
|
||||
void client_socket_tcp_ip6(int src, int dst, int state,int ctime) {
|
||||
printf("client TCP IPv6\n");
|
||||
|
||||
}
|
||||
|
||||
void client_socket_udp_ip6(int src, int dst, int state,int ctime)
|
||||
{
|
||||
void client_socket_udp_ip6(int src, int dst, int state,int ctime) {
|
||||
printf("client UDP IPv6\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char* packet_gen_socket(int src, int dst, int state, int ctime)
|
||||
{
|
||||
|
||||
char *packet_gen_socket(int src, int dst, int state, int ctime) {
|
||||
int size;
|
||||
char *payload=NULL;
|
||||
|
||||
|
||||
set_ctime(ctime);
|
||||
LOG_I(OTG,"SOCKET :: num_nodes_tx:: %d , seed:: %d \n", g_otg->num_nodes, g_otg->seed);
|
||||
|
||||
LOG_I(OTG,"SOCKET :: NODE_INFO (Source= %d, Destination= %d,State= %d) ctime %d \n", src, dst, state, otg_info->ctime);
|
||||
|
||||
|
||||
LOG_I(OTG,"SOCKET :: INFO_SIM (src=%d, dst=%d, state=%d) application=%d, idt dist =%d, pkts dist= %d\n", src, dst, state, g_otg->application_type[src][dst], g_otg->idt_dist[src][dst][state],
|
||||
g_otg->size_dist[src][dst][state]);
|
||||
|
||||
LOG_I(OTG,"SOCKET :: Transmission info: idt=%d, simulation time=%d \n", otg_info->idt[src][dst], ctime);
|
||||
|
||||
// do not generate packet for this pair of src, dst : no app type and/or idt are defined
|
||||
@@ -352,7 +284,6 @@ char* packet_gen_socket(int src, int dst, int state, int ctime)
|
||||
//end pre-config
|
||||
|
||||
if ((otg_info->idt[src][dst]==(ctime-otg_info->ptime[src][dst][state])) || (otg_info->idt[src][dst]==0)) {
|
||||
|
||||
LOG_I(OTG,"SOCKET :: Time To Transmit (Source= %d, Destination= %d,State= %d) , (IDT= %d ,simu time= %d, previous packet time= %d) \n", src, dst, state ,otg_info->idt[src][dst], ctime,
|
||||
otg_info->ptime[src][dst][state]);
|
||||
otg_info->ptime[src][dst][state]=ctime;
|
||||
@@ -362,8 +293,6 @@ char* packet_gen_socket(int src, int dst, int state, int ctime)
|
||||
return 0; // do not generate the packet, and keep the idt
|
||||
}
|
||||
|
||||
|
||||
|
||||
size=size_dist(src, dst, state);
|
||||
LOG_I(OTG,"SOCKET :: Generate Packet for (Source= %d, Destination= %d,State= %d) , pkt size dist= %d, simu time= %d ,packet size=%d \n",
|
||||
src, dst, state, g_otg->size_dist[src][dst][state], otg_info->ctime, size);
|
||||
@@ -374,15 +303,12 @@ char* packet_gen_socket(int src, int dst, int state, int ctime)
|
||||
size=(5* sizeof(int))+10;
|
||||
|
||||
payload=payload_pkts(size);
|
||||
|
||||
return(payload);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
control_hdr_t *otg_info_hdr_gen(int src, int dst, int trans_proto, int ip_v)
|
||||
{
|
||||
control_hdr_t *otg_info_hdr_gen(int src, int dst, int trans_proto, int ip_v) {
|
||||
control_hdr->src=src;
|
||||
control_hdr->dst=dst;
|
||||
control_hdr->trans_proto=trans_proto;
|
||||
@@ -391,15 +317,11 @@ control_hdr_t *otg_info_hdr_gen(int src, int dst, int trans_proto, int ip_v)
|
||||
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->dst);
|
||||
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->trans_proto);
|
||||
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->ip_v);
|
||||
|
||||
|
||||
return control_hdr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_control_header()
|
||||
{
|
||||
void init_control_header() {
|
||||
//set otg header to 0
|
||||
control_hdr = calloc(1, sizeof(control_hdr_t));
|
||||
|
||||
|
||||
@@ -303,27 +303,31 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
|
||||
|
||||
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_X2SetupRequest_IEs_t, ie, x2SetupRequest,
|
||||
X2AP_ProtocolIE_ID_id_GlobalENB_ID, true);
|
||||
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.present == X2AP_ENB_ID_PR_home_eNB_ID) {
|
||||
// Home eNB ID = 28 bits
|
||||
uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.home_eNB_ID.buf;
|
||||
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 28) {
|
||||
//TODO: handle case were size != 28 -> notify ? reject ?
|
||||
}
|
||||
|
||||
eNB_id = (eNB_id_buf[0] << 20) + (eNB_id_buf[1] << 12) + (eNB_id_buf[2] << 4) + ((eNB_id_buf[3] & 0xf0) >> 4);
|
||||
X2AP_DEBUG("Home eNB id: %07x\n", eNB_id);
|
||||
if (ie == NULL ) {
|
||||
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
|
||||
return -1;
|
||||
} else {
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.present == X2AP_ENB_ID_PR_home_eNB_ID) {
|
||||
// Home eNB ID = 28 bits
|
||||
uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.home_eNB_ID.buf;
|
||||
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 28) {
|
||||
//TODO: handle case were size != 28 -> notify ? reject ?
|
||||
}
|
||||
|
||||
eNB_id = (eNB_id_buf[0] << 20) + (eNB_id_buf[1] << 12) + (eNB_id_buf[2] << 4) + ((eNB_id_buf[3] & 0xf0) >> 4);
|
||||
X2AP_DEBUG("Home eNB id: %07x\n", eNB_id);
|
||||
} else {
|
||||
// Macro eNB = 20 bits
|
||||
uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
|
||||
uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
|
||||
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 20) {
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 20) {
|
||||
//TODO: handle case were size != 20 -> notify ? reject ?
|
||||
}
|
||||
}
|
||||
|
||||
eNB_id = (eNB_id_buf[0] << 12) + (eNB_id_buf[1] << 4) + ((eNB_id_buf[2] & 0xf0) >> 4);
|
||||
X2AP_DEBUG("macro eNB id: %05x\n", eNB_id);
|
||||
eNB_id = (eNB_id_buf[0] << 12) + (eNB_id_buf[1] << 4) + ((eNB_id_buf[2] & 0xf0) >> 4);
|
||||
X2AP_DEBUG("macro eNB id: %05x\n", eNB_id);
|
||||
}
|
||||
}
|
||||
|
||||
X2AP_DEBUG("Adding eNB to the list of associated eNBs\n");
|
||||
@@ -418,6 +422,10 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
|
||||
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_X2SetupResponse_IEs_t, ie, x2SetupResponse,
|
||||
X2AP_ProtocolIE_ID_id_GlobalENB_ID, true);
|
||||
|
||||
if (ie == NULL ) {
|
||||
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
|
||||
return -1;
|
||||
}
|
||||
if (ie->value.choice.GlobalENB_ID.eNB_ID.present == X2AP_ENB_ID_PR_home_eNB_ID) {
|
||||
// Home eNB ID = 28 bits
|
||||
uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.home_eNB_ID.buf;
|
||||
@@ -523,7 +531,10 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance,
|
||||
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_X2SetupFailure_IEs_t, ie, x2SetupFailure,
|
||||
X2AP_ProtocolIE_ID_id_Cause, true);
|
||||
|
||||
|
||||
if (ie == NULL ) {
|
||||
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
|
||||
return -1;
|
||||
}
|
||||
// need a FSM to handle all cases
|
||||
if ((ie->value.choice.Cause.present == X2AP_Cause_PR_misc) &&
|
||||
(ie->value.choice.Cause.choice.misc == X2AP_CauseMisc_unspecified)) {
|
||||
|
||||
Reference in New Issue
Block a user