From c33e184ddeee3f80de691146e8dbd3a8b27cf210 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Tue, 13 Feb 2018 14:25:50 +0100
Subject: [PATCH] bugfix: selectively inform FlexRAN RTController of UE state
 change

---
 openair2/LAYER2/MAC/eNB_scheduler.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index fb4fd6553bc..a7c79a70d55 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -413,15 +413,16 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
       mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
       UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
       UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync   = 1;
+
+      //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
+      if (rrc_agent_registered[module_idP]) {
+        LOG_W(MAC, "notify flexran Agent of UE state change\n");
+        agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
+            rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+      }
     }
   }				// ul_failure_timer>0
 
-  //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
-  if (rrc_agent_registered[module_idP]) {
-    agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
-        rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
-  }
-
   UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
   if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
     LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti); 
-- 
GitLab