From 328448e87536c9e8e505e1c71502944c9ec27111 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Mon, 29 Oct 2018 09:04:08 +0100
Subject: [PATCH] Remove flexran_agent_send_update_stats() which is unnecessary

---
 openair2/ENB_APP/flexran_agent_common.h  |  2 -
 openair2/ENB_APP/flexran_agent_handler.c | 57 ------------------------
 openair2/LAYER2/MAC/eNB_scheduler.c      |  3 --
 3 files changed, 62 deletions(-)

diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h
index 057c5b9489a..29dd6fe61dd 100644
--- a/openair2/ENB_APP/flexran_agent_common.h
+++ b/openair2/ENB_APP/flexran_agent_common.h
@@ -162,8 +162,6 @@ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg);
 
 err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id);
 
-void flexran_agent_send_update_stats(mid_t mod_id);
-
 err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ;
 err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id);
 
diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c
index 1f13b69e922..046f608b44b 100644
--- a/openair2/ENB_APP/flexran_agent_handler.c
+++ b/openair2/ENB_APP/flexran_agent_handler.c
@@ -633,63 +633,6 @@ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) {
   return -1;
 }
 
-/*
-  Top Level Update 
- */
-
-void flexran_agent_send_update_stats(mid_t mod_id) {
-
-  Protocol__FlexranMessage *current_report = NULL;
-  void *data;
-  int size;
-  err_code_t err_code;
-  int priority = 0;
-  
-  if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
-    goto error;
-  }
-
-  if (stats_context[mod_id].cont_update == 1) {
-  
-    /*Create a fresh report with the required flags*/
-    err_code = flexran_agent_handle_stats(mod_id, (void *) stats_context[mod_id].stats_req, &current_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 (stats_context[mod_id].prev_stats_reply != NULL) { */
-
-  /*   msg = flexran_agent_generate_diff_mac_stats_report(current_report, stats_context[mod_id].prev_stats_reply); */
-
-  /*   /\*Destroy the old stats*\/ */
-  /*    flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); */
-  /* } */
-  /* /\*Use the current report for future comparissons*\/ */
-  /* stats_context[mod_id].prev_stats_reply = current_report; */
-
-
-  if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
-    goto error;
-  }
-
-  if (current_report != NULL){
-    data=flexran_agent_pack_message(current_report, &size);
-    /*Send any stats updates using the MAC channel of the eNB*/
-    if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
-      err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
-      goto error;
-    }
-
-    LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
-    return;
-  }
- error:
-  LOG_W(FLEXRAN_AGENT, "Could not send update stats message\n");
-}
-
 err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) {
   /*Disable the continuous updates for the MAC*/
   if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 5461bf66aad..04a7859b42a 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -694,9 +694,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
     schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
   }
 
-  if (RC.flexran[module_idP]->enabled)
-    flexran_agent_send_update_stats(module_idP);
-  
   // Allocate CCEs for good after scheduling is done
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     if(cc[CC_id].tdd_Config == NULL || !(is_UL_sf(&cc[CC_id],subframeP)))
-- 
GitLab