Commit 67fc2f7c authored by Robert Schmidt's avatar Robert Schmidt

FlexRAN: add GTP statistics in UE stats through RRC module

parent 75e3622d
...@@ -573,6 +573,79 @@ int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply) ...@@ -573,6 +573,79 @@ int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply)
return 0; return 0;
} }
int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id,
const report_config_t *report_config,
Protocol__FlexUeStatsReport **ue_report,
Protocol__FlexCellStatsReport **cell_report) {
/* This function fills the GTP part of the statistics. The necessary
* information is, for our purposes, completely maintained in the RRC layer.
* It would be possible to add a GTP module that handles this, though. */
if (report_config->nr_ue > 0) {
rnti_t rntis[report_config->nr_ue];
flexran_get_rrc_rnti_list(mod_id, rntis, report_config->nr_ue);
for (int i = 0; i < report_config->nr_ue; i++) {
const rnti_t rnti = rntis[i];
/* Check flag for creation of buffer status report */
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS) {
/* get number of rabs for this UE */
const int num_e_rab = flexran_agent_rrc_gtp_num_e_rab(mod_id, rnti);
Protocol__FlexGtpStats **gtp_stats = NULL;
if (num_e_rab > 0) {
gtp_stats = calloc(num_e_rab, sizeof(Protocol__FlexGtpStats *));
if (!gtp_stats) goto error;
for (int r = 0; r < num_e_rab; ++r) {
gtp_stats[r] = malloc(sizeof(Protocol__FlexGtpStats));
if (!gtp_stats[r]) goto error;
protocol__flex_gtp_stats__init(gtp_stats[r]);
gtp_stats[r]->e_rab_id = flexran_agent_rrc_gtp_get_e_rab_id(mod_id, rnti, r);
gtp_stats[r]->has_e_rab_id = 1;
gtp_stats[r]->teid_enb = flexran_agent_rrc_gtp_get_teid_enb(mod_id, rnti, r);
gtp_stats[r]->has_teid_enb = 1;
gtp_stats[r]->addr_enb = NULL;
gtp_stats[r]->teid_sgw = flexran_agent_rrc_gtp_get_teid_sgw(mod_id, rnti, r);
gtp_stats[r]->has_teid_sgw = 1;
gtp_stats[r]->addr_sgw = NULL;
}
}
ue_report[i]->n_gtp_stats = num_e_rab;
ue_report[i]->gtp_stats = gtp_stats;
ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS;
}
}
}
return 0;
error:
for (int i = 0; i < report_config->nr_ue; i++) {
if (!ue_report[i]->gtp_stats) continue;
for (int r = 0; r < ue_report[i]->n_gtp_stats; ++r) {
if (ue_report[i]->gtp_stats[r]) {
free(ue_report[i]->gtp_stats[r]);
ue_report[i]->gtp_stats[r] = NULL;
}
}
free(ue_report[i]->gtp_stats);
ue_report[i]->gtp_stats = NULL;
}
return -1;
}
int flexran_agent_rrc_gtp_destroy_stats_reply(Protocol__FlexStatsReply *reply) {
for (int i = 0; i < reply->n_ue_report; ++i) {
if (!reply->ue_report[i]->n_gtp_stats == 0) continue;
for (int r = 0; r < reply->ue_report[i]->n_gtp_stats; ++r) {
//if (reply->ue_report[i]->gtp_stats[r]->addr_enb)
// free(reply->ue_report[i]->gtp_stats[r]->addr_enb);
//if (reply->ue_report[i]->gtp_stats[r]->addr_sgw)
// free(reply->ue_report[i]->gtp_stats[r]->addr_sgw);
free(reply->ue_report[i]->gtp_stats[r]);
}
}
return 0;
}
void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti,
Protocol__FlexUeConfig *ue_conf) Protocol__FlexUeConfig *ue_conf)
{ {
......
...@@ -60,6 +60,11 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t *); ...@@ -60,6 +60,11 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t *);
int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply); int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply);
/* Statistic reply for GTP statistics which OAI stores also in the RRC layer.
* This might be moved to a separate GTP module in the future */
int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
int flexran_agent_rrc_gtp_destroy_stats_reply(Protocol__FlexStatsReply *reply);
/* Fill the RRC part of a ue_config message */ /* Fill the RRC part of a ue_config message */
void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti,
Protocol__FlexUeConfig *ue_conf); Protocol__FlexUeConfig *ue_conf);
......
...@@ -305,3 +305,15 @@ message flex_mac_sdus_dl { ...@@ -305,3 +305,15 @@ message flex_mac_sdus_dl {
optional uint32 sdu_length = 1; optional uint32 sdu_length = 1;
optional uint32 lcid = 2; optional uint32 lcid = 2;
} }
//
// GTP stats
//
message flex_gtp_stats {
optional uint32 e_rab_id = 1;
optional uint32 teid_enb = 2;
optional string addr_enb = 3;
optional uint32 teid_sgw = 4;
optional string addr_sgw = 5;
}
...@@ -50,6 +50,7 @@ message flex_ue_stats_report { ...@@ -50,6 +50,7 @@ message flex_ue_stats_report {
optional flex_rrc_measurements rrc_measurements = 10; optional flex_rrc_measurements rrc_measurements = 10;
optional flex_pdcp_stats pdcp_stats = 11; optional flex_pdcp_stats pdcp_stats = 11;
optional flex_mac_stats mac_stats = 12; optional flex_mac_stats mac_stats = 12;
repeated flex_gtp_stats gtp_stats = 13;
} }
// //
...@@ -89,6 +90,7 @@ enum flex_ue_stats_type { ...@@ -89,6 +90,7 @@ enum flex_ue_stats_type {
FLUST_MAC_STATS = 128; FLUST_MAC_STATS = 128;
FLUST_PDCP_STATS = 1024; FLUST_PDCP_STATS = 1024;
FLUST_GTP_STATS = 2048;
FLUST_RRC_MEASUREMENTS = 65536; FLUST_RRC_MEASUREMENTS = 65536;
// To be extended with more types of stats // To be extended with more types of stats
......
...@@ -511,6 +511,12 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -511,6 +511,12 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
goto error; goto error;
} }
/* GTP reply split, currently performed through RRC module */
if (flexran_agent_get_rrc_xface(enb_id)
&& flexran_agent_rrc_gtp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
stats_reply_msg->cell_report = cell_report; stats_reply_msg->cell_report = cell_report;
stats_reply_msg->ue_report = ue_report; stats_reply_msg->ue_report = ue_report;
......
...@@ -2119,6 +2119,34 @@ int flexran_get_rrc_num_adj_cells(mid_t mod_id) { ...@@ -2119,6 +2119,34 @@ int flexran_get_rrc_num_adj_cells(mid_t mod_id) {
return RC.rrc[mod_id]->num_neigh_cells; return RC.rrc[mod_id]->num_neigh_cells;
} }
int flexran_agent_rrc_gtp_num_e_rab(mid_t mod_id, rnti_t rnti) {
if (!rrc_is_present(mod_id)) return 0;
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return 0;
return ue_context_p->ue_context.setup_e_rabs;
}
int flexran_agent_rrc_gtp_get_e_rab_id(mid_t mod_id, rnti_t rnti, int index) {
if (!rrc_is_present(mod_id)) return 0;
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return 0;
return ue_context_p->ue_context.e_rab[index].param.e_rab_id;
}
int flexran_agent_rrc_gtp_get_teid_enb(mid_t mod_id, rnti_t rnti, int index) {
if (!rrc_is_present(mod_id)) return 0;
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return 0;
return ue_context_p->ue_context.enb_gtp_teid[index];
}
int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index) {
if (!rrc_is_present(mod_id)) return 0;
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return 0;
return ue_context_p->ue_context.e_rab[index].param.gtp_teid;
}
/**************************** SLICING ****************************/ /**************************** SLICING ****************************/
int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id) int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id)
{ {
......
...@@ -638,6 +638,19 @@ int flexran_set_x2_ho_net_control(mid_t mod_id, int x2_ho_net_control); ...@@ -638,6 +638,19 @@ int flexran_set_x2_ho_net_control(mid_t mod_id, int x2_ho_net_control);
/* Get number of adjacent cells via X2 interface */ /* Get number of adjacent cells via X2 interface */
int flexran_get_rrc_num_adj_cells(mid_t mod_id); int flexran_get_rrc_num_adj_cells(mid_t mod_id);
/* Get the number of E-RABs for UE */
int flexran_agent_rrc_gtp_num_e_rab(mid_t mod_id, rnti_t rnti);
/* Get the e-RAB ID for UE */
int flexran_agent_rrc_gtp_get_e_rab_id(mid_t mod_id, rnti_t rnti, int index);
/* Get the TEID at the eNB for UE */
int flexran_agent_rrc_gtp_get_teid_enb(mid_t mod_id, rnti_t rnti, int index);
/* Get the TEID at the SGW for UE */
int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index);
/************************** Slice configuration **************************/ /************************** Slice configuration **************************/
/* Get the DL slice ID for a UE */ /* Get the DL slice ID for a UE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment