From c1fd89b2a296b5c76b68bddea59529b68772c159 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Sat, 12 Apr 2014 19:49:25 +0000 Subject: [PATCH] * additional timing measurements for PDCP git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5243 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair1/PHY/TOOLS/time_meas.h | 8 ++++ openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 46 +++++++++++++++++---- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 7 ++-- openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c | 13 ++++-- targets/SIMU/USER/oaisim.c | 28 +++++++++---- 5 files changed, 78 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 6d31ec3dfb2..42a5f44d4b3 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -79,6 +79,14 @@ static inline void reset_meas(time_stats_t *ts) { ts->max=0; } } +static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) { + + if (opp_enabled){ + dst_ts->trials=src_ts->trials; + dst_ts->diff=src_ts->diff; + dst_ts->max=src_ts->max; + } +} /*static inline double get_mean_meas_us(time_stats_t *ts, double cpu_freq_GHz) { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 27637582b22..cd3dfaeb2ae 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -275,9 +275,19 @@ boolean_t pdcp_data_req( if ((pdcp_p->security_activated != 0) && ((pdcp_p->cipheringAlgorithm) != 0) && ((pdcp_p->integrityProtAlgorithm) != 0)) { - pdcp_apply_security(pdcp_p, rb_idP % maxDRB, - pdcp_header_len, current_sn, pdcp_pdu_p->data, - sdu_buffer_sizeP); + + if (enb_flagP == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[enb_mod_idP].apply_security); + else + start_meas(&UE_pdcp_stats[ue_mod_idP].apply_security); + + pdcp_apply_security(pdcp_p, rb_idP % maxDRB, + pdcp_header_len, current_sn, pdcp_pdu_p->data, + sdu_buffer_sizeP); + if (enb_flagP == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[enb_mod_idP].apply_security); + else + stop_meas(&UE_pdcp_stats[ue_mod_idP].apply_security); } #endif @@ -519,11 +529,21 @@ boolean_t pdcp_data_ind( // SRB1/2: control-plane data if (srb_flagP){ #if defined(ENABLE_SECURITY) - if (pdcp_p->security_activated == 1) { - pdcp_validate_security(pdcp_p, rb_idP, pdcp_header_len, - sequence_number, sdu_buffer_pP->data, - sdu_buffer_sizeP - pdcp_tailer_len); - } + if (pdcp_p->security_activated == 1) { + if (enb_flagP == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + else + start_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + + pdcp_validate_security(pdcp_p, rb_idP, pdcp_header_len, + sequence_number, sdu_buffer_pP->data, + sdu_buffer_sizeP - pdcp_tailer_len); + if (enb_flagP == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + else + stop_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + + } #endif //rrc_lite_data_ind(module_id, //Modified MW - L2 Interface pdcp_rrc_data_ind(enb_mod_idP, @@ -774,8 +794,18 @@ void pdcp_run ( pdcp_fifo_read_input_sdus(frameP, enb_flagP, ue_mod_idP, enb_mod_idP); } // PDCP -> NAS/IP traffic: RX + if (enb_flagP) + start_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_ip); + else + start_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_ip); + pdcp_fifo_flush_sdus(frameP, enb_flagP, enb_mod_idP, ue_mod_idP); + if (enb_flagP) + stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_ip); + else + stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_ip); + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 065521cff96..c14d24d6027 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -106,11 +106,10 @@ typedef struct pdcp_stats_t { time_stats_t pdcp_run; time_stats_t data_req; time_stats_t data_ind; - time_stats_t encrption; - time_stats_t decrption; + time_stats_t apply_security; // + time_stats_t validate_security; time_stats_t pdcp_ip; - time_stats_t ip_pdcp; - + time_stats_t ip_pdcp; // separte thread }pdcp_stats_t; // common to eNB and UE diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c index 2ef2ac96041..995d69ae0f3 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c @@ -86,6 +86,8 @@ static struct lfds611_queue_state **pdcp_netlink_queue_ue = NULL; static uint32_t *pdcp_netlink_nb_element_enb = NULL; static uint32_t *pdcp_netlink_nb_element_ue = NULL; +time_stats_t ip_pdcp_stats_tmp; + static void *pdcp_netlink_thread_fct(void *arg); int pdcp_netlink_init(void) { @@ -95,7 +97,8 @@ int pdcp_netlink_init(void) { int nb_inst_ue; pthread_attr_t attr; struct sched_param sched_param; - + + reset_meas(&ip_pdcp_stats_tmp); #if defined(USER_MODE) && defined(OAI_EMU) nb_inst_enb = oai_emulation.info.nb_enb_local; nb_inst_ue = oai_emulation.info.nb_ue_local; @@ -103,7 +106,7 @@ int pdcp_netlink_init(void) { nb_inst_enb = 1; nb_inst_ue = 1; #endif - + pdcp_netlink_queue_enb = calloc(nb_inst_enb, sizeof(struct lfds611_queue_state*)); pdcp_netlink_nb_element_enb = malloc(nb_inst_enb * sizeof(uint32_t)); @@ -206,7 +209,7 @@ void *pdcp_netlink_thread_fct(void *arg) { for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf; NLMSG_OK(nas_nlh_rx, (unsigned int)len); nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) { - + start_meas(&ip_pdcp_stats_tmp); /* There is no need to check for nlmsg_type because * the header is not set in our drivers. */ @@ -259,6 +262,8 @@ void *pdcp_netlink_thread_fct(void *arg) { /* Enqueue the element in the right queue */ lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_enb[new_data_p->pdcp_read_header.inst], new_data_p); + stop_meas(&ip_pdcp_stats_tmp); + copy_meas(&eNB_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); } else { if (pdcp_netlink_nb_element_ue[new_data_p->pdcp_read_header.inst] > PDCP_QUEUE_NB_ELEMENTS) { @@ -270,6 +275,8 @@ void *pdcp_netlink_thread_fct(void *arg) { /* Enqueue the element in the right queue */ lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_ue[new_data_p->pdcp_read_header.inst], new_data_p); + stop_meas(&ip_pdcp_stats_tmp); + copy_meas(&UE_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); } } } diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 140d3294c80..ba146a1c4cb 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -1172,11 +1172,11 @@ void reset_opp_meas(void){ reset_meas(&UE_pdcp_stats[UE_id].pdcp_run); reset_meas(&UE_pdcp_stats[UE_id].data_req); reset_meas(&UE_pdcp_stats[UE_id].data_ind); - /* reset_meas(&UE_pdcp_stats[UE_id].encrption); - reset_meas(&UE_pdcp_stats[UE_id].decrption); + reset_meas(&UE_pdcp_stats[UE_id].apply_security); + reset_meas(&UE_pdcp_stats[UE_id].validate_security); reset_meas(&UE_pdcp_stats[UE_id].pdcp_ip); reset_meas(&UE_pdcp_stats[UE_id].ip_pdcp); - */ + for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) { reset_meas(&PHY_vars_eNB_g[eNB_id]->phy_proc); reset_meas(&PHY_vars_eNB_g[eNB_id]->phy_proc_rx); @@ -1235,12 +1235,11 @@ void reset_opp_meas(void){ reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_run); reset_meas(&eNB_pdcp_stats[eNB_id].data_req); reset_meas(&eNB_pdcp_stats[eNB_id].data_ind); - /* - reset_meas(&eNB_pdcp_stats[UE_id].encrption); - reset_meas(&eNB_pdcp_stats[UE_id].decrption); - reset_meas(&eNB_pdcp_stats[UE_id].pdcp_ip); - reset_meas(&eNB_pdcp_stats[UE_id].ip_pdcp); - */ + reset_meas(&eNB_pdcp_stats[eNB_id].apply_security); + reset_meas(&eNB_pdcp_stats[eNB_id].validate_security); + reset_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip); + reset_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp); + } } } @@ -1351,6 +1350,11 @@ void print_opp_meas(void){ print_meas(&UE_pdcp_stats[UE_id].data_req,"[UE][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f); print_meas(&UE_pdcp_stats[UE_id].data_ind,"[UE][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f); + print_meas(&UE_pdcp_stats[UE_id].apply_security,"[UE][DL][apply_security]",&oaisim_stats,&oaisim_stats_f); + print_meas(&UE_pdcp_stats[UE_id].validate_security,"[UE][UL][validate_security]",&oaisim_stats,&oaisim_stats_f); + print_meas(&UE_pdcp_stats[UE_id].ip_pdcp,"[UE][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f); + print_meas(&UE_pdcp_stats[UE_id].pdcp_ip,"[UE][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f); + } for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) { @@ -1368,6 +1372,12 @@ void print_opp_meas(void){ print_meas(&eNB_pdcp_stats[eNB_id].pdcp_run,"[eNB][pdcp_run]",&oaisim_stats,&oaisim_stats_f); print_meas(&eNB_pdcp_stats[eNB_id].data_req,"[eNB][DL][pdcp_data_req]",&oaisim_stats,&oaisim_stats_f); print_meas(&eNB_pdcp_stats[eNB_id].data_ind,"[eNB][UL][pdcp_data_ind]",&oaisim_stats,&oaisim_stats_f); + + print_meas(&eNB_pdcp_stats[eNB_id].apply_security,"[eNB][DL][apply_security]",&oaisim_stats,&oaisim_stats_f); + print_meas(&eNB_pdcp_stats[eNB_id].validate_security,"[eNB][UL][validate_security]",&oaisim_stats,&oaisim_stats_f); + print_meas(&eNB_pdcp_stats[eNB_id].ip_pdcp,"[eNB][DL][ip_pdcp]",&oaisim_stats,&oaisim_stats_f); + print_meas(&eNB_pdcp_stats[eNB_id].pdcp_ip,"[eNB][UL][pdcp_ip]",&oaisim_stats,&oaisim_stats_f); + } } -- GitLab