diff --git a/common/ran_context.h b/common/ran_context.h index 7a035f59bb..1201753d1d 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 +#include typedef struct { diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 9da3f03c23..0a7bbc3b78 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 //#include -#include -#include void *rrc_enb_process_itti_msg(void *); #include #include diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 01d3c377d4..3886b04099 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -338,13 +338,14 @@ 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 nr_DRB_preconfiguration(): the mac layer calls this for ??? -nr_rrc_pdcp_config_asn1_req() adds a UE in pdcp, pdcp_remove_UE() removes it +nr_pdcp_add_srbs() adds UE SRBs in pdcp, pdcp_remove_UE() removes it +nr_pdcp_add_drbs() adds UE DRBs in pdcp, pdcp_remove_UE() removes it # GTP Gtp + UDP are two twin threads performing the data plane interface to the core network diff --git a/executables/create_tasks.c b/executables/create_tasks.c index 16c735d9f3..0081eca66d 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 b82b4f158b..9853c1b6ec 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 cdca62c399..2172827b03 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 b9deeadfd8..824d699c60 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 6df4896bc5..88c46b057a 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 5a99f2c4ce..2a46b40b71 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 e0e5db5b7f..35af0c04e7 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 7758395ee4..4ba50c47e5 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,28 @@ 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]; + pdusessionid_t pdusession_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 f229721993..8aebd0374b 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; @@ -215,7 +215,7 @@ typedef struct protocol_ctxt_s { module_id_t module_id; /*!< \brief Virtualized module identifier */ eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ instance_t instance; /*!< \brief ITTI or OTG module identifier */ - rnti_t rnti; + ue_id_t rntiMaybeUEid; frame_t frame; /*!< \brief LTE frame number.*/ sub_frame_t subframe; /*!< \brief LTE sub frame number.*/ eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */ @@ -252,36 +252,27 @@ typedef struct protocol_ctxt_s { #define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) \ MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag ) - #define PROTOCOL_CTXT_SET_BY_MODULE_ID(Ctxt_Pp, mODULE_iD, eNB_fLAG, rNTI, fRAME, sUBfRAME, eNB_iNDEX) \ - (Ctxt_Pp)->module_id = mODULE_iD; \ - (Ctxt_Pp)->enb_flag = eNB_fLAG; \ - (Ctxt_Pp)->rnti = rNTI; \ - (Ctxt_Pp)->frame = fRAME; \ - (Ctxt_Pp)->subframe = sUBfRAME; \ - (Ctxt_Pp)->eNB_index = eNB_iNDEX; \ + (Ctxt_Pp)->module_id = mODULE_iD; \ + (Ctxt_Pp)->enb_flag = eNB_fLAG; \ + (Ctxt_Pp)->rntiMaybeUEid = rNTI; \ + (Ctxt_Pp)->frame = fRAME; \ + (Ctxt_Pp)->subframe = sUBfRAME; \ + (Ctxt_Pp)->eNB_index = eNB_iNDEX; \ PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp) #define PROTOCOL_CTXT_SET_BY_INSTANCE(Ctxt_Pp, iNSTANCE, eNB_fLAG, rNTI, fRAME, sUBfRAME) \ - (Ctxt_Pp)->instance = iNSTANCE; \ - (Ctxt_Pp)->enb_flag = eNB_fLAG; \ - (Ctxt_Pp)->rnti = rNTI; \ - (Ctxt_Pp)->frame = fRAME; \ - (Ctxt_Pp)->subframe = sUBfRAME; \ + (Ctxt_Pp)->instance = iNSTANCE; \ + (Ctxt_Pp)->enb_flag = eNB_fLAG; \ + (Ctxt_Pp)->rntiMaybeUEid = rNTI; \ + (Ctxt_Pp)->frame = fRAME; \ + (Ctxt_Pp)->subframe = sUBfRAME; \ PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp) -#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02d][RNTI %" PRIx16 "]" -#define PROTOCOL_CTXT_ARGS(CTXT_Pp) \ - (CTXT_Pp)->frame, \ - ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \ - (CTXT_Pp)->module_id, \ - (CTXT_Pp)->rnti +#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02d][RNTI %" PRIx64 "]" +#define PROTOCOL_CTXT_ARGS(CTXT_Pp) (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid -#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) \ - (CTXT_Pp)->frame, \ - ((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB":" UE", \ - (CTXT_Pp)->module_id, \ - (CTXT_Pp)->rnti +#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid #define CHECK_CTXT_ARGS(CTXT_Pp) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index c935e48c2d..b9c8e5bb51 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -40,8 +40,7 @@ # include "intertask_interface.h" # include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# include "gtpv1u_eNB_task.h" +#include "sctp_eNB_task.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" diff --git a/openair2/F1AP/dummy_enb.c b/openair2/F1AP/dummy_enb.c index 22627c8d92..08a5b906ee 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/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 3ae30cafb9..ed61ad794b 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -294,12 +294,12 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, protocol_ctxt_t ctxt={0}; ctxt.instance = instance; ctxt.module_id = instance; - ctxt.rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); + ctxt.rntiMaybeUEid = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); ctxt.enb_flag = 1; ctxt.eNB_index = 0; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void *)mb->data,(void *)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); - LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); + LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %lx srb_id %lu with size %ld (DCCH) \n", ctxt.rntiMaybeUEid, srb_id, ie->value.choice.RRCContainer.size); //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) // printf("%02x ", mb->data[i]); diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index e9279c6ac0..433e8414a3 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -164,13 +164,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); + ctxt.rntiMaybeUEid = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); ctxt.instance = instance; ctxt.module_id = instance; ctxt.enb_flag = 1; - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt.instance], - ctxt.rnti); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rntiMaybeUEid); if (srb_id == 0) { LTE_DL_CCCH_Message_t *dl_ccch_msg=NULL; @@ -257,7 +255,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, if (radioResourceConfigDedicated->mac_MainConfig) mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; rrc_mac_config_req_eNB_t tmp = {0}; - tmp.rnti = ctxt.rnti; + tmp.rnti = ctxt.rntiMaybeUEid; tmp.physicalConfigDedicated = radioResourceConfigDedicated->physicalConfigDedicated; tmp.mac_MainConfig = mac_MainConfig; tmp.logicalChannelIdentity = 1; @@ -358,7 +356,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, MessageDef *message_p = NULL; /* Send DRX configuration to MAC task to configure timers of local UE context */ message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ); - RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti; + RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rntiMaybeUEid; RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; itti_send_msg_to_task(TASK_MAC_ENB, ctxt.instance, message_p); LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); @@ -396,9 +394,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; LOG_I(F1AP, - "[DU %ld] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", + "[DU %ld] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %lx, reconfiguring DRB %d/LCID %d\n", ctxt.instance, - ctxt.rnti, + ctxt.rntiMaybeUEid, (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index c37e2cfdc6..aae59bbdae 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -834,7 +834,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, f1ap_ue_context_release_cmd->rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); } else{ - ctxt.rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); + ctxt.rntiMaybeUEid = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); ctxt.instance = instance; ctxt.module_id = instance; ctxt.enb_flag = 1; @@ -850,9 +850,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, rnti, f1ap_ue_context_release_cmd->rnti); } else{ - AssertFatal(ctxt.rnti == rnti, - "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", - rnti, ctxt.rnti); + AssertFatal(ctxt.rntiMaybeUEid == rnti, "RNTI obtained through DU ID (%x) is different from CU ID (%lx)\n", rnti, ctxt.rntiMaybeUEid); } int UE_out_of_sync = 0; @@ -946,7 +944,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return 0; } else { struct rrc_eNB_ue_context_s *ue_context_p; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rntiMaybeUEid); if (ue_context_p && !UE_out_of_sync) { // UE exists and is in sync so we start a timer before releasing the @@ -960,13 +958,12 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, else rrc_release_info.RRC_release_ctrl[release_num].flag = 2; - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rntiMaybeUEid; + LOG_D(F1AP, "add rrc_release_info RNTI %lx\n", ctxt.rntiMaybeUEid); // TODO: how to provide the correct MUI? rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + LOG_D(RRC, "Generate DLSCH Release send: index %d rnti %lx mui %d flag %d \n", release_num, ctxt.rntiMaybeUEid, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); break; } } @@ -982,7 +979,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, // TODO send this once the connection has really been released f1ap_ue_context_release_cplt_t cplt; - cplt.rnti = ctxt.rnti; + cplt.rnti = ctxt.rntiMaybeUEid; DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); return 0; } @@ -1248,7 +1245,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); protocol_ctxt_t ctxt; // decode RRC Container and act on the message type - ctxt.rnti = f1ap_ue_context_modification_req->rnti; + ctxt.rntiMaybeUEid = f1ap_ue_context_modification_req->rnti; ctxt.instance = instance; ctxt.module_id = instance; ctxt.enb_flag = 1; diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 9263525b31..862cf9dddc 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/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 8c2d6bf966..4bc2232180 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -117,7 +117,7 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t * nr_rlc_srb0_recv_sdu(dl_rrc->rnti, dl_rrc->rrc_container, dl_rrc->rrc_container_length); - protocol_ctxt_t ctxt = { .module_id = module_id, .rnti = dl_rrc->rnti }; + protocol_ctxt_t ctxt = {.module_id = module_id, .rntiMaybeUEid = dl_rrc->rnti}; nr_rrc_rlc_config_asn1_req(&ctxt, ue_context_p->ue_context.SRB_configList, NULL, diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index d9cf4eac3d..e9854662a3 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 -# include "gtpv1u_eNB_task.h" +# include "openair3/ocp-gtpu/gtp_itf.h" #include #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->rntiMaybeUEid; + 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; @@ -268,7 +267,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, #if T_TRACER if (ctxt_pP->enb_flag != ENB_FLAG_NO) - T(T_ENB_PDCP_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP)); + T(T_ENB_PDCP_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_buffer_sizeP)); #endif @@ -284,16 +283,16 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, sdu_buffer_sizeP, MAX_IP_PACKET_SIZE); if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { - AssertError (rb_idP < NB_RB_MBMS_MAX, return false, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rnti); + AssertError(rb_idP < NB_RB_MBMS_MAX, return false, "RB id is too high (%ld/%d) %u %lu!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); } else { if (srb_flagP) { - AssertError (rb_idP < 3, return false, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rnti); + AssertError(rb_idP < 3, return false, "RB id is too high (%ld/%d) %u %lu!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); } else { - AssertError (rb_idP < LTE_maxDRB, return false, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); + AssertError(rb_idP < LTE_maxDRB, return false, "RB id is too high (%ld/%d) %u %lu!\n", rb_idP, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); } } - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc != HASH_TABLE_OK) { @@ -489,8 +488,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, "[MSG] PDCP DL %s PDU on rb_id %ld\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP); if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { - LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %x, node_type %d \n", - rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc ? RC.rrc[ctxt_pP->module_id]->node_type: -1); + LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %lx, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rntiMaybeUEid, RC.rrc ? RC.rrc[ctxt_pP->module_id]->node_type : -1); if (ctxt_pP->enb_flag == ENB_FLAG_YES && NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); @@ -534,7 +532,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, 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 = ctxt_pP->rnti; + F1AP_DL_RRC_MESSAGE(message_p).rnti = ctxt_pP->rntiMaybeUEid; F1AP_DL_RRC_MESSAGE (message_p).srb_id = rb_idP; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; @@ -596,16 +594,9 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, * so we return true afterwards */ - if (ctxt_pP->enb_flag == ENB_FLAG_NO) - pdcp_uid = 0; - else - for (pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; pdcp_uid++) - if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti) - break; - - if (pdcp_uid == MAX_MOBILES_PER_ENB) { - LOG_W(PDCP, "stats on not recorded rnti: %x\n", ctxt_pP->rnti); - pdcp_uid = 0; + for (pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; pdcp_uid++) { + if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rntiMaybeUEid) + break; } LOG_D(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, (int)(rb_idP+rb_offset), current_sn); @@ -649,7 +640,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; @@ -658,25 +648,22 @@ pdcp_data_ind( "[MSG] PDCP UL %s PDU on rb_id %ld\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP); if (MBMS_flagP) { - AssertError (rb_idP < NB_RB_MBMS_MAX, return false, - "RB id is too high (%ld/%d) %u rnti %x!\n", - rb_idP, - NB_RB_MBMS_MAX, - ctxt_pP->module_id, - ctxt_pP->rnti); + AssertError(rb_idP < NB_RB_MBMS_MAX, return false, "RB id is too high (%ld/%d) %u rnti %lx!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if (ctxt_pP->enb_flag == ENB_FLAG_NO) { - LOG_D(PDCP, "e-MBMS Data indication notification for PDCP entity from eNB %u to UE %x " + LOG_D(PDCP, + "e-MBMS Data indication notification for PDCP entity from eNB %u to UE %lx " "and radio bearer ID %ld rlc sdu size %d ctxt_pP->enb_flag %d\n", ctxt_pP->module_id, - ctxt_pP->rnti, + ctxt_pP->rntiMaybeUEid, rb_idP, sdu_buffer_sizeP, ctxt_pP->enb_flag); } else { - LOG_D(PDCP, "Data indication notification for PDCP entity from UE %x to eNB %u " + LOG_D(PDCP, + "Data indication notification for PDCP entity from UE %lx to eNB %u " "and radio bearer ID %ld rlc sdu size %d ctxt_pP->enb_flag %d\n", - ctxt_pP->rnti, + ctxt_pP->rntiMaybeUEid, ctxt_pP->module_id, rb_idP, sdu_buffer_sizeP, @@ -684,17 +671,9 @@ pdcp_data_ind( } } else { rb_id = rb_idP % LTE_maxDRB; - AssertError (rb_id < LTE_maxDRB, return false, "RB id is too high (%ld/%d) %u UE %x!\n", - rb_id, - LTE_maxDRB, - ctxt_pP->module_id, - ctxt_pP->rnti); - AssertError (rb_id > 0, return false, "RB id is too low (%ld/%d) %u UE %x!\n", - rb_id, - LTE_maxDRB, - ctxt_pP->module_id, - ctxt_pP->rnti); - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_id, srb_flagP); + AssertError(rb_id < LTE_maxDRB, return false, "RB id is too high (%ld/%d) %u UE %lx!\n", rb_id, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); + AssertError(rb_id > 0, return false, "RB id is too low (%ld/%d) %u UE %lx!\n", rb_id, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, rb_id, srb_flagP); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc != HASH_TABLE_OK) { @@ -1056,22 +1035,18 @@ 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", - 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); + LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_TUNNEL_DATA_REQ ue %lx rab %ld len %u\n", ctxt_pP->rntiMaybeUEid, rb_id + 4, sdu_buffer_sizeP - payload_offset); + 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->rntiMaybeUEid; + req->bearer_id = rb_id + 4; itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); packet_forwarded = true; } @@ -1165,16 +1140,10 @@ pdcp_data_ind( } /* Update PDCP statistics */ - if (ctxt_pP->enb_flag == ENB_FLAG_NO) - pdcp_uid = 0; - else - for (pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; pdcp_uid++) - if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti) - break; - - if (pdcp_uid == MAX_MOBILES_PER_ENB) { - LOG_W(PDCP, "stats on not recorded rnti: %x\n", ctxt_pP->rnti); - pdcp_uid = 0; + for (pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; pdcp_uid++) { + if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rntiMaybeUEid) { + break; + } } Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; @@ -1535,7 +1504,7 @@ void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) { int i, ue_flag=1; //, ret=-1; to be decied later for (i=0; i < MAX_MOBILES_PER_ENB; i++) { - if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti) { + if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rntiMaybeUEid) { ue_flag=-1; break; } @@ -1544,10 +1513,10 @@ void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) { if (ue_flag == 1 ) { for (i=0; i < MAX_MOBILES_PER_ENB ; i++) { if (pdcp_enb[ctxt_pP->module_id].rnti[i] == 0 ) { - pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti; + pdcp_enb[ctxt_pP->module_id].rnti[i] = ctxt_pP->rntiMaybeUEid; pdcp_enb[ctxt_pP->module_id].uid[i]=i; pdcp_enb[ctxt_pP->module_id].num_ues++; - LOG_I(PDCP,"add new uid is %d %x\n", i, ctxt_pP->rnti); + LOG_I(PDCP, "add new uid is %d %lx\n", i, ctxt_pP->rntiMaybeUEid); pdcp_init_stats_UE(ctxt_pP->module_id, i); // ret=1; break; @@ -1570,19 +1539,19 @@ bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) // check and remove SRBs first for(int i = 0; irnti) { + if (pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rntiMaybeUEid) { pdcp_eNB_UE_instance_to_rnti[i] = NOT_A_RNTI; break; } } for (srb_id=1; srb_id<3; srb_id++) { - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); h_rc = hashtable_remove(pdcp_coll_p, key); } for (drb_id=0; drb_idmodule_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_remove(pdcp_coll_p, key); } @@ -1590,7 +1559,7 @@ bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) // remove ue for pdcp enb inst for (i=0; i < MAX_MOBILES_PER_ENB; i++) { - if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti ) { + if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rntiMaybeUEid) { LOG_I(PDCP, "remove uid is %d/%d %x\n", i, pdcp_enb[ctxt_pP->module_id].uid[i], pdcp_enb[ctxt_pP->module_id].rnti[i]); @@ -1656,7 +1625,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, srb_toaddmod_p = srb2add_list_pP->list.array[cnt]; rlc_type = RLC_MODE_AM; lc_id = srb_id; - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { @@ -1735,7 +1704,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, break; default: - DevParam(srb_toaddmod_p->rlc_Config->present, ctxt_pP->module_id, ctxt_pP->rnti); + DevParam(srb_toaddmod_p->rlc_Config->present, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); break; } } @@ -1762,8 +1731,8 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, continue; } - DevCheck4(drb_id < LTE_maxDRB, drb_id, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); + DevCheck4(drb_id < LTE_maxDRB, drb_id, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { @@ -1778,7 +1747,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, // save the first configured DRB-ID as the default DRB-ID if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { - key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); + key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag); h_defaultDRB_rc = hashtable_insert(pdcp_coll_p, key_defaultDRB, pdcp_p); } else { h_defaultDRB_rc = HASH_TABLE_OK; // do not trigger any error handling if this is not a default DRB @@ -1884,7 +1853,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, for (cnt=0; cntlist.count; cnt++) { pdrb_id_p = drb2release_list_pP->list.array[cnt]; drb_id = *pdrb_id_p; - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc != HASH_TABLE_OK) { @@ -1916,7 +1885,7 @@ rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { // default DRB being removed. nevertheless this shouldn't happen as removing default DRB is not allowed in standard - key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); + key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag); h_defaultDRB_rc = hashtable_get(pdcp_coll_p, key_defaultDRB, (void **)&pdcp_p); if (h_defaultDRB_rc == HASH_TABLE_OK) { @@ -2022,8 +1991,8 @@ pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP, pdcp_pP->is_ue = false; pdcp_add_UE(ctxt_pP); - //pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti; - // pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti; + // pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rntiMaybeUEid; + // pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rntiMaybeUEid; if( srb_flagP == SRB_FLAG_NO ) { for(int i = 0; irnti; + pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rntiMaybeUEid; pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % MAX_MOBILES_PER_ENB; } //pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % MAX_MOBILES_PER_ENB; } else { pdcp_pP->is_ue = true; - pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rnti; + pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rntiMaybeUEid; } pdcp_pP->is_srb = srb_flagP == SRB_FLAG_YES; @@ -2188,7 +2157,7 @@ pdcp_config_req_asn1(const protocol_ctxt_t *const ctxt_pP, break; default: - DevParam(actionP, ctxt_pP->module_id, ctxt_pP->rnti); + DevParam(actionP, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); break; } @@ -2235,7 +2204,7 @@ void rrc_pdcp_config_req ( //----------------------------------------------------------------------------- { pdcp_t *pdcp_p = NULL; - hash_key_t key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); + hash_key_t key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); @@ -2250,7 +2219,7 @@ void rrc_pdcp_config_req ( if (ctxt_pP->enb_flag == ENB_FLAG_NO) { pdcp_p->is_ue = true; - pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rnti; + pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rntiMaybeUEid; } else { pdcp_p->is_ue = false; } @@ -2307,7 +2276,7 @@ void rrc_pdcp_config_req ( break; default: - DevParam(actionP, ctxt_pP->module_id, ctxt_pP->rnti); + DevParam(actionP, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); break; } } else { @@ -2326,7 +2295,7 @@ void rrc_pdcp_config_req ( if (ctxt_pP->enb_flag == ENB_FLAG_NO) { pdcp_p->is_ue = true; - pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rnti; + pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rntiMaybeUEid; } else { pdcp_p->is_ue = false; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index f6a61330d0..d6e022f4f1 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 @@ -249,29 +249,34 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { } if (UE_NAS_USE_TUN) { - key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); } else { // => ENB_NAS_USE_TUN /* Get the IP from a packet */ struct ip *ip_pack = (struct ip *) nl_rx_buf; /* Use last octet of destination IP to get index of UE */ int ue_indx = ((ip_pack->ip_dst.s_addr >> 24) - 2) % MAX_MOBILES_PER_ENB; - ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[ue_indx]; + ctxt.rntiMaybeUEid = pdcp_eNB_UE_instance_to_rnti[ue_indx]; ctxt.enb_flag=ENB_FLAG_YES; ctxt.module_id=0; - key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); } - LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); if (h_rc == HASH_TABLE_OK) { LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %ld: Received socket with length %d on Rab %ld \n", ctxt.frame, ctxt.instance, len, rab_id); - LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", - ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, - ctxt.rnti, rab_id); + LOG_D(PDCP, + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04lx][RB %ld]\n", + ctxt.frame, + ctxt.instance, + rab_id, + len, + ctxt.module_id, + ctxt.rntiMaybeUEid, + rab_id); #if defined ENABLE_PDCP_PAYLOAD_DEBUG LOG_I(PHY, "TUN interface output received from PDCP: \n"); @@ -288,9 +293,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ); } else { LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] TUN NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", - ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, - ctxt.rnti, rab_id, key); + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04lx][RB %ld] TUN NON INSTANCIATED INSTANCE key 0x%" PRIx64 ", DROPPED\n", + ctxt.frame, + ctxt.instance, + rab_id, + len, + ctxt.module_id, + ctxt.rntiMaybeUEid, + rab_id, + key); } } @@ -320,8 +331,8 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p if (len<=0) continue; if (UE_NAS_USE_TUN) { - //key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); - //h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); + // key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); + // h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); } else { // => ENB_NAS_USE_TUN //ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0]; // ctxt.enb_flag=ENB_FLAG_YES; @@ -331,15 +342,20 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p // LOG_W(PDCP,"h_rc %d %d\n",h_rc,rab_id); } - LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); if (h_rc == HASH_TABLE_OK) { LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %ld: Received socket with length %d on Rab %ld \n", ctxt.frame, ctxt.instance, len, rab_id); - LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", - ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, - ctxt.rnti, rab_id); + LOG_D(PDCP, + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04lx][RB %ld]\n", + ctxt.frame, + ctxt.instance, + rab_id, + len, + ctxt.module_id, + ctxt.rntiMaybeUEid, + rab_id); pdcp_data_req( &ctxt, SRB_FLAG_NO, @@ -360,22 +376,28 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p // ); } else { LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", - ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, - ctxt.rnti, rab_id, key); - //if (!UE_NAS_USE_TUN) { - // pdcp_data_req( - // &ctxt, - // SRB_FLAG_NO, - // DEFAULT_RAB_ID, - // RLC_MUI_UNDEFINED, - // RLC_SDU_CONFIRM_NO, - // len, - // (unsigned char *)nl_rx_buf, - // PDCP_TRANSMISSION_MODE_TRANSPARENT - // , NULL, NULL - // ); - //} + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04lx][RB %ld] NON INSTANCIATED INSTANCE key 0x%" PRIx64 ", DROPPED\n", + ctxt.frame, + ctxt.instance, + rab_id, + len, + ctxt.module_id, + ctxt.rntiMaybeUEid, + rab_id, + key); + // if (!UE_NAS_USE_TUN) { + // pdcp_data_req( + // &ctxt, + // SRB_FLAG_NO, + // DEFAULT_RAB_ID, + // RLC_MUI_UNDEFINED, + // RLC_SDU_CONFIRM_NO, + // len, + // (unsigned char *)nl_rx_buf, + // PDCP_TRANSMISSION_MODE_TRANSPARENT + // , NULL, NULL + // ); + // } } } while (len > 0); @@ -440,28 +462,30 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx if (ctxt.enb_flag) { ctxt.module_id = 0; rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; - ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB]; + ctxt.rntiMaybeUEid = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB]; if (rab_id != 0) { rab_id = rab_id % LTE_maxDRB; - key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { - LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %ld for rnti: %d \n", + LOG_D(PDCP, + "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %ld for rnti: %ld \n", ctxt.frame, pdcp_read_header_g.inst, len, - nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), + nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr), pdcp_read_header_g.rb_id, - ctxt.rnti); - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %u][RB %ld]\n", + ctxt.rntiMaybeUEid); + LOG_D(PDCP, + "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %lu][RB %ld]\n", ctxt_cpy.frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id); pdcp_data_req(&ctxt, SRB_FLAG_NO, @@ -474,13 +498,14 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx ,NULL, NULL ); } else { - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE, DROPPED\n", + LOG_D(PDCP, + "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %lu][RB %ld] NON INSTANCIATED INSTANCE, DROPPED\n", ctxt.frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id); } } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast @@ -500,24 +525,20 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx } rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; - ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; + ctxt.rntiMaybeUEid = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; if (rab_id != 0) { if (rab_id == UE_IP_DEFAULT_RAB_ID) { - LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag); - key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); + key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); - LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n", - (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); + LOG_D(PDCP, "request key %x : (%d,%lx,%d,%ld)\n", (uint8_t)key, ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id); } else { rab_id = rab_id % LTE_maxDRB; - LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); - key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%lx, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); - LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n", - (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); + LOG_D(PDCP, "request key %x : (%d,%lx,%d,%ld)\n", (uint8_t)key, ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id); } if (h_rc == HASH_TABLE_OK) { @@ -528,13 +549,14 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx len, nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header_g.rb_id); - LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %ld]\n", + LOG_D(PDCP, + "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %lu][RB %ld]\n", ctxt.frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id); pdcp_data_req( &ctxt, @@ -550,25 +572,26 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx ); } else { /* else of h_rc == HASH_TABLE_OK */ LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", + "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %lu][RB %ld] NON INSTANCIATED INSTANCE key 0x%" PRIx64 ", DROPPED\n", ctxt.frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id, key); } /* h_rc != HASH_TABLE_OK */ } else {/* else of rab_id != 0 */ LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n", + LOG_D(PDCP, + "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %lu][RB DEFAULT_RAB_ID %u]\n", ctxt.frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, DEFAULT_RAB_ID); pdcp_data_req ( &ctxt, @@ -669,31 +692,27 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) if (ctxt_cpy.enb_flag) { ctxt.module_id = 0; rab_id = pc5s_header->rb_id % LTE_maxDRB; - ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index]; + ctxt.rntiMaybeUEid = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index]; } else { ctxt.module_id = 0; rab_id = pc5s_header->rb_id % LTE_maxDRB; - ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; + ctxt.rntiMaybeUEid = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; } //UE if (!ctxt.enb_flag) { if (rab_id != 0) { if (rab_id == UE_IP_DEFAULT_RAB_ID) { - LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag); - key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); + key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); - LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n", - (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); + LOG_D(PDCP, "request key %x : (%d,%lx,%d,%ld)\n", (uint8_t)key, ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id); } else { rab_id = rab_id % LTE_maxDRB; - LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n", - ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); - key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%lx, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); - LOG_I(PDCP,"request key %x : (%d,%x,%d,%ld)\n", - (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); + LOG_I(PDCP, "request key %x : (%d,%lx,%d,%ld)\n", (uint8_t)key, ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag, rab_id); } if (h_rc == HASH_TABLE_OK) { @@ -703,18 +722,19 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) pc5s_header->inst, bytes_received, pc5s_header->rb_id); - LOG_I(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %ld]\n", + LOG_I(PDCP, + "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %lu][RB %ld]\n", ctxt.frame, pc5s_header->inst, pc5s_header->rb_id, pc5s_header->data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id); - /* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure - * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and - * gcc, from v9, now warns about it. fix these warnings by using local variables - */ + /* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure + * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and + * gcc, from v9, now warns about it. fix these warnings by using local variables + */ uint32_t sourceL2Id = pc5s_header->sourceL2Id; uint32_t destinationL2Id = pc5s_header->destinationL2Id; pdcp_data_req( @@ -733,25 +753,26 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) pc5s_header->destinationL2Id=destinationL2Id; } else { /* else of h_rc == HASH_TABLE_OK */ LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", + "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %lu][RB %ld] NON INSTANCIATED INSTANCE key 0x%" PRIx64 ", DROPPED\n", ctxt.frame, pc5s_header->inst, pc5s_header->rb_id, pc5s_header->data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, rab_id, key); } } else { /* else of if (rab_id == 0) */ LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n", + LOG_D(PDCP, + "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %lu][RB DEFAULT_RAB_ID %u]\n", ctxt.frame, pc5s_header->inst, pc5s_header->rb_id, pc5s_header->data_size, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, DEFAULT_RAB_ID); /* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp.h b/openair2/LAYER2/nr_pdcp/nr_pdcp.h index 94939a0421..215ae8a03c 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp.h @@ -20,11 +20,12 @@ */ #include +#include "openair2/COMMON/platform_types.h" #ifndef _NR_PDCP_H_ #define _NR_PDCP_H_ void nr_pdcp_layer_init_ue(void); -void nr_DRB_preconfiguration(uint16_t crnti); +void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid); #endif /* _NR_PDCP_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index c12256de7a..ec76a598ac 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -24,6 +24,7 @@ #include #include +#include "openair2/COMMON/platform_types.h" #include "nr_pdcp_sdu.h" #include "openair2/RRC/NR/rrc_gNB_radio_bearers.h" @@ -184,6 +185,6 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( unsigned char *ciphering_key, unsigned char *integrity_key); -void nr_DRB_preconfiguration(uint16_t crnti); +void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid); #endif /* _NR_PDCP_ENTITY_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d0be2223db..876def5499 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -242,7 +242,7 @@ static void do_pdcp_data_ind( { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - int rnti = ctxt_pP->rnti; + ue_id_t rntiMaybeUEid = ctxt_pP->rntiMaybeUEid; if (ctxt_pP->module_id != 0 || //ctxt_pP->enb_flag != 1 || @@ -254,11 +254,10 @@ static void do_pdcp_data_ind( } if (ctxt_pP->enb_flag) - T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rnti), - T_INT(rb_id), T_INT(sdu_buffer_size)); + T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rntiMaybeUEid), T_INT(rb_id), T_INT(sdu_buffer_size)); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); if (srb_flagP == 1) { if (rb_id < 1 || rb_id > 2) @@ -406,8 +405,8 @@ 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 rntiMaybeUEid; int rb_id = 1; pthread_setname_np( pthread_self(),"enb_tun_read"); @@ -422,10 +421,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); + const bool has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &rntiMaybeUEid); 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,16 +433,13 @@ static void *enb_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - - ctxt.rnti = rnti; + ctxt.rntiMaybeUEid = rntiMaybeUEid; uint8_t qfi = 7; bool rqi = 0; int pdusession_id = 10; - sdap_data_req(&ctxt, 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); + sdap_data_req(&ctxt, rntiMaybeUEid, 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); } return NULL; @@ -454,8 +450,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 rntiMaybeUEid; + int has_ue; int rb_id = 1; pthread_setname_np( pthread_self(),"ue_tun_read"); @@ -469,10 +466,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, &rntiMaybeUEid); 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,16 +478,13 @@ static void *ue_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - - ctxt.rnti = rnti; + ctxt.rntiMaybeUEid = rntiMaybeUEid; 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, - RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, - PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, nas_qfi, dc, nas_pduid); + sdap_data_req(&ctxt, rntiMaybeUEid, 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); } return NULL; @@ -621,15 +615,8 @@ 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); - sdap_data_ind(entity->rb_id, - entity->is_gnb, - entity->has_sdap, - entity->has_sdapULheader, - entity->pdusession_id, - ue->rnti, - buf, - size); + LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid); + sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap, entity->has_sdapULheader, entity->pdusession_id, ue->rntiMaybeUEid, buf, size); } else{ for (i = 0; i < MAX_DRBS_PER_UE; i++) { @@ -639,21 +626,13 @@ 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); + LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); exit(1); rb_found: { LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size); - sdap_data_ind(rb_id, - ue->drb[rb_id-1]->is_gnb, - ue->drb[rb_id-1]->has_sdap, - ue->drb[rb_id-1]->has_sdapULheader, - ue->drb[rb_id-1]->pdusession_id, - ue->rnti, - buf, - size); + sdap_data_ind(rb_id, ue->drb[rb_id - 1]->is_gnb, ue->drb[rb_id - 1]->has_sdap, ue->drb[rb_id - 1]->has_sdapULheader, ue->drb[rb_id - 1]->pdusession_id, ue->rntiMaybeUEid, buf, size); } } } @@ -674,8 +653,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); + LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); exit(1); rb_found: @@ -687,23 +665,23 @@ rb_found: ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rnti = ue->rnti; + ctxt.rntiMaybeUEid = ue->rntiMaybeUEid; 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->rntiMaybeUEid; + 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; @@ -733,8 +711,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); + LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); exit(1); srb_found: @@ -742,7 +719,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->rntiMaybeUEid; ul_rrc->srb_id = srb_id; ul_rrc->rrc_container = malloc(size); AssertFatal(ul_rrc->rrc_container != NULL, "OUT OF MEMORY\n"); @@ -758,7 +735,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->rntiMaybeUEid; itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); } } @@ -779,8 +756,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); + LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); exit(1); srb_found: @@ -798,7 +774,7 @@ srb_found: ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rnti = ue->rnti; + ctxt.rntiMaybeUEid = ue->rntiMaybeUEid; memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); @@ -813,7 +789,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->rntiMaybeUEid; 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; @@ -826,16 +802,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) { MessageDef *msg_p; int result; - protocol_ctxt_t ctxt={.module_id=0, - .enb_flag=1, - .instance=0, - .rnti=0, - .frame=-1, - .subframe=-1, - .eNB_index=0, - .brOption=false - }; - + protocol_ctxt_t ctxt = {.module_id = 0, .enb_flag = 1, .instance = 0, .rntiMaybeUEid = 0, .frame = -1, .subframe = -1, .eNB_index = 0, .brOption = false}; while (1) { itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); @@ -875,11 +842,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) } } -static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s, - int ciphering_algorithm, - int integrity_algorithm, - unsigned char *ciphering_key, - unsigned char *integrity_key) +static void add_srb(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_SRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, unsigned char *ciphering_key, unsigned char *integrity_key) { nr_pdcp_entity_t *pdcp_srb; nr_pdcp_ue_t *ue; @@ -891,10 +854,9 @@ static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s, else t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); if (ue->srb[srb_id-1] != NULL) { - LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n", - __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid); } else { pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, 0, 0, 0, 0, // sdap parameters @@ -906,16 +868,12 @@ static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s, integrity_key); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); - LOG_D(PDCP, "%s:%d:%s: added srb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_D(PDCP, "%s:%d:%s: added srb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } -static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, - int ciphering_algorithm, - int integrity_algorithm, - unsigned char *ciphering_key, - unsigned char *integrity_key) +void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_DRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, unsigned char *ciphering_key, unsigned char *integrity_key) { nr_pdcp_entity_t *pdcp_drb; nr_pdcp_ue_t *ue; @@ -983,10 +941,9 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); if (ue->drb[drb_id-1] != NULL) { - LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", - __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); + LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid); } else { pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap, has_sdapULheader,has_sdapDLheader, @@ -998,21 +955,16 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, has_integrity ? integrity_key : NULL); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); - LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); + LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid); - new_nr_sdap_entity(is_gnb, - has_sdap, - rnti, - pdusession_id, - is_sdap_DefaultDRB, - drb_id, - mappedQFIs2Add, - mappedQFIs2AddCount); + new_nr_sdap_entity(is_gnb, has_sdap, rntiMaybeUEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } -static void add_drb(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, +static void add_drb(int is_gnb, + ue_id_t rntiMaybeUEid, + struct NR_DRB_ToAddMod *s, NR_RLC_Config_t *rlc_Config, int ciphering_algorithm, int integrity_algorithm, @@ -1021,89 +973,53 @@ static void add_drb(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, { switch (rlc_Config->present) { case NR_RLC_Config_PR_am: - add_drb_am(is_gnb, rnti, s, ciphering_algorithm, integrity_algorithm, - ciphering_key, integrity_key); + add_drb_am(is_gnb, rntiMaybeUEid, s, ciphering_algorithm, integrity_algorithm, ciphering_key, integrity_key); break; case NR_RLC_Config_PR_um_Bi_Directional: - //add_drb_um(rnti, s); + // add_drb_um(rntiMaybeUEid, s); /* hack */ - add_drb_am(is_gnb, rnti, s, ciphering_algorithm, integrity_algorithm, - ciphering_key, integrity_key); + add_drb_am(is_gnb, rntiMaybeUEid, s, ciphering_algorithm, integrity_algorithm, ciphering_key, integrity_key); break; default: LOG_E(PDCP, "%s:%d:%s: fatal: unhandled DRB type\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - LOG_I(PDCP, "%s:%s:%d: added DRB for UE RNTI %x\n", __FILE__, __FUNCTION__, __LINE__, rnti); + LOG_I(PDCP, "%s:%s:%d: added DRB for UE ID/RNTI %ld\n", __FILE__, __FUNCTION__, __LINE__, rntiMaybeUEid); } -bool nr_rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, - NR_SRB_ToAddModList_t *const srb2add_list, - NR_DRB_ToAddModList_t *const drb2add_list, - NR_DRB_ToReleaseList_t *const drb2release_list, - const uint8_t security_modeP, - uint8_t *const kRRCenc, - uint8_t *const kRRCint, - uint8_t *const kUPenc, - uint8_t *const kUPint, - LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9, - rb_id_t *const defaultDRB, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list) +void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kRRCint) { - int rnti = ctxt_pP->rnti; - int i; - - if (//ctxt_pP->enb_flag != 1 || - ctxt_pP->module_id != 0 || - ctxt_pP->instance != 0 || - ctxt_pP->eNB_index != 0 || - //ctxt_pP->configured != 2 || - //srb2add_list == NULL || - //drb2add_list != NULL || - //drb2release_list != NULL || - //security_modeP != 255 || - //kRRCenc != NULL || - //kRRCint != NULL || - //kUPenc != NULL || - pmch_InfoList_r9 != NULL /*|| - defaultDRB != NULL */) { - LOG_I(PDCP,"Releasing DRBs, oops\n"); - TODO; - } - if (srb2add_list != NULL) { - for (i = 0; i < srb2add_list->list.count; i++) { - add_srb(ctxt_pP->enb_flag,rnti, srb2add_list->list.array[i], - security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, - kRRCenc, kRRCint); + for (int i = 0; i < srb2add_list->list.count; i++) { + add_srb(enb_flag, rntiMaybeUEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint); } - } + } else + LOG_W(PDCP, "nr_pdcp_add_srbs() with void list\n"); + if (kRRCenc) + free(kRRCenc); + if (kRRCint) + free(kRRCint); +} +void nr_pdcp_add_drbs(eNB_flag_t enb_flag, + ue_id_t rntiMaybeUEid, + NR_DRB_ToAddModList_t *const drb2add_list, + const uint8_t security_modeP, + uint8_t *const kUPenc, + uint8_t *const kUPint, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list) +{ if (drb2add_list != NULL) { - for (i = 0; i < drb2add_list->list.count; i++) { - add_drb(ctxt_pP->enb_flag, rnti, drb2add_list->list.array[i], - rlc_bearer2add_list->list.array[i]->rlc_Config, - security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, - kUPenc, kUPint); + for (int i = 0; i < drb2add_list->list.count; i++) { + add_drb(enb_flag, rntiMaybeUEid, drb2add_list->list.array[i], rlc_bearer2add_list->list.array[i]->rlc_Config, security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kUPenc, kUPint); } - } - - /* update security */ - if (kRRCint != NULL) { - /* todo */ - } - - if (drb2release_list != NULL) { - // TODO - } - - free(kRRCenc); - free(kRRCint); - free(kUPenc); - free(kUPint); - - return 0; + } else + LOG_W(PDCP, "nr_pdcp_add_drbs() with void list\n"); + if (kUPenc) + free(kUPenc); + if (kUPint) + free(kUPint); } /* Dummy function due to dependency from LTE libraries */ @@ -1121,7 +1037,7 @@ bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, return 0; } -void nr_DRB_preconfiguration(uint16_t crnti) +void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid) { NR_RadioBearerConfig_t *rbconfig = NULL; @@ -1185,25 +1101,13 @@ void nr_DRB_preconfiguration(uint16_t crnti) ASN_SEQUENCE_ADD(&Rlc_Bearer_ToAdd_list->list, RLC_BearerConfig); if (ENB_NAS_USE_TUN){ - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, crnti, 0, 0, 0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_YES, crntiMaybeUEid, 0, 0, 0); } else{ - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, crnti, 0, 0,0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, crntiMaybeUEid, 0, 0, 0); } - nr_rrc_pdcp_config_asn1_req( - &ctxt, - (NR_SRB_ToAddModList_t *) NULL, - rbconfig->drb_ToAddModList , - rbconfig->drb_ToReleaseList, - 0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - Rlc_Bearer_ToAdd_list); + nr_pdcp_add_drbs(ctxt.enb_flag, ctxt.rntiMaybeUEid, rbconfig->drb_ToAddModList, 0, NULL, NULL, Rlc_Bearer_ToAdd_list); nr_rrc_rlc_config_asn1_req (&ctxt, (NR_SRB_ToAddModList_t *) NULL, @@ -1212,8 +1116,7 @@ void nr_DRB_preconfiguration(uint16_t crnti) (LTE_PMCH_InfoList_r9_t *) NULL, Rlc_Bearer_ToAdd_list); - LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); - + LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE ID/RNTI %ld\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid); } uint64_t get_pdcp_optmask(void) @@ -1223,10 +1126,10 @@ uint64_t get_pdcp_optmask(void) bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) { - int rnti = ctxt_pP->rnti; + ue_id_t rntiMaybeUEid = ctxt_pP->rntiMaybeUEid; nr_pdcp_manager_lock(nr_pdcp_ue_manager); - nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager, rnti); + nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager, rntiMaybeUEid); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 1; @@ -1244,13 +1147,13 @@ void pdcp_config_set_security( { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - int rnti = ctxt_pP->rnti; + ue_id_t ue_id = ctxt_pP->rntiMaybeUEid; int integrity_algorithm; int ciphering_algorithm; nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); /* TODO: proper handling of DRBs, for the moment only SRBs are handled */ @@ -1258,8 +1161,7 @@ void pdcp_config_set_security( rb = ue->srb[rb_id - 1]; if (rb == NULL) { - LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n", - __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + LOG_E(PDCP, "%s:%d:%s: no SRB found (ue_id %ld, rb_id %ld)\n", __FILE__, __LINE__, __FUNCTION__, ue_id, rb_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return; } @@ -1287,7 +1189,7 @@ static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP, LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size); nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - int rnti = ctxt_pP->rnti; + ue_id_t ue_id = ctxt_pP->rntiMaybeUEid; if (ctxt_pP->module_id != 0 || //ctxt_pP->enb_flag != 1 || @@ -1301,7 +1203,7 @@ static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP, nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); if (rb_id < 1 || rb_id > 2) rb = NULL; @@ -1309,8 +1211,7 @@ static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP, rb = ue->srb[rb_id - 1]; if (rb == NULL) { - LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n", - __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + LOG_E(PDCP, "%s:%d:%s: no SRB found (ue_id %ld, rb_id %ld)\n", __FILE__, __LINE__, __FUNCTION__, ue_id, rb_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 0; } @@ -1333,7 +1234,7 @@ static bool pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size); nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - int rnti = ctxt_pP->rnti; + ue_id_t ue_id = ctxt_pP->rntiMaybeUEid; if (ctxt_pP->module_id != 0 || //ctxt_pP->enb_flag != 1 || @@ -1347,7 +1248,7 @@ static bool pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); if (rb_id < 1 || rb_id > MAX_DRBS_PER_UE) rb = NULL; @@ -1355,8 +1256,7 @@ static bool pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, rb = ue->drb[rb_id - 1]; if (rb == NULL) { - LOG_E(PDCP, "%s:%d:%s: no DRB found (rnti %d, rb_id %ld)\n", - __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + LOG_E(PDCP, "%s:%d:%s: no DRB found (ue_id %ld, rb_id %ld)\n", __FILE__, __LINE__, __FUNCTION__, ue_id, rb_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 0; } @@ -1448,18 +1348,14 @@ nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager() { } /* returns false in case of error, true if everything ok */ -const bool nr_pdcp_get_statistics( - int rnti, - int srb_flag, - int rb_id, - nr_pdcp_statistics_t *out) +const bool nr_pdcp_get_statistics(ue_id_t ue_id, int srb_flag, int rb_id, nr_pdcp_statistics_t *out) { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; bool ret; nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); if (srb_flag == 1) { if (rb_id < 1 || rb_id > 2) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c index 1f21593c63..5d28872854 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 #include #include +#include #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 rntiMaybeUEid) { /* 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]->rntiMaybeUEid == rntiMaybeUEid) 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 ID/RNTI 0x%" PRIx64 "\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid); 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]->rntiMaybeUEid = rntiMaybeUEid; 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 rntiMaybeUEid) { nr_pdcp_ue_manager_internal_t *m = _m; nr_pdcp_ue_t *ue; @@ -113,13 +114,11 @@ 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]->rntiMaybeUEid == rntiMaybeUEid) break; if (i == m->ue_count) { - LOG_D(PDCP, "%s:%d:%s: warning: ue %d not found\n", - __FILE__, __LINE__, __FUNCTION__, - rnti); + LOG_D(PDCP, "%s:%d:%s: warning: UE ID/RNTI 0x%" PRIx64 " not found\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid); return; } @@ -203,10 +202,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) +bool 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 false; + *ret = m->ue_list[0]->rntiMaybeUEid; + return true; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index a3a6e076d7..0d26e1f3ec 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 rntiMaybeUEid; 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 rntiMaybeUEid); +void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t rntiMaybeUEid); 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 */ +bool 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 e505779910..af6bbf45d4 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -361,7 +361,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const uint32_t *const destinationL2Id ) { - int rnti = ctxt_pP->rnti; + int rnti = ctxt_pP->rntiMaybeUEid; nr_rlc_ue_t *ue; nr_rlc_entity_t *rb; @@ -370,8 +370,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, MBMS_flagP); if (ctxt_pP->enb_flag) - T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); + T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); nr_rlc_manager_lock(nr_rlc_ue_manager); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); @@ -506,7 +505,7 @@ rb_found: /* used fields? */ ctx.module_id = 0; - ctx.rnti = ue->rnti; + ctx.rntiMaybeUEid = ue->rnti; is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager); ctx.enb_flag = is_enb; @@ -539,15 +538,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); @@ -961,7 +960,7 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list) { - int rnti = ctxt_pP->rnti; + int rnti = ctxt_pP->rntiMaybeUEid; int i; int j; @@ -1109,8 +1108,8 @@ rlc_op_status_t rrc_rlc_config_req ( exit(1); } nr_rlc_manager_lock(nr_rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rnti); - ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rnti); + LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE RNTI %lx\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); + ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); if (srb_flagP) { if (ue->srb[rb_idP-1] != NULL) { ue->srb[rb_idP-1]->delete(ue->srb[rb_idP-1]); @@ -1133,7 +1132,7 @@ rlc_op_status_t rrc_rlc_config_req ( if (ue->drb[i] != NULL) break; if (i == MAX_DRBS_PER_UE) - nr_rlc_manager_remove_ue(nr_rlc_ue_manager, ctxt_pP->rnti); + nr_rlc_manager_remove_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); } nr_rlc_manager_unlock(nr_rlc_ue_manager); return RLC_OP_STATUS_OK; @@ -1154,7 +1153,7 @@ void nr_rlc_remove_ue(int rnti) rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) { - nr_rlc_remove_ue(x->rnti); + nr_rlc_remove_ue(x->rntiMaybeUEid); return RLC_OP_STATUS_OK; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index b6ce072789..92d20d1aca 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 914484c1b6..d0ab6a0632 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -278,7 +278,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const uint32_t *const destinationL2Id ) { - int rnti = ctxt_pP->rnti; + int rnti = ctxt_pP->rntiMaybeUEid; rlc_ue_t *ue; rlc_entity_t *rb; @@ -290,8 +290,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, MBMS_flagP); if (ctxt_pP->enb_flag) - T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); + T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); rlc_manager_lock(rlc_ue_manager); ue = rlc_manager_get_ue(rlc_ue_manager, rnti); @@ -404,7 +403,7 @@ rb_found: /* used fields? */ ctx.module_id = ue->module_id; - ctx.rnti = ue->rnti; + ctx.rntiMaybeUEid = ue->rnti; is_enb = rlc_manager_get_enb_flag(rlc_ue_manager); ctx.enb_flag = is_enb; @@ -431,14 +430,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; @@ -834,7 +833,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP const uint32_t destinationL2Id ) { - int rnti = ctxt_pP->rnti; + int rnti = ctxt_pP->rntiMaybeUEid; int module_id = ctxt_pP->module_id; int i; int j; @@ -979,8 +978,8 @@ rlc_op_status_t rrc_rlc_config_req ( exit(1); } rlc_manager_lock(rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %d (is_srb %d) for UE %d\n", __FILE__, __LINE__, __FUNCTION__, (int)rb_idP, srb_flagP, ctxt_pP->rnti); - ue = rlc_manager_get_ue(rlc_ue_manager, ctxt_pP->rnti); + LOG_D(RLC, "%s:%d:%s: remove rb %d (is_srb %d) for UE %ld\n", __FILE__, __LINE__, __FUNCTION__, (int)rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); + ue = rlc_manager_get_ue(rlc_ue_manager, ctxt_pP->rntiMaybeUEid); if (srb_flagP) { if (ue->srb[rb_idP-1] != NULL) { ue->srb[rb_idP-1]->delete(ue->srb[rb_idP-1]); @@ -1003,7 +1002,7 @@ rlc_op_status_t rrc_rlc_config_req ( if (ue->drb[i] != NULL) break; if (i == 5) - rlc_manager_remove_ue(rlc_ue_manager, ctxt_pP->rnti); + rlc_manager_remove_ue(rlc_ue_manager, ctxt_pP->rntiMaybeUEid); } rlc_manager_unlock(rlc_ue_manager); return RLC_OP_STATUS_OK; @@ -1016,9 +1015,9 @@ void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t r rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) { - LOG_D(RLC, "%s:%d:%s: remove UE %d\n", __FILE__, __LINE__, __FUNCTION__, x->rnti); + LOG_D(RLC, "%s:%d:%s: remove UE %ld\n", __FILE__, __LINE__, __FUNCTION__, x->rntiMaybeUEid); rlc_manager_lock(rlc_ue_manager); - rlc_manager_remove_ue(rlc_ue_manager, x->rnti); + rlc_manager_remove_ue(rlc_ue_manager, x->rntiMaybeUEid); rlc_manager_unlock(rlc_ue_manager); return RLC_OP_STATUS_OK; diff --git a/openair2/MCE_APP/mce_app.c b/openair2/MCE_APP/mce_app.c index dcc79ca2a6..fb52002bf3 100644 --- a/openair2/MCE_APP/mce_app.c +++ b/openair2/MCE_APP/mce_app.c @@ -40,8 +40,7 @@ # include "intertask_interface.h" # include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# include "gtpv1u_eNB_task.h" +#include "sctp_eNB_task.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index 660bd91dda..21ecc07b05 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -80,7 +80,7 @@ rrc_data_req( //memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; - RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_REQ(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task ( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, @@ -113,13 +113,7 @@ rrc_data_ind( LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n", ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index); } else { - LOG_D(RRC, "[eNB %d] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from UE %x\n", - ctxt_pP->module_id, - ctxt_pP->frame, - DCCH_index, - Srb_id, - sdu_sizeP, - ctxt_pP->rnti); + LOG_D(RRC, "[eNB %d] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from UE %lx\n", ctxt_pP->module_id, ctxt_pP->frame, DCCH_index, Srb_id, sdu_sizeP, ctxt_pP->rntiMaybeUEid); } { @@ -133,7 +127,7 @@ rrc_data_ind( RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; - RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id; RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p); diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index 850ecf1b58..71f9abc63e 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -292,7 +292,7 @@ rrc_data_req_ue( RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; - RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_REQ(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task ( TASK_PDCP_UE, @@ -326,7 +326,7 @@ rrc_data_ind_ue( RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; - RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id; RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task (TASK_RRC_UE, ctxt_pP->instance, message_p); diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index e5024e3505..263eee2a10 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -3211,16 +3211,10 @@ uint8_t do_SecurityModeCommand( return -1; } - LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(RRC, "[eNB %d] securityModeCommand for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(RRC, "[eNB %d] ASN1 : securityModeCommand encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } @@ -3334,16 +3328,10 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, return -1; } - LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(RRC, "[eNB %d] UECapabilityRequest for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(RRC, "[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } @@ -3455,16 +3443,10 @@ uint8_t do_NR_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, return -1; } - LOG_D(RRC,"[eNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(RRC, "[eNB %d] NR UECapabilityRequest for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(RRC,"[eNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(RRC, "[eNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c index d13dcb9918..1f6a578a8a 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c @@ -758,16 +758,10 @@ uint8_t do_SecurityModeCommand_NB_IoT( enc_rval.failed_type->name, enc_rval.encoded); } - LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(RRC, "[NB-IoT %d] securityModeCommand-NB for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(RRC,"[NB-IoT %d] ASN1 : securityModeCommand-NB encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(RRC, "[NB-IoT %d] ASN1 : securityModeCommand-NB encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } @@ -811,17 +805,10 @@ uint8_t do_UECapabilityEnquiry_NB_IoT( enc_rval.failed_type->name, enc_rval.encoded); } - LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); - + LOG_D(RRC, "[NB-IoT %d] UECapabilityEnquiry-NB for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(RRC,"[NB-IoT %d] ASN1 : UECapabilityEnquiry-NB encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(RRC, "[NB-IoT %d] ASN1 : UECapabilityEnquiry-NB encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index ebd0ed7f5b..2773e63ab3 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -548,7 +548,7 @@ static void rrc_ue_generate_RRCConnectionSetupComplete( LOG_D(RLC, "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH); - ctxt_pP_local.rnti = ctxt_pP->rnti; + ctxt_pP_local.rntiMaybeUEid = ctxt_pP->rntiMaybeUEid; rrc_data_req_ue ( ctxt_pP, DCCH, @@ -648,11 +648,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *co break; case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: - LOG_A(RRC, - "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti); + LOG_A(RRC, "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %lx\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rntiMaybeUEid); // Get configuration // Release T300 timer UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T300_active = 0; @@ -662,7 +658,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *co &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated); rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rnti; + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rntiMaybeUEid; rrc_ue_generate_RRCConnectionSetupComplete( ctxt_pP, eNB_index, @@ -1546,8 +1542,7 @@ rrc_ue_process_securityModeCommand( pdcp_t *pdcp_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, - ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p); if (h_rc == HASH_TABLE_OK) { @@ -2047,7 +2042,7 @@ rrc_ue_process_rrcConnectionReconfiguration( message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_CONNECTION_REESTABLISHMENT_IND); memset(&connection_reestablishment_ind, 0, sizeof(rrc_ral_connection_reestablishment_ind_t)); // TO DO ral_si_ind.plmn_id = 0; - connection_reestablishment_ind.ue_id = ctxt_pP->rnti; + connection_reestablishment_ind.ue_id = ctxt_pP->rntiMaybeUEid; if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList != NULL) { connection_reestablishment_ind.num_drb = diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index f9d314f992..07c90f74eb 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 #include "intertask_interface.h" @@ -703,9 +703,7 @@ rrc_eNB_get_next_free_ue_context( //----------------------------------------------------------------------------- { struct rrc_eNB_ue_context_s *ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ue_context_p == NULL) { ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); @@ -717,8 +715,8 @@ rrc_eNB_get_next_free_ue_context( return NULL; } - ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed + ue_context_p->ue_id_rnti = ctxt_pP->rntiMaybeUEid; // here ue_id_rnti is just a key, may be something else + ue_context_p->ue_context.rnti = ctxt_pP->rntiMaybeUEid; // yes duplicate, 1 may be removed ue_context_p->ue_context.random_ue_identity = ue_identityP; RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); LOG_D(RRC, @@ -1104,11 +1102,7 @@ rrc_eNB_process_RRCConnectionSetupComplete( ue_context_pP->ue_context.Srb1.Active = 1; ue_context_pP->ue_context.StatusRrc = RRC_CONNECTED; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity timer when UE goes into RRC_CONNECTED - T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, - T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), - T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); if (EPC_MODE_ENABLED == 1) { // Forward message to S1AP layer @@ -1129,8 +1123,7 @@ rrc_eNB_generate_SecurityModeCommand( { uint8_t buffer[100]={0}; uint8_t size; - T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); size = do_SecurityModeCommand( ctxt_pP, buffer, @@ -1172,8 +1165,7 @@ rrc_eNB_generate_UECapabilityEnquiry( { uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_UECapabilityEnquiry( @@ -1213,8 +1205,7 @@ rrc_eNB_generate_NR_UECapabilityEnquiry( { uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_NR_UECapabilityEnquiry( @@ -1253,8 +1244,7 @@ rrc_eNB_generate_RRCConnectionReject( ) //----------------------------------------------------------------------------- { - T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionReject(ctxt_pP->module_id, @@ -1287,7 +1277,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( rrc_eNB_carrier_data_t *carrier = NULL; eNB_RRC_UE_t *ue_context = NULL; module_id_t module_id = ctxt_pP->module_id; - uint16_t rnti = ctxt_pP->rnti; + uint16_t rnti = ctxt_pP->rntiMaybeUEid; T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(module_id), T_INT(ctxt_pP->frame), @@ -1374,8 +1364,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing LTE_RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LTE_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList; LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; @@ -1481,7 +1470,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&rrc_ue_s1ap_ids_p); if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; } } @@ -1489,7 +1478,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_s1ap_ids_p); if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; } } @@ -1508,7 +1497,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } } - create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above + create_tunnel_req.rnti = ctxt_pP->rntiMaybeUEid; // warning put zero above create_tunnel_req.num_tunnels = j; ret = gtpv1u_update_s1u_tunnel( ctxt_pP->instance, @@ -1542,14 +1531,14 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( ue_context_pP->ue_context.ul_failure_timer = 20000; // set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ rrc_eNB_free_UE(ctxt_pP->module_id,ue_context_pP); ue_context_pP->ue_context.ul_failure_timer = 0; - put_UE_in_freelist(ctxt_pP->module_id, ctxt_pP->rnti, 0); + put_UE_in_freelist(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, 0); return; } } /* EPC_MODE_ENABLED */ /* Update RNTI in ue_context */ - ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_pP->ue_context.rnti = ctxt_pP->rnti; + ue_context_pP->ue_id_rnti = ctxt_pP->rntiMaybeUEid; // here ue_id_rnti is just a key, may be something else + ue_context_pP->ue_context.rnti = ctxt_pP->rntiMaybeUEid; if (EPC_MODE_ENABLED) { uint8_t send_security_mode_command = false; @@ -1945,20 +1934,17 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( //----------------------------------------------------------------------------- { if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if(UE_id != -1) { RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20; } else { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishmentReject without UE_id(MAC) rnti %x\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT " Generating LTE_RRCConnectionReestablishmentReject without UE_id(MAC) rnti %lx\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid); } } - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; ue_p->Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, @@ -1988,7 +1974,7 @@ void rrc_generate_SgNBReleaseRequest( // X2AP_ENDC_SGNB_RELEASE_REQ(msg).target_physCellId = ; LOG_I(RRC, "[eNB %d] frame %d UE rnti %x transmitting sgnb release request to sgnb \n", - ctxt_pP->module_id,ctxt_pP->frame,ctxt_pP->rnti); + ctxt_pP->module_id,ctxt_pP->frame,ctxt_pP->rntiMaybeUEid); itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); return; } @@ -2008,8 +1994,7 @@ rrc_eNB_generate_RRCConnectionRelease( uint8_t buffer[RRC_BUF_SIZE]={0}; uint16_t size = 0; int release_num; - T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); #if 0 if(ue_context_pP != NULL) { @@ -2044,14 +2029,10 @@ rrc_eNB_generate_RRCConnectionRelease( rrc_release_info.RRC_release_ctrl[release_num].flag = 2; } - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rnti; + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rntiMaybeUEid; rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = rrc_eNB_mui; rrc_release_info.num_UEs++; - LOG_D(RRC, "Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n", - release_num, - ctxt_pP->rnti, - rrc_eNB_mui, - rrc_release_info.RRC_release_ctrl[release_num].flag); + LOG_D(RRC, "Generate DLSCH Release send: index %d rnti %lx mui %d flag %d \n", release_num, ctxt_pP->rntiMaybeUEid, rrc_eNB_mui, rrc_release_info.RRC_release_ctrl[release_num].flag); break; } } @@ -2066,7 +2047,7 @@ rrc_eNB_generate_RRCConnectionRelease( if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); - F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rntiMaybeUEid; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = buffer; @@ -2730,11 +2711,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, uint8_t cc_id = ue_context_pP->ue_context.primaryCC_id; LTE_UE_EUTRA_Capability_t *UEcap = ue_context_pP->ue_context.UE_Capability; - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, - T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), - T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); /* Configure SRB2 */ SRB_configList2 = &(ue_context_pP->ue_context.SRB_configList2[xid]); @@ -3589,8 +3566,7 @@ rrc_eNB_process_MeasurementReport( uint8_t KeNB_star[32] = { 0 }; char enc_buf[ASN_MAX_ENCODE_SIZE] = {0}; int enc_size = 0; - T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); if (measResults2 == NULL ) return; @@ -3639,10 +3615,20 @@ rrc_eNB_process_MeasurementReport( ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, - ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, - ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); + LOG_D(RRC, + "[eNB %d]Frame %d: UE %lx (Measurement Id %d): RSRP of Source %ld\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rntiMaybeUEid, + (int)measResults2->measId, + ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult - 140); + LOG_D(RRC, + "[eNB %d]Frame %d: UE %lx (Measurement Id %d): RSRQ of Source %ld\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rntiMaybeUEid, + (int)measResults2->measId, + ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult / 2 - 20); } /* TODO: improve NR triggering */ @@ -3664,7 +3650,7 @@ rrc_eNB_process_MeasurementReport( msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ); memset(&(X2AP_ENDC_SGNB_ADDITION_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_addition_req_t)); - X2AP_ENDC_SGNB_ADDITION_REQ(msg).rnti = ctxt_pP->rnti; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).rnti = ctxt_pP->rntiMaybeUEid; X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.encryption_algorithms = ue_context_pP->ue_context.nr_security.ciphering_algorithms; X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.integrity_algorithms = ue_context_pP->ue_context.nr_security.integrity_algorithms; @@ -3692,9 +3678,7 @@ rrc_eNB_process_MeasurementReport( sizeof(transport_layer_addr_t)); } - LOG_A(RRC, - "[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n", - ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->subframe, ctxt_pP->rnti); + LOG_A(RRC, "[eNB %d] frame %d subframe %d: UE rnti %lx switching to NSA mode\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->subframe, ctxt_pP->rntiMaybeUEid); itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); return; } @@ -3808,7 +3792,7 @@ rrc_eNB_process_MeasurementReport( ue_context_pP, X2AP_HANDOVER_REQ(msg).rrc_buffer, &X2AP_HANDOVER_REQ(msg).rrc_buffer_size); - X2AP_HANDOVER_REQ(msg).rnti = ctxt_pP->rnti; + X2AP_HANDOVER_REQ(msg).rnti = ctxt_pP->rntiMaybeUEid; X2AP_HANDOVER_REQ(msg).target_physCellId = measResults2->measResultNeighCells->choice. measResultListEUTRA.list.array[ncell_index]->physCellId; X2AP_HANDOVER_REQ(msg).ue_gummei.mcc = ue_context_pP->ue_context.ue_gummei.mcc; @@ -3845,8 +3829,7 @@ rrc_eNB_process_MeasurementReport( ctxt_pP->module_id, ctxt_pP->frame); itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); } else { - LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, - ctxt_pP->rnti); + LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %lx as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rntiMaybeUEid); } } @@ -4093,16 +4076,12 @@ check_handovers( { struct rrc_eNB_ue_context_s *ue_context_p; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt_pP->rnti = ue_context_p->ue_id_rnti; + ctxt_pP->rntiMaybeUEid = ue_context_p->ue_id_rnti; if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info != NULL) { /* in the source, UE in HO_PREPARE mode */ if (ue_context_p->ue_context.handover_info->state == HO_PREPARE) { - LOG_D(RRC, - "[eNB %d] Frame %d: Incoming handover detected for new UE_id %x) \n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti); + LOG_D(RRC, "[eNB %d] Frame %d: Incoming handover detected for new UE_id %lx) \n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rntiMaybeUEid); // source eNB generates rrcconnectionreconfiguration to prepare the HO LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", @@ -4351,8 +4330,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct LTE_C_RNTI_t *cba_RNTI = NULL; int measurements_enabled; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); rv[0] = (ue_context_pP->ue_context.rnti >> 8) & 255; rv[1] = ue_context_pP->ue_context.rnti & 255; LOG_I(RRC, "target UE rnti = %x (decimal: %d)\n", ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti); @@ -5357,7 +5335,7 @@ rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protoc } // Add a new user (called during the HO procedure) - LOG_I(RRC, "rrc_eNB_target_add_ue_handover module_id %d rnti %d\n", ctxt_pP->module_id, ctxt_pP->rnti); + LOG_I(RRC, "rrc_eNB_target_add_ue_handover module_id %d rnti %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); // Configure MAC for the target rrc_mac_config_req_eNB_t tmp = {0}; tmp.CC_id = ue_context_p->ue_context.primaryCC_id; @@ -5416,11 +5394,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( } /* End of CDRX processing */ - T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, - T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), - T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); /* Derive the keys from kenb */ if (DRB_configList != NULL) { @@ -5489,10 +5463,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( for (int i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE rnti %lx, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, - ctxt_pP->rnti, + ctxt_pP->rntiMaybeUEid, (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); /* For pre-ci tests */ @@ -5620,11 +5595,7 @@ rrc_eNB_generate_RRCConnectionSetup( LTE_SRB_ToAddModList_t **SRB_configList; LTE_SRB_ToAddMod_t *SRB1_config; MessageDef *message_p; - T(T_ENB_RRC_CONNECTION_SETUP, - T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), - T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); eNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; SRB_configList = &ue_p->SRB_configList; @@ -5869,7 +5840,7 @@ char openair_rrc_eNB_configuration( static void rrc_eNB_generate_RRCConnectionReestablishmentReject_unknown_UE(protocol_ctxt_t *const ctxt_pP, const int CC_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, ctxt_pP->rnti); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, ctxt_pP->rntiMaybeUEid); rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); @@ -5895,8 +5866,7 @@ rrc_eNB_decode_ccch( struct rrc_eNB_ue_context_s *ue_context_p = NULL; uint64_t random_value = 0; int stmsi_received = 0; - T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -5935,8 +5905,7 @@ rrc_eNB_decode_ccch( break; case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(buffer), buffer_length, "[MSG] RRC Connection Reestablishment Request\n"); LOG_D(RRC, @@ -6099,7 +6068,7 @@ rrc_eNB_decode_ccch( // insert C-RNTI to map for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][0] == 0) { - reestablish_rnti_map[i][0] = ctxt_pP->rnti; + reestablish_rnti_map[i][0] = ctxt_pP->rntiMaybeUEid; reestablish_rnti_map[i][1] = c_rnti; LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); @@ -6162,17 +6131,14 @@ rrc_eNB_decode_ccch( break; case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: - T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer, buffer_length, "[MSG] RRC Connection Request\n"); LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ue_context_p != NULL) { // erase content @@ -6195,8 +6161,11 @@ rrc_eNB_decode_ccch( * the current one must be removed from MAC/PHY (zombie UE) */ if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); + LOG_W(RRC, + "new UE rnti %lx (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rntiMaybeUEid, + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.rnti); ue_context_p->ue_context.ul_failure_timer = 20000; } @@ -6215,14 +6184,14 @@ rrc_eNB_decode_ccch( random_value = (((uint64_t)mme_code) << 32) | m_tmsi; if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { - LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); + LOG_I(RRC, " S-TMSI exists, ue_context_p %p, old rnti %x => %lx\n", ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rntiMaybeUEid); if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { LOG_I(PHY, "remove RNTI %04x\n", ue_context_p->ue_context.rnti); rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } else { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); - F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rntiMaybeUEid; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL; @@ -6235,8 +6204,8 @@ rrc_eNB_decode_ccch( /* for that, remove the context from the RB tree */ RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); /* and insert again, after changing rnti everywhere it has to be changed */ - ue_context_p->ue_id_rnti = ctxt_pP->rnti; - ue_context_p->ue_context.rnti = ctxt_pP->rnti; + ue_context_p->ue_id_rnti = ctxt_pP->rntiMaybeUEid; + ue_context_p->ue_context.rnti = ctxt_pP->rntiMaybeUEid; RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); /* reset timers */ ue_context_p->ue_context.ul_failure_timer = 0; @@ -6267,9 +6236,7 @@ rrc_eNB_decode_ccch( LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReject(ctxt_pP, - rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), - CC_id); + rrc_eNB_generate_RRCConnectionReject(ctxt_pP, rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid), CC_id); break; } } @@ -6305,10 +6272,10 @@ rrc_eNB_decode_ccch( random_value); if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) - rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); - F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rntiMaybeUEid; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL; @@ -6638,8 +6605,7 @@ rrc_eNB_decode_dcch( struct rrc_eNB_ue_context_s *ue_context_p = NULL; uint8_t xid; int dedicated_DRB=0; - T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); if ((Srb_id != 1) && (Srb_id != 2)) { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%ld, should not have ...\n", @@ -6676,9 +6642,7 @@ rrc_eNB_decode_dcch( return -1; } - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_c1) { switch (ul_dcch_msg->message.choice.c1.present) { @@ -6692,7 +6656,7 @@ rrc_eNB_decode_dcch( // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing measurementReport UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing measurementReport UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -6713,7 +6677,7 @@ rrc_eNB_decode_dcch( // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing LTE_RRCConnectionReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing LTE_RRCConnectionReconfigurationComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -6739,12 +6703,10 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); //clear - int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if(UE_id == -1) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT " RRCConnectionReconfigurationComplete without rnti %lx, fault\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid); break; } @@ -6759,12 +6721,10 @@ rrc_eNB_decode_dcch( RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; } } else if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION) { - int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if(UE_id == -1) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT " RRCConnectionReconfigurationComplete without rnti %lx, fault\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid); break; } @@ -6917,8 +6877,7 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Connection Reestablishment Complete\n"); LOG_I(RRC, @@ -6932,7 +6891,7 @@ rrc_eNB_decode_dcch( // select C-RNTI from map for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { + if (reestablish_rnti_map[i][0] == ctxt_pP->rntiMaybeUEid) { reestablish_rnti = reestablish_rnti_map[i][1]; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[ctxt_pP->module_id], @@ -6954,12 +6913,10 @@ rrc_eNB_decode_dcch( } //clear - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if(UE_id == -1) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT " LTE_RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %lx, fault\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid); break; } @@ -6984,7 +6941,7 @@ rrc_eNB_decode_dcch( // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing LTE_RRCConnectionSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing LTE_RRCConnectionSetupComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -7017,12 +6974,11 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete: - T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing securityModeComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -7052,8 +7008,7 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure: - T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Security Mode Failure\n"); LOG_W(RRC, @@ -7074,12 +7029,11 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing ueCapabilityInformation UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing ueCapabilityInformation UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -7100,13 +7054,13 @@ rrc_eNB_decode_dcch( xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg); } - LOG_A(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); + LOG_A(RRC, "got UE capabilities for UE %lx\n", ctxt_pP->rntiMaybeUEid); int eutra_index = -1; for (i = 0; i < ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count; i++) { if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == LTE_RAT_Type_nr) { - LOG_A(RRC, "got nrUE capabilities for UE %x\n", ctxt_pP->rnti); + LOG_A(RRC, "got nrUE capabilities for UE %lx\n", ctxt_pP->rntiMaybeUEid); if(ue_context_p->ue_context.UE_Capability_nr) { ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); ue_context_p->ue_context.UE_Capability_nr = 0; @@ -7181,7 +7135,7 @@ rrc_eNB_decode_dcch( break; if (ue_context_p->ue_context.UE_Capability) { - LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); + LOG_I(RRC, "freeing old UE capabilities for UE %lx\n", ctxt_pP->rntiMaybeUEid); ASN_STRUCT_FREE(asn_DEF_LTE_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); ue_context_p->ue_context.UE_Capability = 0; @@ -7245,17 +7199,15 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; case LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); // to avoid segmentation fault if(!ue_context_p) { - LOG_I(RRC, "Processing ulInformationTransfer UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(RRC, "Processing ulInformationTransfer UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -7272,39 +7224,32 @@ rrc_eNB_decode_dcch( break; case LTE_UL_DCCH_MessageType__c1_PR_counterCheckResponse: - T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; case LTE_UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; case LTE_UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; case LTE_UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; case LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_E(RRC, "THINH [LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10]\n"); break; case LTE_UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); break; default: - T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), __FILE__, __LINE__); @@ -7703,7 +7648,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { fd=fopen("RRC_stats.log","w+"); RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt_pP->rnti = ue_context_p->ue_id_rnti; + ctxt_pP->rntiMaybeUEid = ue_context_p->ue_id_rnti; if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0) { if (fd) { @@ -8775,7 +8720,7 @@ LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t * sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size = 2; sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf = CALLOC(1,2); sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[0] = 0x00; - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[1] = 0x01;//ctxt_pP->rnti;//rnti + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[1] = 0x01; // ctxt_pP->rntiMaybeUEid;//rnti sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.bits_unused = 0; sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = CALLOC(1,sizeof(*sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12)); //*sl_CommConfig_test->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = 12; //Msc diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 64b5594dd9..bffb3dc0c8 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -58,9 +58,7 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), create_tunnel_resp_pP->num_tunnels); rnti = create_tunnel_resp_pP->rnti; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) { ue_context_p->ue_context.enb_gtp_teid[inde_list[i]] = create_tunnel_resp_pP->enb_S1u_teid[i]; @@ -99,7 +97,7 @@ bool gtpv_data_req(const protocol_ctxt_t* const ctxt_pP, LOG_I(GTPU,"gtpv_data_req sdu_sizeP == 0"); return false; } - LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP); + LOG_D(GTPU, "gtpv_data_req ue rnti %lx sdu_sizeP %d rb id %ld", ctxt_pP->rntiMaybeUEid, sdu_sizeP, rb_idP); MessageDef *message_p; // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). uint8_t *message_buffer; @@ -122,7 +120,7 @@ bool gtpv_data_req(const protocol_ctxt_t* const ctxt_pP, GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_DATA_FORWARDING_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); @@ -145,7 +143,7 @@ bool gtpv_data_req(const protocol_ctxt_t* const ctxt_pP, GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_END_MARKER_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); @@ -171,8 +169,8 @@ bool gtpv_data_req_new(protocol_ctxt_t *ctxt, task=TASK_END_MARKER; else task=TASK_DATA_FORWARDING; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt->module_id], ctxt->rnti); + + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt->module_id], ctxt->rntiMaybeUEid); if(ue_context_p == NULL || ue_context_p->ue_context.handover_info == NULL || ue_context_p->ue_context.StatusRrc != RRC_HO_EXECUTION) { LOG_E(RRC,"incoming GTP-U for X2 in non HO context\n"); @@ -191,7 +189,7 @@ bool gtpv_data_req_new(protocol_ctxt_t *ctxt, GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + sdu_buffer_sizeP); memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], sdu_buffer_pP, sdu_buffer_sizeP); GTPV1U_ENB_END_MARKER_REQ(msg).length = sdu_buffer_sizeP; - GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt->rnti; + GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt->rntiMaybeUEid; GTPV1U_ENB_END_MARKER_REQ(msg).rab_id = rb_idP; GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe); @@ -210,7 +208,7 @@ bool gtpv_data_req_new(protocol_ctxt_t *ctxt, ue_context_p->ue_context.handover_info->state = HO_END_MARKER; gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); - delete_tunnel_req.rnti = ctxt->rnti; + delete_tunnel_req.rnti = ctxt->rntiMaybeUEid; gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req); return true; } else { diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index e50868d4af..ca1fb806dc 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 #include "RRC/LTE/rrc_eNB_GTPV1U.h" @@ -520,7 +520,7 @@ rrc_pdcp_config_security( } } - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { @@ -691,7 +691,7 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( rrc_ue_s1ap_ids_p = malloc(sizeof(*rrc_ue_s1ap_ids_p)); rrc_ue_s1ap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID; - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; h_rc = hashtable_insert(RC.rrc[ctxt_pP->module_id]->initial_id2_s1ap_ids, (hash_key_t)ue_context_pP->ue_context.ue_initial_id, rrc_ue_s1ap_ids_p); @@ -1901,7 +1901,7 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP, rrc_ue_s1ap_ids_p = malloc(sizeof(*rrc_ue_s1ap_ids_p)); rrc_ue_s1ap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID; - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; h_rc = hashtable_insert(RC.rrc[ctxt_pP->module_id]->initial_id2_s1ap_ids, (hash_key_t)ue_context_pP->ue_context.ue_initial_id, rrc_ue_s1ap_ids_p); diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 0a5a28b0cb..6ff90c20fa 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -90,7 +90,7 @@ nr_rrc_data_req( //memcpy (NR_RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP); RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; - RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_REQ(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task ( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 8180ee8b25..eb553e84b5 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1352,16 +1352,10 @@ uint8_t do_NR_SecurityModeCommand( return -1; } - LOG_D(NR_RRC,"[gNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(NR_RRC, "[gNB %d] securityModeCommand for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(NR_RRC,"[gNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(NR_RRC, "[gNB %d] ASN1 : securityModeCommand encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } @@ -1447,16 +1441,10 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, return -1; } - LOG_D(NR_RRC,"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rnti, - enc_rval.encoded, - (enc_rval.encoded+7)/8); + LOG_D(NR_RRC, "[gNB %d] NR UECapabilityRequest for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); if (enc_rval.encoded==-1) { - LOG_E(NR_RRC,"[gNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x\n", - ctxt_pP->module_id, - ctxt_pP->rnti); + LOG_E(NR_RRC, "[gNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %lx\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); return(-1); } diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9cdf3e5fe3..a8245dd66d 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/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 2cf873eadc..ea7f07965f 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -210,17 +210,13 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); -bool nr_rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, - NR_SRB_ToAddModList_t *const srb2add_list, - NR_DRB_ToAddModList_t *const drb2add_list, - NR_DRB_ToReleaseList_t *const drb2release_list, - const uint8_t security_modeP, - uint8_t *const kRRCenc, - uint8_t *const kRRCint, - uint8_t *const kUPenc, - uint8_t *const kUPint, - LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9, - rb_id_t *const defaultDRB, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); +void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kUPint); +void nr_pdcp_add_drbs(eNB_flag_t enb_flag, + ue_id_t rntiMaybeUEid, + NR_DRB_ToAddModList_t *const drb2add_list, + const uint8_t security_modeP, + uint8_t *const kUPenc, + uint8_t *const kUPint, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); #endif diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a105a3002c..d885b96143 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 @@ -314,24 +312,6 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, } -void apply_pdcp_config(rrc_gNB_ue_context_t *const ue_context_pP, - const protocol_ctxt_t *const ctxt_pP ) { - - nr_rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_pP->ue_context.SRB_configList, - NULL, - NULL, - 0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); - -} - //----------------------------------------------------------------------------- void rrc_gNB_generate_RRCSetup( @@ -342,7 +322,7 @@ rrc_gNB_generate_RRCSetup( NR_ServingCellConfigCommon_t *scc) //----------------------------------------------------------------------------- { - LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04x\n", ctxt_pP->rnti); + LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04lx\n", ctxt_pP->rntiMaybeUEid); // T(T_GNB_RRC_SETUP, // T_INT(ctxt_pP->module_id), @@ -376,7 +356,7 @@ rrc_gNB_generate_RRCSetup( ue_context_pP->ue_context.ue_release_timer_thres = 1000; /* TODO: this should go through the E1 interface */ - apply_pdcp_config(ue_context_pP,ctxt_pP); + nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL); f1ap_dl_rrc_message_t dl_rrc = { .old_gNB_DU_ue_id = 0xFFFFFF, @@ -1326,19 +1306,16 @@ rrc_gNB_process_RRCReconfigurationComplete( LOG_D(NR_RRC,"Configuring PDCP DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); - nr_rrc_pdcp_config_asn1_req(ctxt_pP, - SRB_configList, // NULL, - DRB_configList, - DRB_Release_configList2, - (ue_context_pP->ue_context.integrity_algorithm << 4) - | ue_context_pP->ue_context.ciphering_algorithm, - kRRCenc, - kRRCint, - kUPenc, - kUPint, - NULL, - NULL, - get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); + nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, SRB_configList, (ue_context_pP->ue_context.integrity_algorithm << 4) | ue_context_pP->ue_context.ciphering_algorithm, kRRCenc, kRRCint); + + nr_pdcp_add_drbs(ctxt_pP->enb_flag, + ctxt_pP->rntiMaybeUEid, + DRB_configList, + (ue_context_pP->ue_context.integrity_algorithm << 4) | ue_context_pP->ue_context.ciphering_algorithm, + kUPenc, + kUPint, + get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); + /* Refresh SRBs/DRBs */ if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); @@ -1381,12 +1358,13 @@ rrc_gNB_process_RRCReconfigurationComplete( for (int i = 0; i < DRB_configList->list.count; i++) { if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_A(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti, - (int)DRB_configList->list.array[i]->drb_Identity); - //(int)*DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel); + LOG_A(NR_RRC, + "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %lx, reconfiguring DRB %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rntiMaybeUEid, + (int)DRB_configList->list.array[i]->drb_Identity); + //(int)*DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel); if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) { ue_context_pP->ue_context.DRB_active[drb_id] = 1; @@ -1630,7 +1608,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( h_rc = hashtable_get(rrc_instance_p->ngap_id2_ngap_ids, (hash_key_t)gNB_ue_ngap_id, (void **)&rrc_ue_ngap_ids_p); if (h_rc == HASH_TABLE_OK) { - rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; } } @@ -1638,7 +1616,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( h_rc = hashtable_get(rrc_instance_p->initial_id2_ngap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_ngap_ids_p); if (h_rc == HASH_TABLE_OK) { - rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; } } @@ -1660,7 +1638,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( } } - create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above + create_tunnel_req.ue_id = ctxt_pP->rntiMaybeUEid; // warning put zero above create_tunnel_req.num_tunnels = j; ret = gtpv1u_update_ngu_tunnel( ctxt_pP->instance, @@ -1698,8 +1676,8 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( } /* Update RNTI in ue_context */ - ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_pP->ue_context.rnti = ctxt_pP->rnti; + ue_context_pP->ue_id_rnti = ctxt_pP->rntiMaybeUEid; // here ue_id_rnti is just a key, may be something else + ue_context_pP->ue_context.rnti = ctxt_pP->rntiMaybeUEid; if (get_softmodem_params()->sa) { uint8_t send_security_mode_command = false; @@ -1872,7 +1850,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, NR_RRCReestablishmentRequest_IEs_t rrcReestablishmentRequest; uint64_t random_value = 0; - LOG_I(NR_RRC, "Decoding CCCH: RNTI %04x, inst %ld, payload_size %d\n", ctxt_pP->rnti, ctxt_pP->instance, buffer_length); + LOG_I(NR_RRC, "Decoding CCCH: RNTI %04lx, inst %ld, payload_size %d\n", ctxt_pP->rntiMaybeUEid, ctxt_pP->instance, buffer_length); dec_rval = uper_decode(NULL, &asn_DEF_NR_UL_CCCH_Message, (void **) &ul_ccch_msg, buffer, buffer_length, 0, 0); if (dec_rval.code != RC_OK || dec_rval.consumed == 0) { @@ -1892,8 +1870,8 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, break; case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest: - LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti); - ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti); + LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %lx)\n", ctxt_pP->rntiMaybeUEid); + ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid); if (ue_context_p != NULL) { rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p); } else { @@ -1914,8 +1892,11 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, * the current one must be removed from MAC/PHY (zombie UE) */ if ((ue_context_p = rrc_gNB_ue_context_random_exist(RC.nrrrc[ctxt_pP->module_id], random_value))) { - LOG_W(NR_RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); + LOG_W(NR_RRC, + "new UE rnti %lx (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rntiMaybeUEid, + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.rnti); ue_context_p->ue_context.ul_failure_timer = 20000; } @@ -1937,7 +1918,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, // rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size); if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) { - LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rnti); + LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %lx\n", ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rntiMaybeUEid); // TODO: MAC structures should not be accessed directly from the RRC! An implementation using the F1 interface should be developed. gNB_MAC_INST *nrmac=RC.nrmac[ctxt_pP->module_id]; //WHAT A BEAUTIFULL RACE CONDITION !!! @@ -1947,8 +1928,8 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, /* for that, remove the context from the RB tree */ RB_REMOVE(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); /* and insert again, after changing rnti everywhere it has to be changed */ - ue_context_p->ue_id_rnti = ctxt_pP->rnti; - ue_context_p->ue_context.rnti = ctxt_pP->rnti; + ue_context_p->ue_id_rnti = ctxt_pP->rntiMaybeUEid; + ue_context_p->ue_context.rnti = ctxt_pP->rntiMaybeUEid; RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); /* reset timers */ ue_context_p->ue_context.ul_failure_timer = 0; @@ -1981,18 +1962,14 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_gNB_generate_RRCReject(ctxt_pP, - rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti)); + rrc_gNB_generate_RRCReject(ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid)); break; } ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause; - rrc_gNB_generate_RRCSetup(ctxt_pP, - rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), - du_to_cu_rrc_container, - du_to_cu_rrc_container_len, - gnb_rrc_inst->carrier.servingcellconfigcommon); + rrc_gNB_generate_RRCSetup( + ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid), du_to_cu_rrc_container, du_to_cu_rrc_container_len, gnb_rrc_inst->carrier.servingcellconfigcommon); } break; @@ -2141,7 +2118,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, // insert C-RNTI to map for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][0] == 0) { - reestablish_rnti_map[i][0] = ctxt_pP->rnti; + reestablish_rnti_map[i][0] = ctxt_pP->rntiMaybeUEid; reestablish_rnti_map[i][1] = c_rnti; LOG_D(NR_RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); @@ -2179,30 +2156,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, rrc_gNB_generate_RRCReestablishment(ctxt_pP, ue_context_p, 0); - LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - // nr_rrc_pdcp_config_asn1_req(ctxt_pP, - // ue_context_p->ue_context.SRB_configList, - // NULL, - // NULL, - // 0xff, - // NULL, - // NULL, - // NULL, - // NULL, - // NULL, - // NULL, - // NULL); - - // if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - // nr_rrc_rlc_config_asn1_req(ctxt_pP, - // ue_context_p->ue_context.SRB_configList, - // NULL, - // NULL, - // NULL, - // NULL); - // } + LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT "CALLING RLC CONFIG SRB1 (rbid %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), Idx); } break; @@ -2323,8 +2277,7 @@ rrc_gNB_decode_dcch( return -1; } - ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) { switch (ul_dcch_msg->message.choice.c1->present) { @@ -2335,9 +2288,9 @@ rrc_gNB_decode_dcch( break; case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete: - LOG_I(NR_RRC, "Receive RRC Reconfiguration Complete message UE %x\n", ctxt_pP->rnti); + LOG_I(NR_RRC, "Receive RRC Reconfiguration Complete message UE %lx\n", ctxt_pP->rntiMaybeUEid); if(!ue_context_p) { - LOG_E(NR_RRC, "Processing NR_RRCReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_E(NR_RRC, "Processing NR_RRCReconfigurationComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -2407,7 +2360,7 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete: if(!ue_context_p) { - LOG_I(NR_RRC, "Processing NR_RRCSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(NR_RRC, "Processing NR_RRCSetupComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -2492,8 +2445,8 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: LOG_I(NR_RRC,"Recived RRC GNB UL Information Transfer \n"); if(!ue_context_p) { - LOG_I(NR_RRC, "Processing ulInformationTransfer UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); - break; + LOG_I(NR_RRC, "Processing ulInformationTransfer UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); + break; } LOG_D(NR_RRC,"[MSG] RRC UL Information Transfer \n"); @@ -2510,8 +2463,8 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete: // to avoid segmentation fault if(!ue_context_p) { - LOG_I(NR_RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); - break; + LOG_I(NR_RRC, "Processing securityModeComplete UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); + break; } LOG_I(NR_RRC, @@ -2554,7 +2507,7 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: if(!ue_context_p) { - LOG_I(NR_RRC, "Processing ueCapabilityInformation UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + LOG_I(NR_RRC, "Processing ueCapabilityInformation UE %lx, ue_context_p is NULL\n", ctxt_pP->rntiMaybeUEid); break; } @@ -2573,7 +2526,7 @@ rrc_gNB_decode_dcch( if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg); } - LOG_I(NR_RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); + LOG_I(NR_RRC, "got UE capabilities for UE %lx\n", ctxt_pP->rntiMaybeUEid); int eutra_index = -1; if( ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.present == @@ -2739,7 +2692,7 @@ rrc_gNB_decode_dcch( // select C-RNTI from map for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { + if (reestablish_rnti_map[i][0] == ctxt_pP->rntiMaybeUEid) { reestablish_rnti = reestablish_rnti_map[i][1]; ue_context_p = rrc_gNB_get_ue_context( RC.nrrrc[ctxt_pP->module_id], @@ -2763,12 +2716,10 @@ rrc_gNB_decode_dcch( #if(0) /* TODO : It may be needed if gNB goes into full stack working. */ //clear - int UE_id = find_nr_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + int UE_id = find_nr_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); if(UE_id == -1) { - LOG_E(NR_RRC, - PROTOCOL_RRC_CTXT_UE_FMT" NR_RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + LOG_E(NR_RRC, PROTOCOL_RRC_CTXT_UE_FMT " NR_RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %lx, fault\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid); break; } @@ -2940,16 +2891,9 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_t instance) { NRDuDlReq_t * req=&NRDuDlReq(msg_p); - protocol_ctxt_t ctxt = { - .rnti = req->rnti, - .module_id = instance, - .instance = instance, - .enb_flag = 1, - .eNB_index = instance - }; + protocol_ctxt_t ctxt = {.rntiMaybeUEid = req->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance}; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; - struct rrc_gNB_ue_context_s *ue_context_p = - rrc_gNB_get_ue_context(rrc, ctxt.rnti); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rntiMaybeUEid); if (req->srb_id == 0) { AssertFatal(0 == 1, "should pass through dl_rrc_message()\n"); @@ -3018,23 +2962,23 @@ static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_ for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", - ctxt.module_id, - ctxt.rnti, - (int)DRB_configList->list.array[i]->drb_Identity); - - // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - - if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { - ue_context_p->ue_context.DRB_active[drb_id] = 1; - // logicalChannelIdentity + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %lx, reconfiguring DRB %d\n", + ctxt.module_id, + ctxt.rntiMaybeUEid, + (int)DRB_configList->list.array[i]->drb_Identity); + + // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { + ue_context_p->ue_context.DRB_active[drb_id] = 1; + // logicalChannelIdentity // rrc_mac_config_req_eNB - } - } else { // remove LCHAN from MAC/PHY - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } - } + } + } else { // remove LCHAN from MAC/PHY + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + } } } } @@ -3137,17 +3081,10 @@ return 0; static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const char *msg_name, instance_t instance){ f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p); - protocol_ctxt_t ctxt = { - .rnti = req->rnti, - .module_id = instance, - .instance = instance, - .enb_flag = 1, - .eNB_index = instance - }; + protocol_ctxt_t ctxt = {.rntiMaybeUEid = req->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance}; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id]; - struct rrc_gNB_ue_context_s *ue_context_p = - rrc_gNB_get_ue_context(rrc, ctxt.rnti); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rntiMaybeUEid); MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP); f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p); @@ -3319,7 +3256,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha /* Fill the UE context setup response ITTI message to send to F1AP */ resp->gNB_CU_ue_id = req->gNB_CU_ue_id; - resp->rnti = ctxt.rnti; + resp->rnti = ctxt.rntiMaybeUEid; if(DRB_configList){ if(DRB_configList->list.count > 0){ resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); @@ -3373,17 +3310,10 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, const char *msg_name, instance_t instance){ f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_MODIFICATION_REQ(msg_p); - protocol_ctxt_t ctxt = { - .rnti = req->rnti, - .module_id = instance, - .instance = instance, - .enb_flag = 1, - .eNB_index = instance - }; + protocol_ctxt_t ctxt = {.rntiMaybeUEid = req->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance}; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id]; - struct rrc_gNB_ue_context_s *ue_context_p = - rrc_gNB_get_ue_context(rrc, ctxt.rnti); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rntiMaybeUEid); MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_RESP); f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_MODIFICATION_RESP(message_p); @@ -3468,10 +3398,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); @@ -3481,7 +3411,7 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, co /* Fill the UE context setup response ITTI message to send to F1AP */ resp->gNB_CU_ue_id = req->gNB_CU_ue_id; - resp->rnti = ctxt.rnti; + resp->rnti = ctxt.rntiMaybeUEid; if(DRB_configList){ if(DRB_configList->list.count > 0){ resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); @@ -3530,15 +3460,9 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, co static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); - protocol_ctxt_t ctxt = { - .rnti = resp->rnti, - .module_id = instance, - .instance = instance, - .enb_flag = 1, - .eNB_index = instance - }; + protocol_ctxt_t ctxt = {.rntiMaybeUEid = resp->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance}; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rntiMaybeUEid); NR_CellGroupConfig_t *cellGroupConfig = NULL; asn_dec_rval_t dec_rval = uper_decode_complete( NULL, @@ -3591,15 +3515,9 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); - protocol_ctxt_t ctxt = { - .rnti = resp->rnti, - .module_id = instance, - .instance = instance, - .enb_flag = 1, - .eNB_index = instance - }; + protocol_ctxt_t ctxt = {.rntiMaybeUEid = resp->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance}; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti); + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rntiMaybeUEid); NR_CellGroupConfig_t *cellGroupConfig = NULL; if(resp->du_to_cu_rrc_information->cellGroupConfig!=NULL){ @@ -3809,7 +3727,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { MessageDef *msg; rrc_gNB_ue_context_t *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt_pP->rnti = ue_context_p->ue_id_rnti; + ctxt_pP->rntiMaybeUEid = ue_context_p->ue_id_rnti; gNB_MAC_INST *nrmac=RC.nrmac[ctxt_pP->module_id]; //WHAT A BEAUTIFULL RACE CONDITION !!! if (ue_context_p->ue_context.ul_failure_timer > 0) { @@ -3830,16 +3748,15 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { // Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G if(ue_context_p->ue_context.StatusRrc < NR_RRC_CONNECTED || ue_context_p->ue_context.gNB_ue_ngap_id == 0) { if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->instance]->node_type)){ - // TODO: MAC structures should not be accessed directly from the RRC! An implementation using the F1 interface should be developed. - mac_remove_nr_ue(nrmac, ctxt_pP->rnti); + mac_remove_nr_ue(nrmac, ctxt_pP->rntiMaybeUEid); rrc_rlc_remove_ue(ctxt_pP); pdcp_remove_UE(ctxt_pP); /* remove RRC UE Context */ - ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ue_context_p) { rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p); - LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); + LOG_I(NR_RRC, "remove UE %lx \n", ctxt_pP->rntiMaybeUEid); } } // In case of CU trigger UE context release command towards the DU @@ -3847,7 +3764,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p); - rel_cmd->rnti = ctxt_pP->rnti; + rel_cmd->rnti = ctxt_pP->rntiMaybeUEid; rel_cmd->cause = F1AP_CAUSE_RADIO_NETWORK; rel_cmd->cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, message_p); @@ -3865,18 +3782,16 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { LOG_I(NR_RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n", ue_context_p->ue_context.rnti); ue_context_p->ue_context.ue_release_timer_rrc = 0; - - // TODO: MAC structures should not be accessed directly from the RRC! An implementation using the F1 interface should be developed. - mac_remove_nr_ue(nrmac, ctxt_pP->rnti); + mac_remove_nr_ue(nrmac, ctxt_pP->rntiMaybeUEid); rrc_rlc_remove_ue(ctxt_pP); pdcp_remove_UE(ctxt_pP); - newGtpuDeleteAllTunnels(ctxt_pP->instance, ctxt_pP->rnti); + newGtpuDeleteAllTunnels(ctxt_pP->instance, ctxt_pP->rntiMaybeUEid); /* remove RRC UE Context */ - ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); if (ue_context_p) { rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p); - LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); + LOG_I(NR_RRC, "remove UE %lx \n", ctxt_pP->rntiMaybeUEid); } break; // break RB_FOREACH @@ -3960,15 +3875,7 @@ void *rrc_gnb_task(void *args_p) { int result; //SRB_INFO *srb_info_p; //int CC_id; - protocol_ctxt_t ctxt={.module_id=0, - .enb_flag=1, - .instance=0, - .rnti=0, - .frame=-1, - .subframe=-1, - .eNB_index=0, - .brOption=false - }; + protocol_ctxt_t ctxt = {.module_id = 0, .enb_flag = 1, .instance = 0, .rntiMaybeUEid = 0, .frame = -1, .subframe = -1, .eNB_index = 0, .brOption = false}; /* timer to write stats to file */ long stats_timer_id = 1; @@ -4017,12 +3924,13 @@ void *rrc_gnb_task(void *args_p) { F1AP_UL_RRC_MESSAGE(msg_p).rnti, 0, 0); - LOG_D(NR_RRC,"Decoding DCCH %d: ue %04x, inst %ld, ctxt %p, size %d\n", - F1AP_UL_RRC_MESSAGE(msg_p).srb_id, - ctxt.rnti, - instance, - &ctxt, - F1AP_UL_RRC_MESSAGE(msg_p).rrc_container_length); + LOG_D(NR_RRC, + "Decoding DCCH %d: ue %04lx, inst %ld, ctxt %p, size %d\n", + F1AP_UL_RRC_MESSAGE(msg_p).srb_id, + ctxt.rntiMaybeUEid, + instance, + &ctxt, + F1AP_UL_RRC_MESSAGE(msg_p).rrc_container_length); rrc_gNB_decode_dcch(&ctxt, F1AP_UL_RRC_MESSAGE(msg_p).srb_id, F1AP_UL_RRC_MESSAGE(msg_p).rrc_container, @@ -4138,8 +4046,7 @@ rrc_gNB_generate_SecurityModeCommand( uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); NR_IntegrityProtAlgorithm_t integrity_algorithm = (NR_IntegrityProtAlgorithm_t)ue_context_pP->ue_context.integrity_algorithm; size = do_NR_SecurityModeCommand( ctxt_pP, @@ -4206,8 +4113,7 @@ rrc_gNB_generate_UECapabilityEnquiry( uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rntiMaybeUEid)); size = do_NR_SA_UECapabilityEnquiry( ctxt_pP, buffer, @@ -4293,7 +4199,7 @@ rrc_gNB_generate_RRCRelease( uint8_t *message_buffer = itti_malloc (TASK_RRC_GNB, TASK_CU_F1, size); memcpy (message_buffer, buffer, size); MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); - F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rntiMaybeUEid; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = message_buffer; diff --git a/openair2/RRC/NR/rrc_gNB_GTPV1U.c b/openair2/RRC/NR/rrc_gNB_GTPV1U.c index f7b491af14..3556074b97 100644 --- a/openair2/RRC/NR/rrc_gNB_GTPV1U.c +++ b/openair2/RRC/NR/rrc_gNB_GTPV1U.c @@ -58,9 +58,7 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), create_tunnel_resp_pP->num_tunnels); rnti = create_tunnel_resp_pP->rnti; - ue_context_p = rrc_gNB_get_ue_context( - RC.nrrrc[ctxt_pP->module_id], - ctxt_pP->rnti); + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid); for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) { ue_context_p->ue_context.gnb_gtp_teid[inde_list[i]] = create_tunnel_resp_pP->enb_S1u_teid[i]; @@ -97,10 +95,8 @@ 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; - ue_context_p = rrc_gNB_get_ue_context( - RC.nrrrc[ctxt_pP->module_id], - ctxt_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->rntiMaybeUEid); for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) { ue_context_p->ue_context.gnb_gtp_teid[inde_list[i]] = create_tunnel_resp_pP->gnb_NGu_teid[i]; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8f391417e0..9900da9d66 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 #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "RRC/NR/rrc_gNB_GTPV1U.h" @@ -373,7 +372,7 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( rrc_ue_ngap_ids_p = malloc(sizeof(rrc_ue_ngap_ids_t)); rrc_ue_ngap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_ngap_ids_p->gNB_ue_ngap_id = UE_INITIAL_ID_INVALID; - rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti; + rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rntiMaybeUEid; h_rc = hashtable_insert(RC.nrrrc[ctxt_pP->module_id]->initial_id2_ngap_ids, (hash_key_t)ue_context_pP->ue_context.ue_initial_id, @@ -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/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c index 540ac5d075..ec96a446c2 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.c +++ b/openair2/RRC/NR/rrc_gNB_UE_context.c @@ -210,7 +210,7 @@ rrc_gNB_get_next_free_ue_context( //----------------------------------------------------------------------------- { struct rrc_gNB_ue_context_s *ue_context_p = NULL; - ue_context_p = rrc_gNB_get_ue_context(rrc_instance_pP, ctxt_pP->rnti); + ue_context_p = rrc_gNB_get_ue_context(rrc_instance_pP, ctxt_pP->rntiMaybeUEid); if (ue_context_p == NULL) { ue_context_p = rrc_gNB_allocate_new_UE_context(rrc_instance_pP); @@ -222,8 +222,8 @@ rrc_gNB_get_next_free_ue_context( return NULL; } - ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed + ue_context_p->ue_id_rnti = ctxt_pP->rntiMaybeUEid; // here ue_id_rnti is just a key, may be something else + ue_context_p->ue_context.rnti = ctxt_pP->rntiMaybeUEid; // yes duplicate, 1 may be removed ue_context_p->ue_context.random_ue_identity = ue_identityP; RB_INSERT(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_p); LOG_D(NR_RRC, diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index b3eada8136..8f13d1213f 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -375,35 +375,30 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0, rrc->module_id); LOG_W(RRC, - "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", + "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %lx, frame %d, subframe %d eNB_index %d \n", &ctxt, ctxt.module_id, - ctxt.rnti, + ctxt.rntiMaybeUEid, ctxt.frame, ctxt.subframe, ctxt.eNB_index); - nr_rrc_pdcp_config_asn1_req(&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, - ue_context_p->ue_context.rb_config->drb_ToAddModList , - ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, - NULL, /* kRRCenc - unused */ - NULL, /* kRRCint - unused */ - kUPenc, /* kUPenc */ - kUPint, /* kUPint */ - NULL, - NULL, - ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); + nr_pdcp_add_drbs(ctxt.enb_flag, + ctxt.rntiMaybeUEid, + ue_context_p->ue_context.rb_config->drb_ToAddModList, + (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, + kUPenc, + kUPint, + ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); nr_rrc_rlc_config_asn1_req(&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, + get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : NULL, ue_context_p->ue_context.rb_config->drb_ToAddModList, ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (LTE_PMCH_InfoList_r9_t *) NULL, + (LTE_PMCH_InfoList_r9_t *)NULL, ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); + LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %lx\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid); } void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 8907ff315a..c67069e975 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -176,7 +176,7 @@ rrc_data_req_nr_ue( RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_REQ (message_p).mode = modeP; RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id; - RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti; + RRC_DCCH_DATA_REQ(message_p).rnti = ctxt_pP->rntiMaybeUEid; RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index; itti_send_msg_to_task ( TASK_PDCP_UE, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f16cace900..0441478ce6 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1403,33 +1403,20 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB break; case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: - LOG_I(NR_RRC, - "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti); + LOG_I(NR_RRC, "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %lx\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rntiMaybeUEid); - // Get configuration - // Release T300 timer - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; + // Get configuration + // Release T300 timer + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; - nr_rrc_ue_process_masterCellGroup( - ctxt_pP, - gNB_index, - &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); - nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, - gNB_index, - &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); - nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED_NR); - nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED_NR); - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; - rrc_ue_generate_RRCSetupComplete( - ctxt_pP, - gNB_index, - dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, - NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); - rval = 0; - break; + nr_rrc_ue_process_masterCellGroup(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); + nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); + nr_rrc_set_state(ctxt_pP->module_id, RRC_STATE_CONNECTED_NR); + nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED_NR); + NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rntiMaybeUEid; + rrc_ue_generate_RRCSetupComplete(ctxt_pP, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); + rval = 0; + break; default: LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n", @@ -1970,19 +1957,12 @@ nr_rrc_ue_establish_srb2( NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); // Refresh SRBs - nr_rrc_pdcp_config_asn1_req(ctxt_pP, - radioBearerConfig->srb_ToAddModList, - NULL, - NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - kRRCenc, - kRRCint, - NULL, - NULL, - NULL, - NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + nr_pdcp_add_srbs(ctxt_pP->enb_flag, + ctxt_pP->rntiMaybeUEid, + radioBearerConfig->srb_ToAddModList, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + kRRCenc, + kRRCint); // Refresh SRBs nr_rrc_rlc_config_asn1_req(ctxt_pP, radioBearerConfig->srb_ToAddModList, @@ -2075,27 +2055,15 @@ nr_rrc_ue_establish_srb2( NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPint); // Refresh DRBs - nr_rrc_pdcp_config_asn1_req(ctxt_pP, - NULL, - radioBearerConfig->drb_ToAddModList, - NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm - | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - NULL, - NULL, - kUPenc, - kUPint, - NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); - // Refresh DRBs - nr_rrc_rlc_config_asn1_req(ctxt_pP, - NULL, - radioBearerConfig->drb_ToAddModList, - NULL, - NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList - ); + nr_pdcp_add_drbs(ctxt_pP->enb_flag, + ctxt_pP->rntiMaybeUEid, + radioBearerConfig->drb_ToAddModList, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + kUPenc, + kUPint, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + // Refresh DRBs + nr_rrc_rlc_config_asn1_req(ctxt_pP, NULL, radioBearerConfig->drb_ToAddModList, NULL, NULL, NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); } // drb_ToAddModList // if (radioBearerConfig->drb_ToReleaseList != NULL) { diff --git a/openair2/SDAP/nr_sdap/nr_sdap.c b/openair2/SDAP/nr_sdap/nr_sdap.c index b71381b116..e2b6714488 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,14 +67,14 @@ 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); + if (sdap_entity == NULL) { + LOG_E(SDAP, "%s:%d:%s: Entity not found for ue rnti/ue_id: %lx and pdusession id: %d\n", __FILE__, __LINE__, __FUNCTION__, ue_id, pdusession_id); return; } @@ -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 ea4fe7f74d..54447ebb68 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 efa93a29f7..5755d3430a 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c @@ -37,11 +37,12 @@ static nr_sdap_entity_info sdap_info; nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(void); -void nr_pdcp_submit_sdap_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu){ +void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu) +{ nr_pdcp_ue_t *ue; nr_pdcp_ue_manager_t *nr_pdcp_ue_manager; nr_pdcp_ue_manager = nr_pdcp_sdap_get_ue_manager(); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); ue->drb[sdap_ctrl_pdu_drb-1]->recv_sdu(ue->drb[sdap_ctrl_pdu_drb-1], (char*)&ctrl_pdu, SDAP_HDR_LENGTH, RLC_MUI_UNDEFINED); LOG_D(SDAP, "Control PDU - Submitting Control PDU to DRB ID: %ld\n", sdap_ctrl_pdu_drb); LOG_D(SDAP, "QFI: %u\n R: %u\n D/C: %u\n", ctrl_pdu.QFI, ctrl_pdu.R, ctrl_pdu.DC); @@ -175,7 +176,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 +204,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 +251,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 +267,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); } /* @@ -365,19 +366,15 @@ rb_id_t nr_sdap_map_ctrl_pdu(nr_sdap_entity_t *entity, rb_id_t pdcp_entity, int return drb_of_endmarker; } -void nr_sdap_submit_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu){ +void nr_sdap_submit_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu) +{ if(sdap_ctrl_pdu_drb){ - nr_pdcp_submit_sdap_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, ctrl_pdu); + nr_pdcp_submit_sdap_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, ctrl_pdu); LOG_D(SDAP, "Sent Control PDU to PDCP Layer.\n"); } } -void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, - rb_id_t pdcp_entity, - uint16_t rnti, - NR_QFI_t *mapped_qfi_2_add, - uint8_t mappedQFIs2AddCount, - uint8_t drb_identity) +void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity) { LOG_D(SDAP, "RRC Configuring SDAP Entity\n"); uint8_t qfi = 0; @@ -388,33 +385,26 @@ void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, if(existing_sdap_entity->default_drb && existing_sdap_entity->qfi2drb_table[qfi].drb_id == SDAP_NO_MAPPING_RULE){ nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi); rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, qfi); - existing_sdap_entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); + existing_sdap_entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); } if(existing_sdap_entity->qfi2drb_table[qfi].drb_id != drb_identity && existing_sdap_entity->qfi2drb_table[qfi].hasSdap){ nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi); rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, qfi); - existing_sdap_entity->sdap_submit_ctrl_pdu(rnti, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); + existing_sdap_entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu); } LOG_D(SDAP, "Storing the configured QoS flow to DRB mapping rule\n"); existing_sdap_entity->qfi2drb_map_update(existing_sdap_entity, qfi, drb_identity, hasSdap); } } -nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, - int has_sdap, - uint16_t rnti, - int pdusession_id, - bool is_defaultDRB, - uint8_t drb_identity, - NR_QFI_t *mapped_qfi_2_add, - uint8_t mappedQFIs2AddCount) +nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, int has_sdap, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t drb_identity, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount) { - if(nr_sdap_get_entity(rnti, pdusession_id)) { - LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI: %u and PDU SESSION ID: %d\n", rnti, pdusession_id); - nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(rnti, pdusession_id); + if (nr_sdap_get_entity(ue_id, pdusession_id)) { + LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id); + nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id); rb_id_t pdcp_entity = existing_sdap_entity->default_drb; if(!is_gnb) - nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, rnti, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity); + nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity); return existing_sdap_entity; } @@ -426,7 +416,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, exit(1); } - sdap_entity->rnti = rnti; + sdap_entity->ue_id = ue_id; sdap_entity->pdusession_id = pdusession_id; sdap_entity->tx_entity = nr_sdap_tx_entity; @@ -458,38 +448,39 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, return sdap_entity; } -nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id) { +nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id) +{ nr_sdap_entity_t *sdap_entity; sdap_entity = sdap_info.sdap_entity_llist; if(sdap_entity == NULL) return NULL; - while(( sdap_entity->rnti != rnti || sdap_entity->pdusession_id != pdusession_id ) && sdap_entity->next_entity != NULL) { + while ((sdap_entity->ue_id != ue_id || sdap_entity->pdusession_id != pdusession_id) && sdap_entity->next_entity != NULL) { sdap_entity = sdap_entity->next_entity; } - if (sdap_entity->rnti == rnti && sdap_entity->pdusession_id == pdusession_id) + if (sdap_entity->ue_id == ue_id && sdap_entity->pdusession_id == pdusession_id) return sdap_entity; return NULL; } - -void delete_nr_sdap_entity(uint16_t rnti) { +void delete_nr_sdap_entity(ue_id_t ue_id) +{ nr_sdap_entity_t *entityPtr, *entityPrev = NULL; entityPtr = sdap_info.sdap_entity_llist; - if(entityPtr->rnti == rnti) { + if (entityPtr->ue_id == ue_id) { sdap_info.sdap_entity_llist = sdap_info.sdap_entity_llist->next_entity; free(entityPtr); } else { - while(entityPtr->rnti != rnti && entityPtr->next_entity != NULL) { + while (entityPtr->ue_id != ue_id && entityPtr->next_entity != NULL) { entityPrev = entityPtr; entityPtr = entityPtr->next_entity; } - if(entityPtr->rnti != rnti) { + if (entityPtr->ue_id != ue_id) { entityPrev->next_entity = entityPtr->next_entity; free(entityPtr); } diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.h b/openair2/SDAP/nr_sdap/nr_sdap_entity.h index 82aa267ebf..9b012d037c 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h @@ -68,10 +68,10 @@ typedef struct qfi2drb_s { bool hasSdap; } qfi2drb_t; -void nr_pdcp_submit_sdap_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); +void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); typedef struct nr_sdap_entity_s { - uint16_t rnti; + ue_id_t ue_id; rb_id_t default_drb; int pdusession_id; qfi2drb_t qfi2drb_table[SDAP_MAX_QFI]; @@ -82,8 +82,7 @@ typedef struct nr_sdap_entity_s { nr_sdap_ul_hdr_t (*sdap_construct_ctrl_pdu)(uint8_t qfi); rb_id_t (*sdap_map_ctrl_pdu)(struct nr_sdap_entity_s *entity, rb_id_t pdcp_entity, int map_type, uint8_t dl_qfi); - void (*sdap_submit_ctrl_pdu)(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); - + void (*sdap_submit_ctrl_pdu)(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); bool (*tx_entity)(struct nr_sdap_entity_s *entity, protocol_ctxt_t *ctxt_p, @@ -105,7 +104,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); @@ -148,36 +147,24 @@ rb_id_t nr_sdap_map_ctrl_pdu(nr_sdap_entity_t *entity, rb_id_t pdcp_entity, int * TS 37.324 5.3 QoS flow to DRB Mapping * Submit the end-marker control PDU to the lower layer. */ -void nr_sdap_submit_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); +void nr_sdap_submit_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu); /* * TS 37.324 5.3 QoS flow to DRB Mapping * 5.3.1 Configuration Procedures */ -void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, - rb_id_t pdcp_entity, - uint16_t rnti, - NR_QFI_t *mapped_qfi_2_add, - uint8_t mappedQFIs2AddCount, - uint8_t drb_identity); +void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity); /* * TS 37.324 4.4 5.1.1 SDAP entity establishment * Establish an SDAP entity. */ -nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, - int has_sdap, - uint16_t rnti, - int pdusession_id, - bool is_defaultDRB, - uint8_t default_DRB, - NR_QFI_t *mapped_qfi_2_add, - uint8_t mappedQFIs2AddCount); +nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, int has_sdap, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t default_DRB, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount); /* Entity Handling Related Functions */ -nr_sdap_entity_t *nr_sdap_get_entity(uint16_t rnti, int pdusession_id); +nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id); /* Entity Handling Related Functions */ -void delete_nr_sdap_entity(uint16_t rnti); +void delete_nr_sdap_entity(ue_id_t ue_id); #endif diff --git a/openair3/MME_APP/mme_app.c b/openair3/MME_APP/mme_app.c index fce9f6ba57..ea7f7b91ae 100644 --- a/openair3/MME_APP/mme_app.c +++ b/openair3/MME_APP/mme_app.c @@ -40,8 +40,7 @@ # include "intertask_interface.h" # include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# include "gtpv1u_eNB_task.h" +#include "sctp_eNB_task.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 618cdef23b..2c702fa36a 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 bearers; + map 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 ue2te_mapping; - map te2ue_mapping; + map ue2te_mapping; + map 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 instances; + map 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::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::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::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::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::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; isecond.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.rntiMaybeUEid = 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.rntiMaybeUEid = tunnel->second.ue_id; ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; @@ -1105,17 +1072,39 @@ 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); } } if(NR_PDCP_PDU_SN > 0 && NR_PDCP_PDU_SN %5 ==0){ LOG_D (GTPU, "Create and send DL DATA Delivery status for the previously received PDU, NR_PDCP_PDU_SN: %u \n", NR_PDCP_PDU_SN); - int rlc_tx_buffer_space = nr_rlc_get_available_tx_space(ctxt.rnti, rb_id + 3); + int rlc_tx_buffer_space = nr_rlc_get_available_tx_space(ctxt.rntiMaybeUEid, rb_id + 3); LOG_D(GTPU, "Available buffer size in RLC for Tx: %d \n", rlc_tx_buffer_space); /*Total size of DDD_status PDU = 1 octet to report extension header length * size of mandatory part + 3 octets for highest transmitted/delivered PDCP SN @@ -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 7951c4db09..00736fc672 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 (*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 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 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; + 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); + // 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_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_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); + 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 e764eb143b..0000000000 --- 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 817d0109ba..0000000000 --- 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_ */ - diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index c59b82a43d..678f1e5e0c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -499,7 +499,7 @@ int main ( int argc, char **argv ) protocol_ctxt_t ctxt; ctxt.module_id = 0 ; ctxt.instance = 0; - ctxt.rnti = 0; + ctxt.rntiMaybeUEid = 0; ctxt.enb_flag = 1; ctxt.frame = 0; ctxt.subframe = 0;