Commit e7c626a7 authored by francescomani's avatar francescomani

release RB entities

parent 18892963
......@@ -369,6 +369,21 @@ void nr_pdcp_entity_set_time(struct nr_pdcp_entity_t *entity, uint64_t now)
check_t_reordering(entity);
}
void nr_pdcp_entity_release(nr_pdcp_entity_t *entity)
{
// deliver the PDCP SDUs stored in the receiving PDCP entity to upper layers
while (entity->rx_list != NULL) {
nr_pdcp_sdu_t *cur = entity->rx_list;
entity->deliver_sdu(entity->deliver_sdu_data, entity,
cur->buffer, cur->size);
entity->rx_list = cur->next;
entity->rx_size -= cur->size;
entity->stats.txsdu_pkts++;
entity->stats.txsdu_bytes += cur->size;
nr_pdcp_free_sdu(cur);
}
}
void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity)
{
nr_pdcp_sdu_t *cur = entity->rx_list;
......@@ -428,6 +443,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
ret->set_time = nr_pdcp_entity_set_time;
ret->delete_entity = nr_pdcp_entity_delete;
ret->release_entity = nr_pdcp_entity_release;
ret->get_stats = nr_pdcp_entity_get_stats;
ret->deliver_sdu = deliver_sdu;
......
......@@ -76,6 +76,7 @@ typedef struct nr_pdcp_entity_t {
int (*process_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id, char *pdu_buffer, int pdu_max_size);
void (*delete_entity)(struct nr_pdcp_entity_t *entity);
void (*release_entity)(struct nr_pdcp_entity_t *entity);
void (*get_stats)(struct nr_pdcp_entity_t *entity, nr_pdcp_statistics_t *out);
/* set_security: pass -1 to integrity_algorithm / ciphering_algorithm
......
......@@ -1080,6 +1080,31 @@ void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering)
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_release_srb(ue_id_t ue_id, int srb_id)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
if (ue->srb[srb_id - 1] != NULL)
ue->srb[srb_id - 1]->delete_entity(ue->srb[srb_id - 1]);
else
LOG_E(PDCP, "Attempting to release SRB%d but it is not configured\n", srb_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_release_drb(ue_id_t ue_id, int drb_id)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *drb = ue->drb[drb_id - 1];
if (drb) {
drb->release_entity(drb);
drb->delete_entity(drb);
}
else
LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_reestablishment(ue_id_t ue_id)
{
// TODO implement this on a per RB basis following TS 38.323 Sec 5.1.2
......
......@@ -68,6 +68,8 @@ void nr_pdcp_reestablishment(ue_id_t ue_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, long t_Reordering);
void nr_release_srb(ue_id_t ue_id, int srb_id);
void nr_release_drb(ue_id_t ue_id, int drb_id);
void add_srb(int is_gnb,
ue_id_t rntiMaybeUEid,
......
......@@ -1459,7 +1459,8 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)radioBearerConfig);
NR_UE_RRC_INST_t *ue_rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
AssertFatal(radioBearerConfig->srb3_ToRelease == NULL, "Release of SRB3 not yet implemented\n");
if (radioBearerConfig->srb3_ToRelease)
nr_release_srb(ctxt_pP->rntiMaybeUEid, 3);
uint8_t kRRCenc[16] = {0};
uint8_t kRRCint[16] = {0};
......@@ -1509,7 +1510,13 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB
}
}
AssertFatal(radioBearerConfig->drb_ToReleaseList == NULL, "RB entity release not implemented yet\n");
if (radioBearerConfig->drb_ToReleaseList) {
for (int cnt = 0; cnt < radioBearerConfig->drb_ToReleaseList->list.count; cnt++) {
NR_DRB_Identity_t *DRB_id = radioBearerConfig->drb_ToReleaseList->list.array[cnt];
if (DRB_id)
nr_release_drb(ctxt_pP->rntiMaybeUEid, *DRB_id);
}
}
// Establish DRBs if present
if (radioBearerConfig->drb_ToAddModList != NULL) {
......
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