From fffb682f7a92c91ecbb6de8071528dfccfbfbc42 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas <x.foukas@sms.ed.ac.uk> Date: Wed, 24 Feb 2016 14:38:44 +0000 Subject: [PATCH] Added continuous update support --- openair2/ENB_APP/enb_agent_mac.c | 52 ++++++++++++++++++----------- openair2/LAYER2/MAC/eNB_scheduler.c | 1 + 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 5c279958fe..0c68c4b80c 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -168,6 +168,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; request_config.period = 0; + /* Need to make sure that the ue flags are saved (Bug) */ + if (report_config.nr_ue == 0) { + report_config.nr_ue = 1; + report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t)); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + report_config.ue_report_type[0].ue_rnti = 0; // Dummy value + report_config.ue_report_type[0].ue_report_flags = ue_flags; + } request_config.config = &report_config; enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } @@ -1204,44 +1216,46 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { void enb_agent_send_update_mac_stats(mid_t mod_id) { - Protocol__ProgranMessage *current_report, *msg; + Protocol__ProgranMessage *current_report = NULL, *msg; void *data; int size; err_code_t err_code; int priority; mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; - + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; } - /*Create a fresh report with the required flags*/ - err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); - if (err_code < 0) { - goto error; + if (mac_stats_context[mod_id].cont_update == 1) { + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + if (err_code < 0) { + goto error; + } } + /* /\*TODO:Check if a previous reports exists and if yes, generate a report */ + /* *that is the diff between the old and the new report, */ + /* *respecting the thresholds. Otherwise send the new report*\/ */ + /* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */ - /*TODO:Check if a previous reports exists and if yes, generate a report - *that is the diff between the old and the new report, - *respecting the thresholds. Otherwise send the new report*/ - if (mac_stats_context[mod_id].prev_stats_reply != NULL) { - - msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); + /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ - /*Destroy the old stats*/ - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); - } - /*Use the current report for future comparissons*/ - mac_stats_context[mod_id].prev_stats_reply = current_report; + /* /\*Destroy the old stats*\/ */ + /* enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* } */ + /* /\*Use the current report for future comparissons*\/ */ + /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } - if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + if (current_report != NULL){ + data=enb_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 774feda961..e2423e2c10 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -219,6 +219,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); + agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); } #endif -- 2.26.2