Commit cf1baafd authored by francescomani's avatar francescomani

fixing release according to review

parent e7c626a7
...@@ -1069,9 +1069,10 @@ void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering) ...@@ -1069,9 +1069,10 @@ 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_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering)
{ {
// The enabling/disabling of ciphering or integrity protection /* The enabling/disabling of ciphering or integrity protection
// can be changed only by releasing and adding the DRB * can be changed only by releasing and adding the DRB
// (so not by reconfiguring). * (so not by reconfiguring).
*/
nr_pdcp_manager_lock(nr_pdcp_ue_manager); 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_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *drb = ue->drb[drb_id - 1]; nr_pdcp_entity_t *drb = ue->drb[drb_id - 1];
...@@ -1084,8 +1085,10 @@ void nr_release_srb(ue_id_t ue_id, int srb_id) ...@@ -1084,8 +1085,10 @@ void nr_release_srb(ue_id_t ue_id, int srb_id)
{ {
nr_pdcp_manager_lock(nr_pdcp_ue_manager); 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_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
if (ue->srb[srb_id - 1] != NULL) if (ue->srb[srb_id - 1] != NULL) {
ue->srb[srb_id - 1]->delete_entity(ue->srb[srb_id - 1]); ue->srb[srb_id - 1]->delete_entity(ue->srb[srb_id - 1]);
ue->srb[srb_id - 1] = NULL;
}
else else
LOG_E(PDCP, "Attempting to release SRB%d but it is not configured\n", srb_id); LOG_E(PDCP, "Attempting to release SRB%d but it is not configured\n", srb_id);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
...@@ -1099,6 +1102,7 @@ void nr_release_drb(ue_id_t ue_id, int drb_id) ...@@ -1099,6 +1102,7 @@ void nr_release_drb(ue_id_t ue_id, int drb_id)
if (drb) { if (drb) {
drb->release_entity(drb); drb->release_entity(drb);
drb->delete_entity(drb); drb->delete_entity(drb);
ue->drb[drb_id - 1] = NULL;
} }
else else
LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id); LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id);
......
...@@ -54,6 +54,35 @@ static uint64_t nr_rlc_current_time; ...@@ -54,6 +54,35 @@ static uint64_t nr_rlc_current_time;
static int nr_rlc_current_time_last_frame; static int nr_rlc_current_time_last_frame;
static int nr_rlc_current_time_last_subframe; static int nr_rlc_current_time_last_subframe;
static void release_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t channel_id)
{
AssertFatal(channel_id != 0, "LCID = 0 shouldn't be handled here\n");
nr_rlc_rb_t *rb = &ue->lcid2rb[channel_id - 1];
if (rb->type == NR_RLC_NONE)
return;
if (rb->type == NR_RLC_SRB) {
int id = rb->choice.srb_id - 1;
AssertFatal(id > 0, "logic bug: impossible to have srb0 here\n");
if (ue->srb[id]) {
ue->srb[id]->delete_entity(ue->srb[id]);
ue->srb[id] = NULL;
}
else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
}
else {
AssertFatal(rb->type == NR_RLC_DRB,
"Invalid RB type\n");
int id = rb->choice.drb_id - 1;
if (ue->drb[id]) {
ue->drb[id]->delete_entity(ue->drb[id]);
ue->drb[id] = NULL;
}
else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
}
}
static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t channel_id) static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t channel_id)
{ {
if (channel_id == 0) if (channel_id == 0)
...@@ -78,15 +107,12 @@ void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_id) ...@@ -78,15 +107,12 @@ void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_id)
if (channel_id == 0) { if (channel_id == 0) {
if (ue->srb0 != NULL) { if (ue->srb0 != NULL) {
free(ue->srb0->deliver_sdu_data); free(ue->srb0->deliver_sdu_data);
ue->srb0->delete (ue->srb0); ue->srb0->delete_entity(ue->srb0);
ue->srb0 = NULL;
} else } else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id); LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
} else { } else {
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_id); release_rlc_entity_from_lcid(ue, channel_id);
if (rb)
rb->delete(rb);
else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
...@@ -637,6 +663,7 @@ void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Co ...@@ -637,6 +663,7 @@ void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Co
*lc_Config->ul_SpecificParameters->logicalChannelGroup); *lc_Config->ul_SpecificParameters->logicalChannelGroup);
} }
if (rlc_Config) { if (rlc_Config) {
AssertFatal(rb->stats.mode != NR_RLC_TM, "Cannot reconfigure TM mode\n");
if (rb->stats.mode == NR_RLC_AM) { if (rb->stats.mode == NR_RLC_AM) {
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am, "Invalid RLC Config type\n"); AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am, "Invalid RLC Config type\n");
struct NR_RLC_Config__am *am = rlc_Config->choice.am; struct NR_RLC_Config__am *am = rlc_Config->choice.am;
......
...@@ -178,7 +178,7 @@ typedef enum { ...@@ -178,7 +178,7 @@ typedef enum {
IN_SYNC = 1 IN_SYNC = 1
} nr_sync_msg_t; } nr_sync_msg_t;
typedef enum { RB_NOT_PRESENT = 0, RB_ESTABLISHED, RB_SUSPENDED } NR_RB_status_t; typedef enum { RB_NOT_PRESENT, RB_ESTABLISHED, RB_SUSPENDED } NR_RB_status_t;
typedef struct NR_UE_RRC_SRB_INFO_s { typedef struct NR_UE_RRC_SRB_INFO_s {
NR_RB_status_t status; NR_RB_status_t status;
......
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