This commit implements proper PDU Session Release handling across
RRC, PDCP, F1AP, E1AP to ensure clean resource cleanup when
a PDU session is terminated.
Key changes:
NGAP:
In `rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND()`:
* Populates E1AP Bearer Modification for each released session
* If a CU-UP is connected, triggers `bearer_context_mod()` for PDU teardown
PDCP:
* Added `nr_pdcp_release_drbs()` to remove all DRBs linked to a given PDU session
* Called from `e1_bearer_context_modif()` for correct clean-up during session release
F1AP UE Context Modification:
Replace direct RRC message transfer with F1AP UE Context Modification Request
to properly handle PDU session release according to 3GPP TS 38.331.
3GPP TS 38.331 `5.3.5.6.4 DRB release` says: whether or not the RLC and MAC entities associated
with a PDCP entity are reset or released is determined by the CellGroupConfig. Thus,
updated CellGroupConfig needs to be received by the UE. This has to be retrieved by CUCP
from the DU. Therefore:
After receiving an NGAP_PDUSESSION_RELEASE_COMMAND, the CUCP shall:
1) forward (store for later) the NAS PDU to the UE, if present as per 3GPP TS 38.413, and
2) send a UE Context Modification to the DU with the list of DRBs to release
and the RRC container (RRCReconfiguration with NAS PDU)
After reception of UE Context Modification Response, the list of drbs to release
is prepared based on PDU session status PDU_SESSION_STATUS_TORELEASE
in rrc_gNB_generate_dedicatedRRCReconfiguration and then encoded
in drb_ToReleaseList for a new RRCReconfiguration with the new cellGroupConfig.
Key changes:
* rrc_gNB_generate_dedicatedRRCReconfiguration_release() now uses F1AP UE Context
Modification Request instead of direct RRC transfer
* Only DRBs to be released are now added to the list.
* The ASN.1 memory allocation is entirely done in build_RRCReconfiguration_IEs
* No longer needed to store ASN1 struct in UE context
GTP-U:
* Previous implementation had incomplete tunnel cleanup during PDU session release
- Missing distinction between N3 (PDU session level) and F1-U (DRB level) tunnels
- Lack of proper DRB identification for F1-U tunnel deletion
Major Changes:
* GTP tunnel teardown now handled in `e1_bearer_context_modif()` using the correct
F1 or N3 GTP instance (`newGtpuDeleteOneTunnel()`)
* Enhanced Tunnel Deletion Logic (cucp_cuup_handler.c):
- Separate handling for N3 tunnels (1 per PDU session) and F1-U tunnels (1 per DRB)
- Added proper DRB identification for F1-U tunnel cleanup
- Improved error handling with detailed logging for each tunnel deletion
- Enhanced logging to distinguish between N3 and F1-U tunnel operations
* New PDCP API Function (nr_pdcp_oai_api.c/h):
- Added nr_pdcp_get_drb_ids_for_pdusession() function
- Enables retrieval of all DRB IDs associated with a specific PDU session
- Supports proper F1-U tunnel cleanup by providing DRB identifiers in CUUP
* Enhanced GTP Interface (gtp_itf.cpp/h):
- Modified newGtpuDeleteOneTunnel() to accept tunnel_type parameter
- Improved logging to distinguish between PDU session and DRB tunnel types
- Better error messages for tunnel deletion failures
- Enhanced debugging information for remaining tunnels
Clean-up:
* Ensured xid tracking works consistently between PDU Session Establishment (with NAS PDU)
and dedicated RRCReconfiguration
* Add function to release GTP-U tunnel in Bearer Context Modification Request handler
* Do not send rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE when no PDU session are to
be released: it is sent upon completion of the RRCReconfiguration and needs to contain
released PDU Sessions (mandatory IE), therefore it is no necessary to send it in case
there is no PDU session to release.
Related to #867
Co-authored-by: rmagueta <rmagueta@allbesmart.pt>
135 lines
5.8 KiB
C
135 lines
5.8 KiB
C
/*
|
|
* 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
|
|
*/
|
|
|
|
#ifndef NR_PDCP_OAI_API_H
|
|
#define NR_PDCP_OAI_API_H
|
|
|
|
#include <assertions.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "NR_DRB-ToAddModList.h"
|
|
#include "NR_PDCP-Config.h"
|
|
#include "NR_SRB-ToAddModList.h"
|
|
#include "nr_pdcp/nr_pdcp_entity.h"
|
|
#include "nr_pdcp/nr_pdcp_integrity_data.h"
|
|
#include "nr_pdcp_ue_manager.h"
|
|
struct NR_DRB_ToAddMod;
|
|
struct NR_SRB_ToAddMod;
|
|
struct sdap_configuration_s;
|
|
|
|
void nr_pdcp_layer_init(void);
|
|
|
|
bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
|
|
const srb_flag_t srb_flagP,
|
|
const rb_id_t rb_id,
|
|
const sdu_size_t sdu_buffer_size,
|
|
uint8_t *const sdu_buffer);
|
|
|
|
void nr_pdcp_add_srbs(eNB_flag_t enb_flag,
|
|
ue_id_t UEid,
|
|
NR_SRB_ToAddModList_t *const srb2add_list,
|
|
const nr_pdcp_entity_security_keys_and_algos_t *security_parameters);
|
|
|
|
void nr_pdcp_add_drb(int is_gnb,
|
|
const ue_id_t UEid,
|
|
const NR_PDCP_Config_t *pdcp,
|
|
const struct sdap_configuration_s *sdap,
|
|
const nr_pdcp_entity_security_keys_and_algos_t *security_parameters);
|
|
|
|
void nr_pdcp_remove_UE(ue_id_t ue_id);
|
|
void nr_pdcp_reestablishment(ue_id_t ue_id,
|
|
int rb_id,
|
|
bool srb_flag,
|
|
const nr_pdcp_entity_security_keys_and_algos_t *security_parameters);
|
|
|
|
void nr_pdcp_suspend_srb(ue_id_t ue_id, int srb_id);
|
|
void nr_pdcp_suspend_drb(ue_id_t ue_id, int drb_id);
|
|
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering);
|
|
void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, NR_PDCP_Config_t *pdcp_config);
|
|
void nr_pdcp_release_srb(ue_id_t ue_id, int srb_id);
|
|
void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id);
|
|
int nr_pdcp_get_drb_ids_for_pdusession(ue_id_t ue_id, long pdusession_id, int *drb_ids);
|
|
|
|
void add_srb(int is_gnb,
|
|
ue_id_t UEid,
|
|
struct NR_SRB_ToAddMod *s,
|
|
const nr_pdcp_entity_security_keys_and_algos_t *security_parameters);
|
|
|
|
void nr_pdcp_config_set_security(ue_id_t ue_id,
|
|
rb_id_t rb_id,
|
|
bool is_srb,
|
|
const nr_pdcp_entity_security_keys_and_algos_t *parameters);
|
|
|
|
bool nr_pdcp_check_integrity_srb(ue_id_t ue_id,
|
|
int srb_id,
|
|
const uint8_t *msg,
|
|
int msg_size,
|
|
const nr_pdcp_integrity_data_t *msg_integrity);
|
|
|
|
bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP,
|
|
const srb_flag_t srb_flagP,
|
|
const rb_id_t rb_id,
|
|
const mui_t muiP,
|
|
const confirm_t confirmP,
|
|
const sdu_size_t sdu_buffer_size,
|
|
unsigned char *const sdu_buffer,
|
|
const pdcp_transmission_mode_t mode,
|
|
const uint32_t *const sourceL2Id,
|
|
const uint32_t *const destinationL2Id);
|
|
|
|
typedef void (*deliver_pdu)(void *data, ue_id_t ue_id, int srb_id,
|
|
char *buf, int size, int sdu_id);
|
|
/* default implementation of deliver_pdu */
|
|
void deliver_pdu_srb_rlc(void *data, ue_id_t ue_id, int srb_id, char *buf, int size, int sdu_id);
|
|
bool nr_pdcp_data_req_srb(ue_id_t ue_id,
|
|
const rb_id_t rb_id,
|
|
const mui_t muiP,
|
|
const sdu_size_t sdu_buffer_size,
|
|
unsigned char *const sdu_buffer,
|
|
deliver_pdu deliver_cb,
|
|
void *data);
|
|
bool nr_pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP,
|
|
const srb_flag_t srb_flagP,
|
|
const rb_id_t rb_id,
|
|
const mui_t muiP,
|
|
const confirm_t confirmP,
|
|
const sdu_size_t sdu_buffer_size,
|
|
unsigned char *const sdu_buffer,
|
|
const pdcp_transmission_mode_t mode,
|
|
const uint32_t *const sourceL2Id,
|
|
const uint32_t *const destinationL2Id);
|
|
|
|
nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager();
|
|
|
|
int nr_pdcp_get_num_ues(ue_id_t *ue_list, int len);
|
|
|
|
bool nr_pdcp_get_statistics(ue_id_t ue_id, int srb_flag, int rb_id, nr_pdcp_statistics_t *out);
|
|
|
|
void nr_pdcp_count_update(ue_id_t ue_id,
|
|
rb_id_t drb_id,
|
|
nr_pdcp_count_t dl_count,
|
|
nr_pdcp_count_t ul_count,
|
|
int sn_size);
|
|
|
|
void nr_pdcp_get_drb_count_values(ue_id_t ue_id, rb_id_t rb_id, nr_pdcp_count_t *ul_count, nr_pdcp_count_t *dl_count);
|
|
|
|
#endif /* NR_PDCP_OAI_API_H */
|