diff --git a/common/ran_context.h b/common/ran_context.h index 7a035f59bbb47563bc6f6b646361a845b6468d7e..1201753d1d477aa36f3fffea0c08fb8eb67c4116 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -43,7 +43,7 @@ #include "RRC/LTE/defs_NB_IoT.h" #include "RRC/LTE/rrc_defs.h" #include "RRC/NR/nr_rrc_defs.h" -#include <openair3/ocp-gtpu/gtpv1u_eNB_task.h> +#include <openair3/ocp-gtpu/gtp_itf.h> typedef struct { diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 9da3f03c230dc303a124a6ab59fc08582addb2ff..0a7bbc3b7891db8e2016199ef6cffb791920dc94 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -256,8 +256,6 @@ typedef struct IttiMsgText_s { #include <openair3/MME_APP/mme_app.h> //#include <proto.h> -#include <openair3/ocp-gtpu/gtpv1u_eNB_task.h> -#include <openair3/ocp-gtpu/gtpv1u_gNB_task.h> void *rrc_enb_process_itti_msg(void *); #include <openair3/SCTP/sctp_eNB_task.h> #include <openair3/NGAP/ngap_gNB.h> diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 01d3c377d4382b510207199e60b9c5c6c9ca9d42..ac66e5e8dab5b42514e2c14d20d4ed41dbea988f 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -338,7 +338,7 @@ Also, incoming downlink sdu can comme from internal RRC: in this case, pdcp_run( At Rx side, pdcp_data_ind() is the entry point that receives the data from RLC. - Inside pdcp_data_ind(), the pdcp manager mutex protects the access to the PDU receiving function of PDCP (recv_pdu() callback corresponding to nr_pdcp_entity_drb_am_recv_pdu() for DRBs) -- Then deliver_sdu_drb() function sends the received data to GTP thread through an ITTI message (GTPV1U_ENB_TUNNEL_DATA_REQ). +- Then deliver_sdu_drb() function sends the received data to GTP thread through an ITTI message (GTPV1U_TUNNEL_DATA_REQ). pdcp_config_set_security(): not yet developped diff --git a/executables/create_tasks.c b/executables/create_tasks.c index 16c735d9f3bfb462ad807cb8d36e3fcac3f0b788..0081eca66da4187f28aca62a3a2c460a29a2b309 100644 --- a/executables/create_tasks.c +++ b/executables/create_tasks.c @@ -28,7 +28,7 @@ #include "sctp_eNB_task.h" #include "x2ap_eNB.h" #include "s1ap_eNB.h" - #include "gtpv1u_eNB_task.h" + #include "openair3/ocp-gtpu/gtp_itf.h" #if ENABLE_RAL #include "lteRALue.h" #include "lteRALenb.h" diff --git a/executables/create_tasks_mbms.c b/executables/create_tasks_mbms.c index b82b4f158b18a4b1cf499a30018b91e203c2d68d..9853c1b6ec8069b98ed61cb2d24737778a41be04 100644 --- a/executables/create_tasks_mbms.c +++ b/executables/create_tasks_mbms.c @@ -28,7 +28,7 @@ #include "sctp_eNB_task.h" #include "x2ap_eNB.h" #include "s1ap_eNB.h" - #include "gtpv1u_eNB_task.h" + #include "openair3/ocp-gtpu/gtp_itf.h" #include "m2ap_eNB.h" #include "m2ap_MCE.h" #include "m3ap_MME.h" diff --git a/executables/create_tasks_ue.c b/executables/create_tasks_ue.c index cdca62c39900a2eb63f13f3d3a9b1649f841c17a..2172827b03bca0a580abf975c3eade0e5cca8d19 100644 --- a/executables/create_tasks_ue.c +++ b/executables/create_tasks_ue.c @@ -27,7 +27,6 @@ #include "sctp_eNB_task.h" #include "s1ap_eNB.h" #include "openair3/NAS/UE/nas_ue_task.h" - #include "gtpv1u_eNB_task.h" #if ENABLE_RAL #include "lteRALue.h" #include "lteRALenb.h" diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b9deeadfd88c77c91846d5b57cbe7b056882209c..824d699c600525129a79ad1fdac07f5dcef2a306 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -102,7 +102,7 @@ nfapi_ue_release_request_body_t release_rntis; instance_t DUuniqInstance=0; instance_t CUuniqInstance=0; teid_t newGtpuCreateTunnel(instance_t instance, - rnti_t rnti, + ue_id_t ue_id, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -114,7 +114,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, return 0; } -int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { +int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) { return 0; } @@ -189,7 +189,7 @@ int gtpv1u_update_ngu_tunnel( const instance_t instanceP, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti + const ue_id_t prior_ue_id ){ return 0; } diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 6df4896bc5cb947e7368ab58cda8145f6f24b6aa..88c46b057a68c3cb2da3404f646d3ee13e4c55fe 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -94,7 +94,7 @@ int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); instance_t DUuniqInstance=0; instance_t CUuniqInstance=0; teid_t newGtpuCreateTunnel(instance_t instance, - rnti_t rnti, + ue_id_t ue_id, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -106,7 +106,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, return 0; } -int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { +int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) { return 0; } @@ -150,7 +150,7 @@ int gtpv1u_update_ngu_tunnel( const instance_t instanceP, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti + const ue_id_t prior_ue_id ){ return 0; } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 5a99f2c4ceb8387873d4569c12b0bc03f1fd1ddb..2a46b40b716927b6f6cbc41c0f6091ce531c0dcb 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -98,7 +98,7 @@ nfapi_ue_release_request_body_t release_rntis; instance_t DUuniqInstance=0; instance_t CUuniqInstance=0; teid_t newGtpuCreateTunnel(instance_t instance, - rnti_t rnti, + ue_id_t ue_id, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -110,7 +110,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, return 0; } -int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { +int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) { return 0; } @@ -189,7 +189,7 @@ int gtpv1u_update_ngu_tunnel( const instance_t instanceP, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti + const ue_id_t prior_ue_id ){ return 0; } diff --git a/openair2/COMMON/gtpv1_u_messages_def.h b/openair2/COMMON/gtpv1_u_messages_def.h index e0e5db5b7f72bd0adf45c9175b1fe9f376c4664d..35af0c04e78fb39c0e2b24487cbf14904b3e2593 100644 --- a/openair2/COMMON/gtpv1_u_messages_def.h +++ b/openair2/COMMON/gtpv1_u_messages_def.h @@ -20,12 +20,10 @@ */ -MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_req_t, Gtpv1uTunnelDataReq) +MESSAGE_DEF(GTPV1U_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_tunnel_data_req_t, Gtpv1uTunnelDataReq) MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_req_t,Gtpv1uDataForwardingReq) MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_ind_t,Gtpv1uDataForwardingInd) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd) MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq) - -MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq) MESSAGE_DEF(GTPV1U_DU_BUFFER_REPORT_REQ, MESSAGE_PRIORITY_MED, gtpv1u_DU_buffer_report_req_t, NRGtpv1uBufferReportReq) diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 7758395ee43fd2274cfbefdf998348c518c4e9f8..26e509b2e71d5eafe13bd784ccbc349f32dc8d90 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -29,7 +29,7 @@ #define NR_GTPV1U_MAX_BEARERS_PER_UE max_val_NR_DRB_Identity #define GTPV1U_ENB_TUNNEL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataInd -#define GTPV1U_ENB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataReq +#define GTPV1U_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataReq #define GTPV1U_ENB_DATA_FORWARDING_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingReq #define GTPV1U_ENB_DATA_FORWARDING_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingInd #define GTPV1U_ENB_END_MARKER_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uEndMarkerReq @@ -37,8 +37,6 @@ #define GTPV1U_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uReq -#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq - #define GTPV1U_DU_BUFFER_REPORT_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uBufferReportReq #define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF @@ -108,21 +106,14 @@ typedef struct gtpv1u_enb_delete_tunnel_resp_s { teid_t enb_S1u_teid; ///< local S1U Tunnel Endpoint Identifier to be deleted } gtpv1u_enb_delete_tunnel_resp_t; -typedef struct gtpv1u_enb_tunnel_data_ind_s { - rnti_t rnti; - uint8_t *buffer; - uint32_t length; - uint32_t offset; ///< start of message offset in buffer - teid_t enb_S1u_teid; ///< Tunnel Endpoint Identifier -} gtpv1u_enb_tunnel_data_ind_t; -typedef struct gtpv1u_enb_tunnel_data_req_s { +typedef struct gtpv1u_tunnel_data_req_s { uint8_t *buffer; uint32_t length; uint32_t offset; ///< start of message offset in buffer - rnti_t rnti; - rb_id_t rab_id; -} gtpv1u_enb_tunnel_data_req_t; + ue_id_t ue_id; + rb_id_t bearer_id; +} gtpv1u_tunnel_data_req_t; typedef struct gtpv1u_enb_data_forwarding_req_s { uint8_t *buffer; @@ -133,39 +124,39 @@ typedef struct gtpv1u_enb_data_forwarding_req_s { } gtpv1u_enb_data_forwarding_req_t; typedef struct gtpv1u_enb_data_forwarding_ind_s { - uint32_t frame; - uint8_t enb_flag; - rb_id_t rb_id; - uint32_t muip; - uint32_t confirmp; - uint32_t sdu_size; - uint8_t *sdu_p; - uint8_t mode; - uint16_t rnti; - uint8_t module_id; - uint8_t eNB_index; + uint32_t frame; + uint8_t enb_flag; + rb_id_t rb_id; + uint32_t muip; + uint32_t confirmp; + uint32_t sdu_size; + uint8_t *sdu_p; + uint8_t mode; + uint16_t rnti; + uint8_t module_id; + uint8_t eNB_index; } gtpv1u_enb_data_forwarding_ind_t; typedef struct gtpv1u_enb_end_marker_req_s { - uint8_t *buffer; - uint32_t length; - uint32_t offset; ///< start of message offset in buffer - rnti_t rnti; - rb_id_t rab_id; + uint8_t *buffer; + uint32_t length; + uint32_t offset; ///< start of message offset in buffer + rnti_t rnti; + rb_id_t rab_id; } gtpv1u_enb_end_marker_req_t; typedef struct gtpv1u_enb_end_marker_ind_s { - uint32_t frame; - uint8_t enb_flag; - rb_id_t rb_id; - uint32_t muip; - uint32_t confirmp; - uint32_t sdu_size; - uint8_t *sdu_p; - uint8_t mode; - uint16_t rnti; - uint8_t module_id; - uint8_t eNB_index; + uint32_t frame; + uint8_t enb_flag; + rb_id_t rb_id; + uint32_t muip; + uint32_t confirmp; + uint32_t sdu_size; + uint8_t *sdu_p; + uint8_t mode; + uint16_t rnti; + uint8_t module_id; + uint8_t eNB_index; } gtpv1u_enb_end_marker_ind_t; typedef struct { @@ -177,7 +168,7 @@ typedef struct { typedef struct gtpv1u_gnb_create_tunnel_req_s { - rnti_t rnti; + ue_id_t ue_id; int num_tunnels; //teid_t upf_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier teid_t outgoing_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; @@ -191,34 +182,29 @@ typedef struct gtpv1u_gnb_create_tunnel_req_s { typedef struct gtpv1u_gnb_create_tunnel_resp_s { uint8_t status; ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0) - rnti_t rnti; + ue_id_t ue_id; int num_tunnels; teid_t gnb_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; + int bearer_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; transport_layer_addr_t gnb_addr; } gtpv1u_gnb_create_tunnel_resp_t; typedef struct gtpv1u_gnb_delete_tunnel_req_s { - rnti_t rnti; + ue_id_t ue_id; uint8_t num_pdusession; pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; } gtpv1u_gnb_delete_tunnel_req_t; typedef struct gtpv1u_gnb_delete_tunnel_resp_s { - rnti_t rnti; + ue_id_t ue_id; uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0) teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted } gtpv1u_gnb_delete_tunnel_resp_t; -typedef struct gtpv1u_gnb_tunnel_data_req_s { - uint8_t *buffer; - uint32_t length; - uint32_t offset; ///< start of message offset in buffer - rnti_t rnti; - pdusessionid_t pdusession_id; -} gtpv1u_gnb_tunnel_data_req_t; + typedef struct gtpv1u_DU_buffer_report_req_s { uint32_t buffer_availability; - rnti_t rnti; + ue_id_t ue_id; pdusessionid_t pdusession_id; } gtpv1u_DU_buffer_report_req_t; diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index f2297219936779186ef88ea245bc0016e6871221..336ea143eabdaf7490807aa4b19fbd2d7874f696 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -49,7 +49,7 @@ typedef uint32_t slot_t; typedef uint16_t module_id_t; typedef uint8_t slice_id_t; typedef uint8_t eNB_index_t; -typedef uint16_t ue_id_t; +typedef uint64_t ue_id_t; typedef int16_t smodule_id_t; typedef long rb_id_t; typedef long srb_id_t; diff --git a/openair2/F1AP/dummy_enb.c b/openair2/F1AP/dummy_enb.c index 22627c8d926fecbceafe866a7a4bab61d9a291ac..08a5b906eedce8060e5413a0db9dd4f8c0e1c219 100644 --- a/openair2/F1AP/dummy_enb.c +++ b/openair2/F1AP/dummy_enb.c @@ -33,6 +33,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, } bool sdap_data_req(protocol_ctxt_t *ctxt_p, + const ue_id_t ue_id, const srb_flag_t srb_flag, const rb_id_t rb_id, const mui_t mui, diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 9263525b318a527ceff50ede286429e4940dc807..862cf9dddc702e3f4c78a1103faa8c7d68966c32 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -45,7 +45,7 @@ #include "intertask_interface.h" #include "ngap_gNB.h" #include "sctp_eNB_task.h" -#include "gtpv1u_eNB_task.h" +#include "openair3/ocp-gtpu/gtp_itf.h" #include "PHY/INIT/phy_init.h" #include "f1ap_cu_task.h" #include "f1ap_du_task.h" diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d9cf4eac3ddf761ccd6371e066039b6b73a5975f..a644301bba9217d77e8993c5575d94b2b2c1c27a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -58,7 +58,7 @@ #include "openair3/S1AP/s1ap_eNB.h" #include <pthread.h> -# include "gtpv1u_eNB_task.h" +# include "openair3/ocp-gtpu/gtp_itf.h" #include <openair3/ocp-gtpu/gtp_itf.h> #include "ENB_APP/enb_config.h" @@ -209,20 +209,19 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt, const rb_id_t rb_id, const mui_t mui, confirm_t confirm, sdu_size_t size, mem_block_t *sdu, const uint32_t *const sourceID, const uint32_t *const destID) { - uint8_t *gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, - size + GTPU_HEADER_OVERHEAD_MAX); - AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); - memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, + MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, GTPV1U_TUNNEL_DATA_REQ, + sizeof(gtpv1u_tunnel_data_req_t) + + size + GTPU_HEADER_OVERHEAD_MAX ); + AssertFatal(message_p != NULL, "OUT OF MEMORY"); + gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(message_p); + req->buffer = (uint8_t*)(req+1); + memcpy(req->buffer + GTPU_HEADER_OVERHEAD_MAX, sdu->data, size ); - MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); - AssertFatal(message_p != NULL, "OUT OF MEMORY"); - gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(message_p); - req->buffer = gtpu_buffer_p; req->length = size; req->offset = GTPU_HEADER_OVERHEAD_MAX; - req->rnti = ctxt->rnti; - req->rab_id = rb_id+4; + req->ue_id = ctxt->rnti; + req->bearer_id = rb_id+4; LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; @@ -649,7 +648,6 @@ pdcp_data_ind( uint16_t pdcp_uid=0; MessageDef *message_p = NULL; - uint8_t *gtpu_buffer_p = NULL; uint32_t rx_hfn_for_count; int pdcp_sn_for_count; int security_ok; @@ -1056,22 +1054,23 @@ pdcp_data_ind( if (LINK_ENB_PDCP_TO_GTPV1U) { if ((true == ctxt_pP->enb_flag) && (false == srb_flagP)) { - LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %ld len %u\n", + LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_TUNNEL_DATA_REQ ue %x rab %ld len %u\n", ctxt_pP->rnti, rb_id + 4, sdu_buffer_sizeP - payload_offset ); - //LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset); - gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, - sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX); - AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); - memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset); - message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, GTPV1U_TUNNEL_DATA_REQ, + sizeof(gtpv1u_tunnel_data_req_t) + + sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX ); AssertFatal(message_p != NULL, "OUT OF MEMORY"); - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = sdu_buffer_sizeP - payload_offset; - 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; + gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(message_p); + req->buffer = (uint8_t*)(req+1); + memcpy(req->buffer + GTPU_HEADER_OVERHEAD_MAX, + &sdu_buffer_pP->data[payload_offset], + sdu_buffer_sizeP - payload_offset); + req->length = sdu_buffer_sizeP - payload_offset; + req->offset = GTPU_HEADER_OVERHEAD_MAX; + req->ue_id = ctxt_pP->rnti; + req->bearer_id = rb_id + 4; itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); packet_forwarded = true; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index f6a61330d068c5366a55478f9dbe0fb0d51a4d1e..3b791fe54f2cb494fd11e6d3a0df916d14fa4565 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -83,7 +83,7 @@ extern struct msghdr nas_msg_rx; -# include "gtpv1u_eNB_task.h" +# include "openair3/ocp-gtpu/gtp_itf.h" extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP); uint16_t ue_id_g; // Global variable to identify the ID for each UE. It is updated in main() of lte-uesoftmodem.c diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d0be2223db9a74c07b32321c3ffcb466c1a70706..cddacf1be8611bb7d4747ded5522e1e6528b14f7 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -406,8 +406,9 @@ static void *enb_tun_read_thread(void *_) extern int nas_sock_fd[]; char rx_buf[NL_MAX_PAYLOAD]; int len; - int rnti; protocol_ctxt_t ctxt; + ue_id_t ue_id; + int has_ue; int rb_id = 1; pthread_setname_np( pthread_self(),"enb_tun_read"); @@ -422,10 +423,10 @@ static void *enb_tun_read_thread(void *_) LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager); + has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &ue_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); - if (rnti == -1) continue; + if (!has_ue) continue; ctxt.module_id = 0; ctxt.enb_flag = 1; @@ -434,14 +435,13 @@ static void *enb_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - - ctxt.rnti = rnti; + ctxt.rnti = (rnti_t) ue_id; uint8_t qfi = 7; bool rqi = 0; int pdusession_id = 10; - sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, + sdap_data_req(&ctxt, ue_id, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, qfi, rqi, pdusession_id); } @@ -454,8 +454,9 @@ static void *ue_tun_read_thread(void *_) extern int nas_sock_fd[]; char rx_buf[NL_MAX_PAYLOAD]; int len; - int rnti; protocol_ctxt_t ctxt; + ue_id_t ue_id; + int has_ue; int rb_id = 1; pthread_setname_np( pthread_self(),"ue_tun_read"); @@ -469,10 +470,10 @@ static void *ue_tun_read_thread(void *_) LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager); + has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &ue_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); - if (rnti == -1) continue; + if (!has_ue) continue; ctxt.module_id = 0; ctxt.enb_flag = 0; @@ -481,14 +482,13 @@ static void *ue_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - - ctxt.rnti = rnti; + ctxt.rnti = ue_id; bool dc = SDAP_HDR_UL_DATA_PDU; extern uint8_t nas_qfi; extern uint8_t nas_pduid; - sdap_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, + sdap_data_req(&ctxt, ue_id, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, nas_qfi, dc, nas_pduid); } @@ -621,13 +621,13 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int i; if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) { - LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE rnti: %d\n", size, ue->rnti); + LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE rnti: %d\n", size, (int)ue->ue_id); sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap, entity->has_sdapULheader, entity->pdusession_id, - ue->rnti, + ue->ue_id, buf, size); } @@ -640,7 +640,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, } LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n", - __FILE__, __LINE__, __FUNCTION__, ue->rnti); + __FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id); exit(1); rb_found: @@ -651,7 +651,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ue->drb[rb_id-1]->has_sdap, ue->drb[rb_id-1]->has_sdapULheader, ue->drb[rb_id-1]->pdusession_id, - ue->rnti, + ue->ue_id, buf, size); } @@ -675,7 +675,7 @@ static void deliver_pdu_drb(void *_ue, nr_pdcp_entity_t *entity, } LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for ue %d\n", - __FILE__, __LINE__, __FUNCTION__, ue->rnti); + __FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id); exit(1); rb_found: @@ -687,23 +687,23 @@ rb_found: ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rnti = ue->rnti; + ctxt.rnti = ue->ue_id; if (RC.nrrrc != NULL && NODE_IS_CU(RC.nrrrc[0]->node_type)) { MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, - GTPV1U_GNB_TUNNEL_DATA_REQ, - sizeof(gtpv1u_gnb_tunnel_data_req_t) + GTPV1U_TUNNEL_DATA_REQ, + sizeof(gtpv1u_tunnel_data_req_t) + size + GTPU_HEADER_OVERHEAD_MAX); AssertFatal(message_p != NULL, "OUT OF MEMORY"); - gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p); + gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(message_p); uint8_t *gtpu_buffer_p = (uint8_t*)(req+1); memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, buf, size); req->buffer = gtpu_buffer_p; req->length = size; req->offset = GTPU_HEADER_OVERHEAD_MAX; - req->rnti = ue->rnti; - req->pdusession_id = rb_id; + req->ue_id = ue->ue_id; + req->bearer_id = rb_id; LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; @@ -734,7 +734,7 @@ static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, } LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n", - __FILE__, __LINE__, __FUNCTION__, ue->rnti); + __FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id); exit(1); srb_found: @@ -742,7 +742,7 @@ srb_found: MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_GNB, 0, F1AP_UL_RRC_MESSAGE); AssertFatal(message_p != NULL, "OUT OF MEMORY\n"); f1ap_ul_rrc_message_t *ul_rrc = &F1AP_UL_RRC_MESSAGE(message_p); - ul_rrc->rnti = ue->rnti; + ul_rrc->rnti = ue->ue_id; ul_rrc->srb_id = srb_id; ul_rrc->rrc_container = malloc(size); AssertFatal(ul_rrc->rrc_container != NULL, "OUT OF MEMORY\n"); @@ -758,7 +758,7 @@ srb_found: NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id; NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p; NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size; - NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rnti; + NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->ue_id; itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); } } @@ -780,7 +780,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity, } LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for ue %d\n", - __FILE__, __LINE__, __FUNCTION__, ue->rnti); + __FILE__, __LINE__, __FUNCTION__, (int)ue->ue_id); exit(1); srb_found: @@ -798,7 +798,7 @@ srb_found: ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rnti = ue->rnti; + ctxt.rnti = ue->ue_id; memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); @@ -813,7 +813,7 @@ srb_found: F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown - F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->rnti; + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue->ue_id; F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c index 1f21593c630387bcfbe2620acca8a4e5132d8fad..11b826399b53a383e7f6b32e666cd0d4d3c3818c 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c @@ -24,6 +24,7 @@ #include <pthread.h> #include <stdlib.h> #include <string.h> +#include <inttypes.h> #include "LOG/log.h" @@ -75,17 +76,17 @@ void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *_m) } /* must be called with lock acquired */ -nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti) +nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t ue_id) { /* TODO: optimze */ nr_pdcp_ue_manager_internal_t *m = _m; int i; for (i = 0; i < m->ue_count; i++) - if (m->ue_list[i]->rnti == rnti) + if (m->ue_list[i]->ue_id == ue_id) return m->ue_list[i]; - LOG_D(PDCP, "%s:%d:%s: new UE 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti); + LOG_D(PDCP, "%s:%d:%s: new UE 0x%"PRIx64"\n", __FILE__, __LINE__, __FUNCTION__, ue_id); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count); @@ -99,13 +100,13 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, int rnti) exit(1); } - m->ue_list[m->ue_count-1]->rnti = rnti; + m->ue_list[m->ue_count-1]->ue_id = ue_id; return m->ue_list[m->ue_count-1]; } /* must be called with lock acquired */ -void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, int rnti) +void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t ue_id) { nr_pdcp_ue_manager_internal_t *m = _m; nr_pdcp_ue_t *ue; @@ -113,13 +114,13 @@ void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, int rnti) int j; for (i = 0; i < m->ue_count; i++) - if (m->ue_list[i]->rnti == rnti) + if (m->ue_list[i]->ue_id == ue_id) break; if (i == m->ue_count) { - LOG_D(PDCP, "%s:%d:%s: warning: ue %d not found\n", + LOG_D(PDCP, "%s:%d:%s: warning: ue 0x%"PRIx64" not found\n", __FILE__, __LINE__, __FUNCTION__, - rnti); + ue_id); return; } @@ -203,10 +204,11 @@ int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m) return m->ue_count; } -int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *_m) +int nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager_t *_m, ue_id_t *ret) { nr_pdcp_ue_manager_internal_t *m = _m; if (m->ue_count == 0) - return -1; - return m->ue_list[0]->rnti; + return 0; + *ret = m->ue_list[0]->ue_id; + return 1; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index a3a6e076d708e3712d3ea96c287ed5aafd98d03f..6b46776a9670e7f2930b40a3485a26694f6e65d8 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -24,10 +24,12 @@ #include "nr_pdcp_entity.h" +#include "platform_types.h" + typedef void nr_pdcp_ue_manager_t; typedef struct nr_pdcp_ue_t { - int rnti; + ue_id_t ue_id; nr_pdcp_entity_t *srb[3]; nr_pdcp_entity_t *drb[MAX_DRBS_PER_UE]; } nr_pdcp_ue_t; @@ -43,8 +45,8 @@ int nr_pdcp_manager_get_enb_flag(nr_pdcp_ue_manager_t *m); void nr_pdcp_manager_lock(nr_pdcp_ue_manager_t *m); void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *m); -nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, int rnti); -void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, int rnti); +nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t ue_id); +void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t ue_id); nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m); int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m); @@ -62,7 +64,7 @@ void nr_pdcp_ue_add_drb_pdcp_entity(nr_pdcp_ue_t *ue, int drb_id, /* hacks */ /***********************************************************************/ -/* returns -1 if no UE */ -int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *m); +/* returns 0 if no UE, 1 otherwise */ +int nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager_t *m, ue_id_t *ret); #endif /* _NR_PDCP_UE_MANAGER_H_ */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index e5057799100e258fdeca7dfed60834151dbd01f0..65df63cfce921886a5df48985dd3ffbf07ff9489 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -539,15 +539,15 @@ rb_found: itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); return; } else { - MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, - sizeof(gtpv1u_gnb_tunnel_data_req_t) + size); - gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(msg); + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_TUNNEL_DATA_REQ, + sizeof(gtpv1u_tunnel_data_req_t) + size); + gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(msg); req->buffer=(uint8_t*)(req+1); memcpy(req->buffer,buf,size); req->length=size; req->offset=0; - req->rnti=ue->rnti; - req->pdusession_id=rb_id; + req->ue_id=ue->rnti; + req->bearer_id=rb_id; LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); extern instance_t DUuniqInstance; itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index b6ce0727895b8f44130005794d2e21d528af2066..92d20d1acaca636a8999ba6530dda96507892253 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -21,7 +21,7 @@ #ifndef _NR_RLC_UE_MANAGER_H_ #define _NR_RLC_UE_MANAGER_H_ - +#include "openair2/COMMON/platform_types.h" #include "nr_rlc_entity.h" typedef void nr_rlc_ue_manager_t; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 914484c1b612fa714616e01437ae0f96f1877d86..3290359495ec0531f9b05b2db113df638774d01a 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -431,14 +431,14 @@ rb_found: } else { // Fixme: very dirty workaround of incomplete F1-U implementation instance_t DUuniqInstance=0; - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); - gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); - req->buffer=malloc(size); + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_TUNNEL_DATA_REQ, sizeof(gtpv1u_tunnel_data_req_t) + size); + gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(msg); + req->buffer=(uint8_t*)(req+1); memcpy(req->buffer,buf,size); req->length=size; req->offset=0; - req->rnti=ue->rnti; - req->rab_id=rb_id+4; + req->ue_id=ue->rnti; + req->bearer_id=rb_id+4; LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg); return; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index f9d314f99222542a753f991d4683ee1c92e20bda..a921511f5bb5bfa4a2d5cce9059a7d3050663a70 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -85,7 +85,7 @@ #include "rrc_eNB_M2AP.h" #include "pdcp.h" -#include "gtpv1u_eNB_task.h" +#include "openair3/ocp-gtpu/gtp_itf.h" #include <openair3/ocp-gtpu/gtp_itf.h> #include "intertask_interface.h" diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index e50868d4afe6d1e0445f38dc400b78ba3ff0bb51..fe47b10c775bfc27d0b76e54d3cac85c32a96d59 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -50,7 +50,7 @@ #include "LTE_UERadioAccessCapabilityInformation.h" -#include "gtpv1u_eNB_task.h" +#include "openair3/ocp-gtpu/gtp_itf.h" #include <openair3/ocp-gtpu/gtp_itf.h> #include "RRC/LTE/rrc_eNB_GTPV1U.h" diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9cdf3e5fe37bbe44e3ae32cd2b26dcdb43c554c2..a8245dd66d298707bd8d1894ba469f8fefff55b8 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -411,7 +411,7 @@ typedef struct rrc_gNB_ue_context_s { /* Uniquely identifies the UE between MME and eNB within the eNB. * This id is encoded on 24bits. */ - rnti_t ue_id_rnti; + ue_id_t ue_id_rnti; // another key for protocol layers but should not be used as a key for RB tree uid_t local_uid; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a105a3002ce2cca342859e6a4d9fb659f5c36669..d107f5eefe8916f6b1871c1df07aeb1889fd1486 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -85,12 +85,10 @@ #include "rrc_eNB_S1AP.h" #include "rrc_gNB_NGAP.h" -#include "rrc_eNB_GTPV1U.h" +#include "rrc_gNB_GTPV1U.h" #include "nr_pdcp/nr_pdcp_entity.h" #include "pdcp.h" -#include "gtpv1u_eNB_task.h" - #include "intertask_interface.h" #include "SIMULATION/TOOLS/sim.h" // for taus @@ -1660,7 +1658,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( } } - create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above + create_tunnel_req.ue_id = ctxt_pP->rnti; // warning put zero above create_tunnel_req.num_tunnels = j; ret = gtpv1u_update_ngu_tunnel( ctxt_pP->instance, @@ -3468,10 +3466,10 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, co int rlc_tx_buffer_space = nr_rlc_get_available_tx_space(rnti, drb_id + 3); LOG_I(NR_RRC, "Reported in DDD drb_id:%d, rnti:%d\n", drb_id, rnti); MessageDef *msg = itti_alloc_new_message_sized(TASK_RRC_GNB, 0, GTPV1U_DU_BUFFER_REPORT_REQ, - sizeof(gtpv1u_gnb_tunnel_data_req_t)); + sizeof(gtpv1u_tunnel_data_req_t)); gtpv1u_DU_buffer_report_req_t *req=>PV1U_DU_BUFFER_REPORT_REQ(msg); req->pdusession_id = drb_id; - req->rnti = rnti; + req->ue_id = rnti; req->buffer_availability = rlc_tx_buffer_space; //10000000; //Hardcoding to be removed and read the actual RLC buffer availability instead extern instance_t DUuniqInstance; itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg); diff --git a/openair2/RRC/NR/rrc_gNB_GTPV1U.c b/openair2/RRC/NR/rrc_gNB_GTPV1U.c index f7b491af14f0364bf2e0726213d3984781bf7734..79495ab5538b0e841d1b0ade9a83d785817c421c 100644 --- a/openair2/RRC/NR/rrc_gNB_GTPV1U.c +++ b/openair2/RRC/NR/rrc_gNB_GTPV1U.c @@ -97,7 +97,7 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RX CREATE_TUNNEL_RESP num tunnels %u \n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), create_tunnel_resp_pP->num_tunnels); - rnti = create_tunnel_resp_pP->rnti; + rnti = create_tunnel_resp_pP->ue_id; ue_context_p = rrc_gNB_get_ue_context( RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8f391417e0d991d518dd811e123981491def28dd..4b6fe7c5c02e92680d9b68c6e0427b5b5e6ea227 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -39,8 +39,7 @@ #include "pdcp.h" #include "pdcp_primitives.h" -#include "gtpv1u_eNB_task.h" -#include "gtpv1u_gNB_task.h" +#include "openair3/ocp-gtpu/gtp_itf.h" #include <openair3/ocp-gtpu/gtp_itf.h> #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "RRC/NR/rrc_gNB_GTPV1U.h" @@ -530,7 +529,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( } ue_context_p->ue_context.nb_of_pdusessions = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_pdusessions; - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; + create_tunnel_req.ue_id = ue_context_p->ue_context.rnti; create_tunnel_req.num_tunnels = pdu_sessions_done; ret = gtpv1u_create_ngu_tunnel( @@ -1012,7 +1011,7 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( ue_context_p->ue_context.nb_of_pdusessions = NGAP_PDUSESSION_SETUP_REQ(msg_p).nb_pdusessions_tosetup; ue_context_p->ue_context.gNB_ue_ngap_id = NGAP_PDUSESSION_SETUP_REQ(msg_p).gNB_ue_ngap_id; ue_context_p->ue_context.amf_ue_ngap_id = NGAP_PDUSESSION_SETUP_REQ(msg_p).amf_ue_ngap_id; - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; + create_tunnel_req.ue_id = ue_context_p->ue_context.rnti; create_tunnel_req.num_tunnels = pdu_sessions_done; ret = gtpv1u_create_ngu_tunnel( @@ -1682,7 +1681,7 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( //gtp tunnel delete LOG_I(NR_RRC, "gtp tunnel delete \n"); gtpv1u_gnb_delete_tunnel_req_t req={0}; - req.rnti = ue_context_p->ue_context.rnti; + req.ue_id = ue_context_p->ue_context.rnti; for(i = 0; i < NB_RB_MAX; i++) { if(xid == ue_context_p->ue_context.pduSession[i].xid) { diff --git a/openair2/SDAP/nr_sdap/nr_sdap.c b/openair2/SDAP/nr_sdap/nr_sdap.c index b71381b1162b50757c2d054c9f25dbde66ba0bf0..0e29451fd9f177a66a877a8f316510a5d0da0758 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap.c +++ b/openair2/SDAP/nr_sdap/nr_sdap.c @@ -25,6 +25,7 @@ uint8_t nas_qfi; uint8_t nas_pduid; bool sdap_data_req(protocol_ctxt_t *ctxt_p, + const ue_id_t ue_id, const srb_flag_t srb_flag, const rb_id_t rb_id, const mui_t mui, @@ -38,10 +39,10 @@ bool sdap_data_req(protocol_ctxt_t *ctxt_p, const bool rqi, const int pdusession_id) { nr_sdap_entity_t *sdap_entity; - sdap_entity = nr_sdap_get_entity(ctxt_p->rnti, pdusession_id); + sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id); if(sdap_entity == NULL) { - LOG_E(SDAP, "%s:%d:%s: Entity not found with ue rnti: %x and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ctxt_p->rnti, pdusession_id); + LOG_E(SDAP, "%s:%d:%s: Entity not found with ue: 0x%"PRIx64" and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ue_id, pdusession_id); return 0; } @@ -66,11 +67,11 @@ void sdap_data_ind(rb_id_t pdcp_entity, int has_sdap, int has_sdapULheader, int pdusession_id, - int rnti, + ue_id_t ue_id, char *buf, int size) { nr_sdap_entity_t *sdap_entity; - sdap_entity = nr_sdap_get_entity(rnti, pdusession_id); + sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id); if(sdap_entity == NULL) { LOG_E(SDAP, "%s:%d:%s: Entity not found for ue rnti: %x and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, rnti, pdusession_id); @@ -83,7 +84,7 @@ void sdap_data_ind(rb_id_t pdcp_entity, has_sdap, has_sdapULheader, pdusession_id, - rnti, + ue_id, buf, size); } diff --git a/openair2/SDAP/nr_sdap/nr_sdap.h b/openair2/SDAP/nr_sdap/nr_sdap.h index ea4fe7f74dc819c4c83b22a186d8ed04dc53fafd..54447ebb68e7a9d72a69e7db1462106f6acefa89 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap.h +++ b/openair2/SDAP/nr_sdap/nr_sdap.h @@ -33,6 +33,7 @@ * Uplink - nrUE */ bool sdap_data_req(protocol_ctxt_t *ctxt_p, + const ue_id_t ue_id, const srb_flag_t srb_flag, const rb_id_t rb_id, const mui_t mui, @@ -57,7 +58,7 @@ void sdap_data_ind(rb_id_t pdcp_entity, int has_sdap, int has_sdapULheader, int pdusession_id, - int rnti, + ue_id_t ue_id, char *buf, int size ); diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.c b/openair2/SDAP/nr_sdap/nr_sdap_entity.c index efa93a29f7290472c629b2f7f9f334690aea5f4d..605e00bdf6b091b18b647cf4e29bc85db7a57abe 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c @@ -175,7 +175,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, int has_sdap, int has_sdapHeader, int pdusession_id, - int rnti, + ue_id_t ue_id, char *buf, int size) { /* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */ @@ -203,18 +203,18 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, // Pushing SDAP SDU to GTP-U Layer MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, - GTPV1U_GNB_TUNNEL_DATA_REQ, - sizeof(gtpv1u_gnb_tunnel_data_req_t) + GTPV1U_TUNNEL_DATA_REQ, + sizeof(gtpv1u_tunnel_data_req_t) + size + GTPU_HEADER_OVERHEAD_MAX - offset); AssertFatal(message_p != NULL, "OUT OF MEMORY"); - gtpv1u_gnb_tunnel_data_req_t *req = >PV1U_GNB_TUNNEL_DATA_REQ(message_p); + gtpv1u_tunnel_data_req_t *req = >PV1U_TUNNEL_DATA_REQ(message_p); uint8_t *gtpu_buffer_p = (uint8_t *) (req + 1); memcpy(gtpu_buffer_p + GTPU_HEADER_OVERHEAD_MAX, buf + offset, size - offset); req->buffer = gtpu_buffer_p; req->length = size - offset; req->offset = GTPU_HEADER_OVERHEAD_MAX; - req->rnti = rnti; - req->pdusession_id = pdusession_id; + req->ue_id = ue_id; + req->bearer_id = pdusession_id; LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset); itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); } else { //nrUE @@ -250,7 +250,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, if(!entity->qfi2drb_table[sdap_hdr->QFI].drb_id && entity->default_drb){ nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI); rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, sdap_hdr->QFI); - entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); + entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); } /* @@ -266,7 +266,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity, has_sdapHeader ){ nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI); rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, sdap_hdr->QFI); - entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); + entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); } /* diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.h b/openair2/SDAP/nr_sdap/nr_sdap_entity.h index 82aa267ebf11a5f38f11e80279c2259670bc3fb0..97a72f65aab0e95035812af2415e0bc3469f5796 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h @@ -105,7 +105,7 @@ typedef struct nr_sdap_entity_s { int has_sdap, int has_sdapULheader, int pdusession_id, - int rnti, + ue_id_t ue_id, char *buf, int size); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 618cdef23b2e6c5f4d5870ba1b1463e01a4ee4bb..6b140dd3b44123937bebe5efcbeec1e3cfd0df3c 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -108,18 +108,18 @@ typedef struct gtpv1u_bearer_s { } gtpv1u_bearer_t; typedef struct { - map<int, gtpv1u_bearer_t> bearers; + map<ue_id_t, gtpv1u_bearer_t> bearers; teid_t outgoing_teid; } teidData_t; typedef struct { - rnti_t rnti; + ue_id_t ue_id; ebi_t incoming_rb_id; gtpCallback callBack; teid_t outgoing_teid; gtpCallbackSDAP callBackSDAP; int pdusession_id; -} rntiData_t; +} ueidData_t; class gtpEndPoint { public: @@ -127,8 +127,8 @@ class gtpEndPoint { uint8_t foundAddr[20]; int foundAddrLen; int ipVersion; - map<int,teidData_t> ue2te_mapping; - map<int,rntiData_t> te2ue_mapping; + map<uint64_t,teidData_t> ue2te_mapping; + map<uint64_t,ueidData_t> te2ue_mapping; // we use the same port number for source and destination address // this allow using non standard gtp port number (different from 2152) // and so, for example tu run 4G and 5G cores on one system @@ -141,7 +141,7 @@ class gtpEndPoints { public: pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; // the instance id will be the Linux socket handler, as this is uniq - map<int, gtpEndPoint> instances; + map<uint64_t, gtpEndPoint> instances; ~gtpEndPoints() { // automatically close all sockets on quit @@ -184,20 +184,20 @@ instance_t legacyInstanceMapping=0; gtpEndPoint * inst=&instChk->second; -#define getRntiRetVoid(insT, RnTi) \ - auto ptrRnti=insT->ue2te_mapping.find(RnTi); \ +#define getUeRetVoid(insT, Ue) \ + auto ptrUe=insT->ue2te_mapping.find(Ue); \ \ - if ( ptrRnti==insT->ue2te_mapping.end() ) { \ - LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \ + if ( ptrUe==insT->ue2te_mapping.end() ) { \ + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue id %ld in hashtable ue_mapping\n", instance, ue_id); \ pthread_mutex_unlock(&globGtp.gtp_lock); \ return; \ } -#define getRntiRetInt(insT, RnTi) \ - auto ptrRnti=insT->ue2te_mapping.find(RnTi); \ +#define getUeRetInt(insT, Ue) \ + auto ptrUe=insT->ue2te_mapping.find(Ue); \ \ - if ( ptrRnti==insT->ue2te_mapping.end() ) { \ - LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \ + if ( ptrUe==insT->ue2te_mapping.end() ) { \ + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue id %ld in hashtable ue_mapping\n", instance, ue_id); \ pthread_mutex_unlock(&globGtp.gtp_lock); \ return GTPNOK; \ } @@ -281,58 +281,25 @@ static int gtpv1uCreateAndSendMsg(int h, return !GTPNOK; } -static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { +static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { uint8_t *buffer=req->buffer+req->offset; size_t length=req->length; - rnti_t rnti=req->rnti; - int rab_id=req->rab_id; + ue_id_t ue_id=req->ue_id; + int bearer_id=req->bearer_id; pthread_mutex_lock(&globGtp.gtp_lock); getInstRetVoid(compatInst(instance)); - getRntiRetVoid(inst, rnti); + getUeRetVoid(inst, ue_id); - map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + auto ptr2=ptrUe->second.bearers.find(bearer_id); - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + if ( ptr2 == ptrUe->second.bearers.end() ) { + LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"[%ld] sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); - - if(seqNumFlag) - ptr2->second.seqNum++; - - if(npduNumFlag) - ptr2->second.npduNum++; - - // copy to release the mutex - gtpv1u_bearer_t tmp=ptr2->second; - pthread_mutex_unlock(&globGtp.gtp_lock); - gtpv1uCreateAndSendMsg( - compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, GTP_GPDU, tmp.teid_outgoing, buffer, length, seqNumFlag, npduNumFlag, tmp.seqNum, tmp.npduNum, NO_MORE_EXT_HDRS, NULL, 0); -} - -static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { - uint8_t *buffer=req->buffer+req->offset; - size_t length=req->length; - rnti_t rnti=req->rnti; - int rab_id=req->pdusession_id; - pthread_mutex_lock(&globGtp.gtp_lock); - getInstRetVoid(compatInst(instance)); - getRntiRetVoid(inst, rnti); - - map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } - - LOG_D(GTPU,"[%ld] GTP-U sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); + LOG_D(GTPU,"[%ld] sending a packet to UE:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n", + instance, ue_id, bearer_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) ptr2->second.seqNum++; @@ -404,16 +371,16 @@ static void fillDlDeliveryStatusReport(extensionHeader_t *extensionHeader, uint3 } static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_report_req_t *req){ - rnti_t rnti=req->rnti; - int rab_id=req->pdusession_id; + ue_id_t ue_id=req->ue_id; + int bearer_id=req->pdusession_id; pthread_mutex_lock(&globGtp.gtp_lock); getInstRetVoid(compatInst(instance)); - getRntiRetVoid(inst, rnti); + getUeRetVoid(inst, ue_id); - map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + auto ptr2=ptrUe->second.bearers.find(bearer_id); - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + if ( ptr2 == ptrUe->second.bearers.end() ) { + LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant UE ID:RAB: %lu/%x\n", instance, ue_id, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -422,8 +389,8 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep extensionHeader = (extensionHeader_t *) calloc(1, sizeof(extensionHeader_t)); fillDlDeliveryStatusReport(extensionHeader, req->buffer_availability,0); - LOG_I(GTPU,"[%ld] GTP-U sending DL Data Delivery status to RNTI:RAB:teid %x/%x/%x, oldseq %d, oldnum %d\n", - instance, rnti, rab_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum ); + LOG_I(GTPU,"[%ld] GTP-U sending DL Data Delivery status to UE ID:RAB:teid %lu/%x/%x, oldseq %d, oldnum %d\n", + instance, ue_id, bearer_id,ptr2->second.teid_outgoing, ptr2->second.seqNum,ptr2->second.npduNum ); // copy to release the mutex gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); @@ -431,23 +398,23 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, GTP_GPDU, tmp.teid_outgoing, NULL, 0, false, false, 0, 0, NR_RAN_CONTAINER, extensionHeader->buffer, extensionHeader->length); } -static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req) { - rnti_t rnti=req->rnti; - int rab_id=req->rab_id; +static void gtpv1uEndTunnel(instance_t instance, gtpv1u_tunnel_data_req_t *req) { + ue_id_t ue_id=req->ue_id; + int bearer_id=req->bearer_id; pthread_mutex_lock(&globGtp.gtp_lock); getInstRetVoid(compatInst(instance)); - getRntiRetVoid(inst, rnti); + getUeRetVoid(inst, ue_id); - map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + auto ptr2=ptrUe->second.bearers.find(bearer_id); - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + if ( ptr2 == ptrUe->second.bearers.end() ) { + LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", - instance, rnti, rab_id,ptr2->second.teid_outgoing); + LOG_D(GTPU,"[%ld] sending a end packet packet to UE:RAB:teid %lx/%x/%x\n", + instance, ue_id, bearer_id,ptr2->second.teid_outgoing); gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; @@ -579,15 +546,15 @@ instance_t gtpv1Init(openAddr_t context) { return id; } -void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid) { +void GtpuUpdateTunnelOutgoingTeid(instance_t instance, ue_id_t ue_id, ebi_t bearer_id, teid_t newOutgoingTeid) { pthread_mutex_lock(&globGtp.gtp_lock); getInstRetVoid(compatInst(instance)); - getRntiRetVoid(inst, rnti); + getUeRetVoid(inst, ue_id); - map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); + auto ptr2=ptrUe->second.bearers.find(bearer_id); - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id); + if ( ptr2 == ptrUe->second.bearers.end() ) { + LOG_E(GTPU,"[%ld] Update tunnel for a existing ue id %lu, but wrong bearer_id %u\n", instance, ue_id, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -599,7 +566,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer } teid_t newGtpuCreateTunnel(instance_t instance, - rnti_t rnti, + ue_id_t ue_id, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -610,10 +577,10 @@ teid_t newGtpuCreateTunnel(instance_t instance, gtpCallbackSDAP callBackSDAP) { pthread_mutex_lock(&globGtp.gtp_lock); getInstRetInt(compatInst(instance)); - auto it=inst->ue2te_mapping.find(rnti); + auto it=inst->ue2te_mapping.find(ue_id); if ( it != inst->ue2te_mapping.end() && it->second.bearers.find(outgoing_bearer_id) != it->second.bearers.end()) { - LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti); + LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (ue id %lu)\n", instance, ue_id); inst->ue2te_mapping.erase(it); } @@ -624,7 +591,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, incoming_teid=gtpv1uNewTeid(); }; - inst->te2ue_mapping[incoming_teid].rnti=rnti; + inst->te2ue_mapping[incoming_teid].ue_id=ue_id; inst->te2ue_mapping[incoming_teid].incoming_rb_id= incoming_bearer_id; @@ -636,7 +603,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, inst->te2ue_mapping[incoming_teid].pdusession_id = (uint8_t)outgoing_bearer_id; - gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; + gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[ue_id].bearers[outgoing_bearer_id]; int addrs_length_in_bytes = remoteAddr.length / 8; @@ -652,7 +619,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, case 20: memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); - memcpy(&tmp->outgoing_ip6_addr.s6_addr, + memcpy(tmp->outgoing_ip6_addr.s6_addr, remoteAddr.buffer+4, 16); @@ -667,9 +634,9 @@ teid_t newGtpuCreateTunnel(instance_t instance, pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "[%ld] Created tunnel for UE ID %lu, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", instance, - rnti, + ue_id, tmp->teid_incoming, tmp->teid_outgoing, inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), @@ -680,7 +647,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, int gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for UE ID %u, num_tunnels %d, sgw_S1u_teid %x\n", instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, @@ -722,7 +689,7 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, int gtpv1u_update_s1u_tunnel( const instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, const rnti_t prior_rnti ) { LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", @@ -743,7 +710,7 @@ int gtpv1u_update_s1u_tunnel( auto it=inst->ue2te_mapping.find(prior_rnti); if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); + LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new ue id %u, old ue id %u)\n", instance, create_tunnel_req->rnti, prior_rnti); pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1u_enb_create_tunnel_resp_t tmp; (void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); @@ -759,9 +726,9 @@ int gtpv1u_update_s1u_tunnel( int gtpv1u_create_ngu_tunnel( const instance_t instance, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { - LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for ue id %lu, num_tunnels %d, sgw_S1u_teid %x\n", instance, - create_tunnel_req->rnti, + create_tunnel_req->ue_id, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); pthread_mutex_lock(&globGtp.gtp_lock); @@ -773,7 +740,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, pthread_mutex_unlock(&globGtp.gtp_lock); for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { teid_t teid = newGtpuCreateTunnel(instance, - create_tunnel_req->rnti, + create_tunnel_req->ue_id, create_tunnel_req->incoming_rb_id[i], create_tunnel_req->pdusession_id[i], create_tunnel_req->outgoing_teid[i], @@ -783,7 +750,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, pdcp_data_req, sdap_data_req); create_tunnel_resp->status=0; - create_tunnel_resp->rnti=create_tunnel_req->rnti; + create_tunnel_resp->ue_id=create_tunnel_req->ue_id; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->gnb_NGu_teid[i]=teid; memcpy(create_tunnel_resp->gnb_addr.buffer,addr,sizeof(addr)); @@ -796,7 +763,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, int gtpv1u_update_ngu_tunnel( const instance_t instanceP, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti + const ue_id_t prior_ueid ) { AssertFatal( false, "to be developped\n"); return GTPNOK; @@ -809,60 +776,60 @@ int gtpv1u_create_x2u_tunnel( AssertFatal( false, "to be developped\n"); } -int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { - LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", - instance, rnti); +int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) { + LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n", + instance, ue_id); pthread_mutex_lock(&globGtp.gtp_lock); getInstRetInt(compatInst(instance)); - getRntiRetInt(inst, rnti); + getUeRetInt(inst, ue_id); int nb=0; - for (auto j=ptrRnti->second.bearers.begin(); - j!=ptrRnti->second.bearers.end(); + for (auto j=ptrUe->second.bearers.begin(); + j!=ptrUe->second.bearers.end(); ++j) { inst->te2ue_mapping.erase(j->second.teid_incoming); nb++; } - inst->ue2te_mapping.erase(ptrRnti); + inst->ue2te_mapping.erase(ptrUe); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for ue id %ld (%d tunnels deleted)\n", instance, ue_id, nb); return !GTPNOK; } -// Legacy delete tunnel finish by deleting all the rnti +// Legacy delete tunnel finish by deleting all the ue id // so the list of bearer provided is only a design bug int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { return newGtpuDeleteAllTunnels(instance, req_pP->rnti); } -int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id) { - LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", - instance, rnti); +int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id) { + LOG_D(GTPU, "[%ld] Start delete tunnels for ue id %lu\n", + instance, ue_id); pthread_mutex_lock(&globGtp.gtp_lock); getInstRetInt(compatInst(instance)); - getRntiRetInt(inst, rnti); + getUeRetInt(inst, ue_id); int nb=0; for (int i=0; i<nbTunnels; i++) { - auto ptr2=ptrRnti->second.bearers.find(pdusession_id[i]); + auto ptr2=ptrUe->second.bearers.find(pdusession_id[i]); - if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n", instance, rnti,pdusession_id[i]); + if ( ptr2 == ptrUe->second.bearers.end() ) { + LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel UE ID:RAB: %ld/%x\n", instance, ue_id, pdusession_id[i]); } else { inst->te2ue_mapping.erase(ptr2->second.teid_incoming); nb++; } } - if (ptrRnti->second.bearers.size() == 0 ) - // no tunnels on this rnti, erase the ue entry - inst->ue2te_mapping.erase(ptrRnti); + if (ptrUe->second.bearers.size() == 0 ) + // no tunnels on this ue id, erase the ue entry + inst->ue2te_mapping.erase(ptrUe); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for ue id %lu (%d tunnels deleted)\n", instance, ue_id, nb); return !GTPNOK; } @@ -874,7 +841,7 @@ int gtpv1u_delete_x2u_tunnel( const instance_t instanceP, int gtpv1u_delete_ngu_tunnel( const instance_t instance, gtpv1u_gnb_delete_tunnel_req_t *req) { - return newGtpuDeleteTunnels(instance, req->rnti, req->num_pdusession, req->pdusession_id); + return newGtpuDeleteTunnels(instance, req->ue_id, req->num_pdusession, req->pdusession_id); } static int Gtpv1uHandleEchoReq(int h, @@ -954,7 +921,7 @@ static int Gtpv1uHandleEndMarker(int h, ctxt.module_id = 0; ctxt.enb_flag = 1; ctxt.instance = inst->addr.originInstance; - ctxt.rnti = tunnel->second.rnti; + ctxt.rnti = tunnel->second.ue_id; ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; @@ -1087,7 +1054,7 @@ static int Gtpv1uHandleGpdu(int h, ctxt.module_id = 0; ctxt.enb_flag = 1; ctxt.instance = inst->addr.originInstance; - ctxt.rnti = tunnel->second.rnti; + ctxt.rnti = tunnel->second.ue_id; ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; @@ -1105,11 +1072,33 @@ static int Gtpv1uHandleGpdu(int h, if (sdu_buffer_size > 0) { if (qfi != -1 && tunnel->second.callBackSDAP) { - if (!tunnel->second.callBackSDAP(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id, qfi, rqi, tunnel->second.pdusession_id)) - LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h); + if ( !tunnel->second.callBackSDAP(&ctxt, + tunnel->second.ue_id, + srb_flag, + rb_id, + mui, + confirm, + sdu_buffer_size, + sdu_buffer, + mode, + &sourceL2Id, + &destinationL2Id, + qfi, + rqi, + tunnel->second.pdusession_id) ) + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); } else { - if (!tunnel->second.callBack(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id)) - LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h); + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + sdu_buffer_size, + sdu_buffer, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); } } @@ -1231,16 +1220,10 @@ void *gtpv1uTask(void *args) { switch (ITTI_MSG_ID(message_p)) { // DATA TO BE SENT TO UDP - case GTPV1U_ENB_TUNNEL_DATA_REQ: { - gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), - >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); - itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); - } - break; - case GTPV1U_GNB_TUNNEL_DATA_REQ: { - gtpv1uSend2(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), - >PV1U_GNB_TUNNEL_DATA_REQ(message_p), false, false); + case GTPV1U_TUNNEL_DATA_REQ: { + gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), + >PV1U_TUNNEL_DATA_REQ(message_p), false, false); } break; @@ -1259,8 +1242,8 @@ void *gtpv1uTask(void *args) { case GTPV1U_ENB_END_MARKER_REQ: gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), - >PV1U_ENB_TUNNEL_DATA_REQ(message_p)); - itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + >PV1U_TUNNEL_DATA_REQ(message_p)); + itti_free(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_REQ(message_p).buffer); break; case GTPV1U_ENB_DATA_FORWARDING_REQ: diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 7951c4db09b8854e55c5c11213d44fc300d9db3c..00736fc67212ff74a3bde16951b2bdd065acafe5 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -8,80 +8,147 @@ extern "C" { #endif -typedef bool (*gtpCallback)(protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id); - -typedef bool (*gtpCallbackSDAP)(protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id, - const uint8_t qfi, - const bool rqi, - const int pdusession_id); - -typedef struct openAddr_s { - char originHost[HOST_NAME_MAX]; - char originService[HOST_NAME_MAX]; - char destinationHost[HOST_NAME_MAX]; - char destinationService[HOST_NAME_MAX]; - instance_t originInstance; -} openAddr_t; - -typedef struct extensionHeader_s{ - uint8_t buffer[500]; - uint8_t length; -}extensionHeader_t; - -// the init function create a gtp instance and return the gtp instance id -// the parameter originInstance will be sent back in each message from gtp to the creator -void gtpv1uReceiver(int h); -void gtpv1uProcessTimeout(int handle,void *arg); -int gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); -int gtpv1u_update_s1u_tunnel(const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, - const rnti_t prior_rnti - ); -int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); -int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); - -int gtpv1u_create_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); - - -// New API -teid_t newGtpuCreateTunnel(instance_t instance, - rnti_t rnti, - int incoming_bearer_id, - int outgoing_rb_id, - teid_t teid, - int outgoing_qfi, - transport_layer_addr_t remoteAddr, - int port, - gtpCallback callBack, - gtpCallbackSDAP callBackSDAP); -void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid); -int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti); -int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id); -instance_t gtpv1Init(openAddr_t context); -void *gtpv1uTask(void *args); + typedef bool (*gtpCallback)(protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id); + typedef bool (*gtpCallbackSDAP)(protocol_ctxt_t *ctxt_pP, + const ue_id_t ue_id, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id, + const uint8_t qfi, + const bool rqi, + const int pdusession_id); + + typedef struct openAddr_s { + char originHost[HOST_NAME_MAX]; + char originService[HOST_NAME_MAX]; + char destinationHost[HOST_NAME_MAX]; + char destinationService[HOST_NAME_MAX]; + instance_t originInstance; + } openAddr_t; + + typedef struct extensionHeader_s{ + uint8_t buffer[500]; + uint8_t length; + }extensionHeader_t; + + // the init function create a gtp instance and return the gtp instance id + // the parameter originInstance will be sent back in each message from gtp to the creator + void gtpv1uReceiver(int h); + void gtpv1uProcessTimeout(int handle,void *arg); + int gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); + int gtpv1u_update_s1u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, + const rnti_t prior_rnti + ); + + int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); + + int gtpv1u_create_x2u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); + + int gtpv1u_delete_x2u_tunnel( const instance_t instanceP, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP); + int + gtpv1u_create_ngu_tunnel( + const instance_t instanceP, + const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP); + + int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req); + + int gtpv1u_update_ngu_tunnel( const instance_t instanceP, + const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, + const ue_id_t prior_rnti + ); + + // New API + teid_t newGtpuCreateTunnel(instance_t instance, + ue_id_t ue_id, + int incoming_bearer_id, + int outgoing_rb_id, + teid_t teid, + int outgoing_qfi, + transport_layer_addr_t remoteAddr, + int port, + gtpCallback callBack, + gtpCallbackSDAP callBackSDAP); + + void GtpuUpdateTunnelOutgoingTeid(instance_t instance, + ue_id_t ue_id, + ebi_t bearer_id, + teid_t newOutgoingTeid); + + int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id); + int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id); + instance_t gtpv1Init(openAddr_t context); + void *gtpv1uTask(void *args); + + // Legacy to fix + typedef struct gtpv1u_data_s { + /* RB tree of UEs */ + hash_table_t *ue_mapping; + } gtpv1u_data_t; +#define GTPV1U_BEARER_OFFSET 3 +#define GTPV1U_MAX_BEARERS_ID (max_val_LTE_DRB_Identity - GTPV1U_BEARER_OFFSET) + typedef enum { + BEARER_DOWN = 0, + BEARER_IN_CONFIG, + BEARER_UP, + BEARER_DL_HANDOVER, + BEARER_UL_HANDOVER, + BEARER_MAX, + } bearer_state_t; + + typedef struct fixMe_gtpv1u_bearer_s { + /* TEID used in dl and ul */ + teid_t teid_eNB; ///< eNB TEID + uintptr_t teid_eNB_stack_session; ///< eNB TEID + teid_t teid_sgw; ///< Remote TEID + in_addr_t sgw_ip_addr; + struct in6_addr sgw_ip6_addr; + teid_t teid_teNB; + in_addr_t tenb_ip_addr; ///< target eNB ipv4 + struct in6_addr tenb_ip6_addr; ///< target eNB ipv6 + tcp_udp_port_t port; + //NwGtpv1uStackSessionHandleT stack_session; + bearer_state_t state; + } fixMe_gtpv1u_bearer_t; + + typedef struct gtpv1u_ue_data_s { + /* UE identifier for oaisim stack */ + rnti_t ue_id; + + /* Unique identifier used between PDCP and GTP-U to distinguish UEs */ + uint32_t instance_id; + int num_bearers; + /* Bearer related data. + * Note that the first LCID available for data is 3 and we fixed the maximum + * number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32). + */ + fixMe_gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID]; + + //RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; + } gtpv1u_ue_data_t; + #ifdef __cplusplus } #endif diff --git a/openair3/ocp-gtpu/gtpv1u_eNB_task.h b/openair3/ocp-gtpu/gtpv1u_eNB_task.h deleted file mode 100644 index e764eb143b141b70c00f5b6ab5a32ae80fb84f8b..0000000000000000000000000000000000000000 --- a/openair3/ocp-gtpu/gtpv1u_eNB_task.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file gtpv1u_eNB_task.h -* \brief -* \author Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef GTPV1U_ENB_TASK_H_ -#define GTPV1U_ENB_TASK_H_ - -typedef struct gtpv1u_data_s { - /* RB tree of UEs */ - hash_table_t *ue_mapping; -} gtpv1u_data_t; - -#define GTPV1U_BEARER_OFFSET 3 -#define GTPV1U_MAX_BEARERS_ID (max_val_LTE_DRB_Identity - GTPV1U_BEARER_OFFSET) -typedef enum { - BEARER_DOWN = 0, - BEARER_IN_CONFIG, - BEARER_UP, - BEARER_DL_HANDOVER, - BEARER_UL_HANDOVER, - BEARER_MAX, -} bearer_state_t; - -typedef struct fixMe_gtpv1u_bearer_s { - /* TEID used in dl and ul */ - teid_t teid_eNB; ///< eNB TEID - uintptr_t teid_eNB_stack_session; ///< eNB TEID - teid_t teid_sgw; ///< Remote TEID - in_addr_t sgw_ip_addr; - struct in6_addr sgw_ip6_addr; - teid_t teid_teNB; - in_addr_t tenb_ip_addr; ///< target eNB ipv4 - struct in6_addr tenb_ip6_addr; ///< target eNB ipv6 - tcp_udp_port_t port; - //NwGtpv1uStackSessionHandleT stack_session; - bearer_state_t state; -} fixMe_gtpv1u_bearer_t; - -typedef struct gtpv1u_ue_data_s { - /* UE identifier for oaisim stack */ - rnti_t ue_id; - - /* Unique identifier used between PDCP and GTP-U to distinguish UEs */ - uint32_t instance_id; - int num_bearers; - /* Bearer related data. - * Note that the first LCID available for data is 3 and we fixed the maximum - * number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32). - */ - fixMe_gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID]; - - //RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; -} gtpv1u_ue_data_t; -/* -int -gtpv1u_new_data_req( - uint8_t enb_id, - uint8_t ue_id, - uint8_t rab_id, - uint8_t *buffer, - uint32_t buf_len, - uint32_t buf_offset);*/ - -int gtpv1u_eNB_init(void); -void *gtpv1u_eNB_process_itti_msg(void *); -void *gtpv1u_eNB_task(void *args); - -int -gtpv1u_create_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); - -int -gtpv1u_create_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_enb_create_tunnel_resp_t *const create_tunnel_resp_pP); - -int -gtpv1u_update_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti); - -int gtpv1u_delete_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP); -#endif /* GTPV1U_ENB_TASK_H_ */ diff --git a/openair3/ocp-gtpu/gtpv1u_gNB_task.h b/openair3/ocp-gtpu/gtpv1u_gNB_task.h deleted file mode 100644 index 817d0109ba6d7ebc399d7b27060a3f71be45810f..0000000000000000000000000000000000000000 --- a/openair3/ocp-gtpu/gtpv1u_gNB_task.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file gtpv1u_gNB_task.h -* \brief -* \author Lionel Gauthier Panos Matzakos -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef GTPV1U_GNB_TASK_H_ -#define GTPV1U_GNB_TASK_H_ - -int gtpv1u_gNB_init(void); - -void *gtpv1u_gNB_task(void *args); - -void *nr_gtpv1u_gNB_task(void *args); - -int -gtpv1u_create_ngu_tunnel( - const instance_t instanceP, - const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP); - -int -gtpv1u_update_ngu_tunnel( - const instance_t instanceP, - const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti -); - -int gtpv1u_delete_ngu_tunnel( const instance_t instance, - gtpv1u_gnb_delete_tunnel_req_t *req); - -#endif /* GTPV1U_GNB_TASK_H_ */ -