Commit 6919f290 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/Bugfix_SDAP_delete_entity' into integration_2023_w27

parents be8a4012 7a2790ba
......@@ -468,23 +468,74 @@ nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id)
return NULL;
}
void delete_nr_sdap_entity(ue_id_t ue_id)
bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id)
{
nr_sdap_entity_t *entityPtr, *entityPrev = NULL;
entityPtr = sdap_info.sdap_entity_llist;
nr_sdap_entity_t *entityPtr = sdap_info.sdap_entity_llist;
nr_sdap_entity_t *entityPrev = NULL;
bool ret = false;
int upperBound = 0;
if (entityPtr->ue_id == ue_id) {
if (entityPtr == NULL && (pdusession_id) * (pdusession_id - NGAP_MAX_PDU_SESSION) > 0) {
LOG_W(SDAP, "SDAP entities not established or Invalid range of pdusession_id [0, 256].\n");
return ret;
}
LOG_D(SDAP, "Deleting SDAP entity for UE %lx and PDU Session id %d\n", ue_id, entityPtr->pdusession_id);
if (entityPtr->ue_id == ue_id && entityPtr->pdusession_id == pdusession_id) {
sdap_info.sdap_entity_llist = sdap_info.sdap_entity_llist->next_entity;
free(entityPtr);
LOG_D(SDAP, "Successfully deleted Entity.\n");
ret = true;
} else {
while (entityPtr->ue_id != ue_id && entityPtr->next_entity != NULL) {
while ((entityPtr->ue_id != ue_id || entityPtr->pdusession_id != pdusession_id) && entityPtr->next_entity != NULL
&& upperBound < SDAP_MAX_NUM_OF_ENTITIES) {
entityPrev = entityPtr;
entityPtr = entityPtr->next_entity;
upperBound++;
}
if (entityPtr->ue_id == ue_id && entityPtr->pdusession_id == pdusession_id) {
entityPrev->next_entity = entityPtr->next_entity;
free(entityPtr);
LOG_D(SDAP, "Successfully deleted Entity.\n");
ret = true;
}
}
LOG_W(SDAP, "Entity does not exist or it was not found.\n");
return ret;
}
bool nr_sdap_delete_ue_entities(ue_id_t ue_id)
{
nr_sdap_entity_t *entityPtr = sdap_info.sdap_entity_llist;
nr_sdap_entity_t *entityPrev = NULL;
int upperBound = 0;
bool ret = false;
if (entityPtr == NULL && (ue_id) * (ue_id - SDAP_MAX_UE_ID) > 0) {
LOG_W(SDAP, "SDAP entities not established or Invalid range of ue_id [0, 65536]\n");
return ret;
}
/* Handle scenario where ue_id matches the head of the list */
while (entityPtr != NULL && entityPtr->ue_id == ue_id && upperBound < NGAP_MAX_DRBS_PER_UE) {
sdap_info.sdap_entity_llist = entityPtr->next_entity;
free(entityPtr);
entityPtr = sdap_info.sdap_entity_llist;
ret = true;
}
while (entityPtr != NULL && upperBound < SDAP_MAX_NUM_OF_ENTITIES) {
if (entityPtr->ue_id != ue_id) {
entityPrev = entityPtr;
entityPtr = entityPtr->next_entity;
} else {
entityPrev->next_entity = entityPtr->next_entity;
free(entityPtr);
entityPtr = entityPrev->next_entity;
LOG_D(SDAP, "Successfully deleted Entity.\n");
ret = true;
}
}
return ret;
}
......@@ -44,6 +44,8 @@
#define SDAP_CTRL_PDU_MAP_DEF_DRB (0)
#define SDAP_CTRL_PDU_MAP_RULE_DRB (1)
#define SDAP_MAX_PDU (9000)
#define SDAP_MAX_NUM_OF_ENTITIES (NGAP_MAX_DRBS_PER_UE * MAX_MOBILES_PER_ENB)
#define SDAP_MAX_UE_ID (65536)
/*
* The values of QoS Flow ID (QFI) and Reflective QoS Indication,
......@@ -167,7 +169,21 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap
/* Entity Handling Related Functions */
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(ue_id_t ue_id);
/**
* @brief Function to delete a single SDAP Entity based on the ue_id and pdusession_id.
* @note 1. SDAP entities may have the same ue_id.
* @note 2. SDAP entities may have the same pdusession_id, but not with the same ue_id.
* @note 3. The combination of ue_id and pdusession_id, is unique for each SDAP entity.
* @param[in] ue_id Unique identifier for the User Equipment. ID Range [0, 65536].
* @param[in] pdusession_id Unique identifier for the Packet Data Unit Session. ID Range [0, 256].
* @return True, if successfully deleted entity, false otherwise.
*/
bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id);
/**
* @brief Function to delete all SDAP Entities based on the ue_id.
* @param[in] ue_id Unique identifier for the User Equipment. ID Range [0, 65536].
* @return True, it deleted at least one entity, false otherwise.
*/
bool nr_sdap_delete_ue_entities(ue_id_t ue_id);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment