From 6fb9f92b84f71ae53383fedc32d2bfca9b9da9c8 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 17 Jun 2021 16:40:34 +0200 Subject: [PATCH] replace itti message GTPV1U_DELETE_TUNNEL_REQ by direct call to gtpv1u_delete_s1u_tunnel() --- openair2/RRC/NR/rrc_gNB.c | 6 +----- openair2/RRC/NR/rrc_gNB_nsa.c | 20 ++++++-------------- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 10 ++++------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d58de911db..4a1187c0b4 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2946,11 +2946,7 @@ void *rrc_gnb_task(void *args_p) { ///Nothing to do. Apparently everything is done in S1AP processing //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", //instance, msg_name_p); - if (rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) - && rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { - rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = - rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; - } + AssertFatal(false, "Removed double mechanism for same feature: now delete_tunnel() function should be called\n"); break; #endif diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 3313e9339b..f8cc951bc3 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -402,7 +402,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { protocol_ctxt_t ctxt; rrc_gNB_ue_context_t *ue_context; - MessageDef *msg_delete_tunnels_p; int e_rab; LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti); @@ -419,25 +418,18 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { rrc_rlc_remove_ue(&ctxt); mac_remove_nr_ue(rrc->module_id, rnti); - - /* delete gtp tunnel */ - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = rnti; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 1; - - LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d\n", ue_context->ue_context.nb_of_e_rabs); + gtpv1u_enb_delete_tunnel_req_t tmp={0}; + tmp.rnti=rnti; + tmp.from_gnb=1; + LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %d\n", ue_context->ue_context.nb_of_e_rabs, rnti); for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) { - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = - ue_context->ue_context.gnb_gtp_ebi[e_rab]; + tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.gnb_gtp_ebi[e_rab]; // erase data ue_context->ue_context.gnb_gtp_teid[e_rab] = 0; memset(&ue_context->ue_context.gnb_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.gnb_gtp_addrs[e_rab])); ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0; } - - itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p); - + gtpv1u_delete_s1u_tunnel(rrc->module_id, &tmp); /* remove context */ rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context); } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index fd4a830a02..81e2cbbb37 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -272,7 +272,7 @@ static int sync_to_gps(openair0_device *device) { */ static int trx_usrp_start(openair0_device *device) { usrp_state_t *s = (usrp_state_t *)device->priv; - +#if 0 // setup GPIO for TDD, GPIO(4) = ATR_RX //set data direction register (DDR) to output s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff); @@ -286,6 +286,7 @@ static int trx_usrp_start(openair0_device *device) { // set the output pins to 1 s->usrp->set_gpio_attr("FP0", "OUT", 7<<7, 0xf80); +#endif s->wait_for_first_pps = 1; s->rx_count = 0; s->tx_count = 0; @@ -953,14 +954,9 @@ extern "C" { LOG_I(HW, "openair0_cfg[0].clock_source == '%d' (internal = %d, external = %d)\n", openair0_cfg[0].clock_source,internal,external); usrp_state_t *s ; - if ( device->priv == NULL) { s=(usrp_state_t *)calloc(sizeof(usrp_state_t),1); device->priv=s; AssertFatal( s!=NULL,"USRP device: memory allocation failure\n"); - } else { - LOG_E(HW, "multiple device init detected\n"); - return 0; - } device->openair0_cfg = openair0_cfg; device->trx_start_func = trx_usrp_start; @@ -1000,10 +996,12 @@ extern "C" { if (device_adds.size() == 0) { LOG_E(HW,"No USRP Device Found.\n "); free(s); +abort(); return -1; } else if (device_adds.size() > 1) { LOG_E(HW,"More than one USRP Device Found. Please specify device more precisely in config file.\n"); free(s); +abort(); return -1; }