From a205dcbf44208701ae35e3ac5bad45b4530e9d5f Mon Sep 17 00:00:00 2001
From: rmagueta <rmagueta@allbesmart.pt>
Date: Mon, 31 May 2021 12:10:24 +0100
Subject: [PATCH] Fix GTP for LTE

---
 executables/nr-softmodem.c          |  4 ++--
 openair2/ENB_APP/enb_config.c       |  2 +-
 openair2/LAYER2/PDCP_v10.1.0/pdcp.c |  2 +-
 openair2/RRC/LTE/rrc_eNB.c          |  2 +-
 openair2/RRC/LTE/rrc_eNB_S1AP.c     |  2 +-
 openair2/RRC/NR/rrc_gNB_nsa.c       |  2 +-
 openair3/ocp-gtpu/gtp_itf.h         | 16 ++++++++--------
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index b803b6e79ea..b8eae43b734 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -370,7 +370,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
         }
       }
 
-      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
+      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task_var, NULL) < 0) {
         LOG_E(GTPU, "Create task for GTPV1U failed\n");
         return -1;
       }
@@ -395,7 +395,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
         }
       }
 
-      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
+      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task_var, NULL) < 0) {
         LOG_E(GTPU, "Create task for GTPV1U failed\n");
         return -1;
       }
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 4751596931c..790cca0fec4 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -2076,7 +2076,7 @@ int RCconfig_gtpu(void ) {
     GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = enb_port_for_S1U;
     strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address);
     sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", enb_port_for_S1U);
-    itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
+    itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
   } else
     LOG_E(GTPU,"invalid address for S1U\n");
 
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 51d3cfc8f3b..822be130a1b 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -1023,7 +1023,7 @@ pdcp_data_ind(
       GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset       = GTPU_HEADER_OVERHEAD_MAX;
       GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti         = ctxt_pP->rnti;
       GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id       = rb_id + 4;
-      itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
+      itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
       packet_forwarded = TRUE;
     }
   } else {
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index 789dc6ba48a..80f842f7ea1 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -4999,7 +4999,7 @@ void rrc_eNB_handover_ue_context_release(
     ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
   }
 
-  itti_send_msg_to_task(TASK_VARIABLE, ctxt_pP->module_id, msg_delete_tunnels_p);
+  itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p);
   struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL;
   rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id);
 
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 1cb575d1ddb..ce4de8190ff 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -1788,7 +1788,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms
         }
       }
 
-      itti_send_msg_to_task(TASK_VARIABLE, instance, msg_delete_tunnels_p);
+      itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p);
       //S1AP_E_RAB_RELEASE_RESPONSE
       rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
     }
diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c
index c7be5f30f3b..7ea23b8d0d4 100644
--- a/openair2/RRC/NR/rrc_gNB_nsa.c
+++ b/openair2/RRC/NR/rrc_gNB_nsa.c
@@ -292,7 +292,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
       create_tunnel_req.num_tunnels    = m->nb_e_rabs_tobeadded;
       RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p);
       PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
-      gtpv1u_create_s1u_tunnel(
+      gtpv1u_create_s1u_tunnel_var(
         ctxt.instance,
         &create_tunnel_req,
         &create_tunnel_resp);
diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h
index dd406e27cdd..b23ea5a0429 100644
--- a/openair3/ocp-gtpu/gtp_itf.h
+++ b/openair3/ocp-gtpu/gtp_itf.h
@@ -9,15 +9,15 @@ extern "C" {
 
 #include <openair3/GTPV1-U/gtpv1u_eNB_defs.h>
 #if defined(NEW_GTPU)
-#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel
-#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel
-#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel
-#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel
-#define gtpv1u_eNB_task          ocp_gtpv1uTask
-#define nr_gtpv1u_gNB_task       ocp_gtpv1uTask
-#define TASK_VARIABLE            OCP_GTPV1_U
+#define gtpv1u_create_s1u_tunnel_var  ocp_gtpv1u_create_s1u_tunnel
+#define gtpv1u_update_s1u_tunnel_var  ocp_gtpv1u_update_s1u_tunnel
+#define gtpv1u_delete_s1u_tunnel_var  ocp_gtpv1u_delete_s1u_tunnel
+#define gtpv1u_create_x2u_tunnel_var  ocp_gtpv1u_create_x2u_tunnel
+#define gtpv1u_eNB_task_var           ocp_gtpv1uTask
+#define nr_gtpv1u_gNB_task_var        ocp_gtpv1uTask
+#define TASK_VARIABLE                 OCP_GTPV1_U
 #else
-#define TASK_VARIABLE            TASK_GTPV1_U
+#define TASK_VARIABLE                 TASK_GTPV1_U
 #endif
 
 typedef boolean_t (*gtpCallback)(
-- 
GitLab