Commit 3ec4be5b authored by francescomani's avatar francescomani

Reception of RRC Setup as response to re-establishment request

It also introduces state for resume request (even if not yet implemented)
parent 4f6339ff
...@@ -1354,15 +1354,15 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up ...@@ -1354,15 +1354,15 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up
} }
} }
void nr_rrc_mac_config_req_reset(module_id_t module_id, void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause)
NR_UE_MAC_reset_cause_t cause)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
if (cause == GO_TO_IDLE) { if (cause == GO_TO_IDLE) {
reset_ra(&mac->ra); reset_ra(&mac->ra);
nr_ue_init_mac(mac); nr_ue_init_mac(mac);
} else { } else {
reset_mac_inst(mac); if (cause != RRC_SETUP_REESTAB_RESUME)
reset_mac_inst(mac);
} }
nr_ue_mac_default_configs(mac); nr_ue_mac_default_configs(mac);
...@@ -1373,7 +1373,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, ...@@ -1373,7 +1373,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
// Sending to PHY a request to resync // Sending to PHY a request to resync
// with no target cell ID // with no target cell ID
if (cause != DETACH) { if (cause != DETACH && cause != RRC_SETUP_REESTAB_RESUME) {
mac->synch_request.Mod_id = module_id; mac->synch_request.Mod_id = module_id;
mac->synch_request.CC_id = 0; mac->synch_request.CC_id = 0;
mac->synch_request.synch_req.target_Nid_cell = -1; mac->synch_request.synch_req.target_Nid_cell = -1;
...@@ -1998,6 +1998,21 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, ...@@ -1998,6 +1998,21 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
} }
} }
if (mac->bwp_released_before_setup) {
// if we are doing RRC Setup after re-establishment we cleared BWP
// if there was no switching to a BWP > 0 in configure_BWPs
// we need to set initial BWP as current BWP
if (!mac->current_DL_BWP) {
mac->current_DL_BWP = get_dl_bwp_structure(mac, 0, false);
AssertFatal(mac->current_DL_BWP, "Couldn't find DL-BWP0\n");
}
if (!mac->current_UL_BWP) {
mac->current_UL_BWP = get_ul_bwp_structure(mac, 0, false);
AssertFatal(mac->current_UL_BWP, "Couldn't find DL-BWP0\n");
}
mac->bwp_released_before_setup = false;
}
configure_logicalChannelBearer(mac, configure_logicalChannelBearer(mac,
cell_group_config->rlc_BearerToAddModList, cell_group_config->rlc_BearerToAddModList,
cell_group_config->rlc_BearerToReleaseList); cell_group_config->rlc_BearerToReleaseList);
......
...@@ -169,7 +169,8 @@ typedef enum { ...@@ -169,7 +169,8 @@ typedef enum {
GO_TO_IDLE, GO_TO_IDLE,
DETACH, DETACH,
T300_EXPIRY, T300_EXPIRY,
RE_ESTABLISHMENT RE_ESTABLISHMENT,
RRC_SETUP_REESTAB_RESUME
} NR_UE_MAC_reset_cause_t; } NR_UE_MAC_reset_cause_t;
typedef enum { typedef enum {
...@@ -472,6 +473,7 @@ typedef struct NR_UE_MAC_INST_s { ...@@ -472,6 +473,7 @@ typedef struct NR_UE_MAC_INST_s {
NR_SearchSpace_t *search_space_zero; NR_SearchSpace_t *search_space_zero;
NR_UE_DL_BWP_t *current_DL_BWP; NR_UE_DL_BWP_t *current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP; NR_UE_UL_BWP_t *current_UL_BWP;
bool bwp_released_before_setup;
bool harq_ACK_SpatialBundlingPUCCH; bool harq_ACK_SpatialBundlingPUCCH;
bool harq_ACK_SpatialBundlingPUSCH; bool harq_ACK_SpatialBundlingPUSCH;
......
...@@ -65,6 +65,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac) ...@@ -65,6 +65,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
mac->servCellIndex = 0; mac->servCellIndex = 0;
mac->harq_ACK_SpatialBundlingPUCCH = false; mac->harq_ACK_SpatialBundlingPUCCH = false;
mac->harq_ACK_SpatialBundlingPUSCH = false; mac->harq_ACK_SpatialBundlingPUSCH = false;
mac->bwp_released_before_setup = false;
mac->uecap_maxMIMO_PDSCH_layers = 0; mac->uecap_maxMIMO_PDSCH_layers = 0;
mac->uecap_maxMIMO_PUSCH_layers_cb = 0; mac->uecap_maxMIMO_PUSCH_layers_cb = 0;
mac->uecap_maxMIMO_PUSCH_layers_nocb = 0; mac->uecap_maxMIMO_PUSCH_layers_nocb = 0;
...@@ -228,6 +229,9 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac, ...@@ -228,6 +229,9 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac,
mac->current_DL_BWP = NULL; mac->current_DL_BWP = NULL;
mac->current_UL_BWP = NULL; mac->current_UL_BWP = NULL;
if (cause == RRC_SETUP_REESTAB_RESUME)
mac->bwp_released_before_setup = true;
// in case of re-establishment we don't need to release initial BWP config common // in case of re-establishment we don't need to release initial BWP config common
int first_bwp_rel = 0; // first BWP to release int first_bwp_rel = 0; // first BWP to release
if (cause == RE_ESTABLISHMENT) { if (cause == RE_ESTABLISHMENT) {
......
...@@ -899,7 +899,51 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, ...@@ -899,7 +899,51 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc,
{ {
// if the RRCSetup is received in response to an RRCReestablishmentRequest // if the RRCSetup is received in response to an RRCReestablishmentRequest
// or RRCResumeRequest or RRCResumeRequest1 // or RRCResumeRequest or RRCResumeRequest1
// TODO none of the procedures implemented yet if (rrc->ra_trigger == RRC_CONNECTION_REESTABLISHMENT || rrc->ra_trigger == RRC_RESUME_REQUEST) {
LOG_W(NR_RRC, "[UE %ld] Recived RRC Setup in response to %s request\n",
rrc->ue_id, rrc->ra_trigger == RRC_CONNECTION_REESTABLISHMENT ? "re-establishment" : "resume");
// discard any stored UE Inactive AS context and suspendConfig
// TODO
// discard any current AS security context including
// K_RRCenc key, the K_RRCint key, the K_UPint key and the K_UPenc key
// TODO only kgnb is stored
memset(rrc->kgnb, 0, sizeof(rrc->kgnb));
rrc->as_security_activated = false;
// release radio resources for all established RBs except SRB0,
// including release of the RLC entities, of the associated PDCP entities and of SDAP
for (int i = 1; i <= MAX_DRBS_PER_UE; i++) {
if (get_DRB_status(rrc, i) != RB_NOT_PRESENT) {
set_DRB_status(rrc, i, RB_NOT_PRESENT);
nr_pdcp_release_drb(rrc->ue_id, i);
}
}
for (int i = 1; i < NR_NUM_SRB; i++) {
if (rrc->Srb[i] != RB_NOT_PRESENT) {
rrc->Srb[i] = RB_NOT_PRESENT;
nr_pdcp_release_srb(rrc->ue_id, i);
}
}
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
if (rrc->active_RLC_entity[i]) {
rrc->active_RLC_entity[i] = false;
nr_rlc_release_entity(rrc->ue_id, i);
}
}
// release the RRC configuration except for the default L1 parameter values,
// default MAC Cell Group configuration and CCCH configuration
// TODO to be completed
NR_UE_MAC_reset_cause_t cause = RRC_SETUP_REESTAB_RESUME;
nr_rrc_mac_config_req_reset(rrc->ue_id, cause);
// indicate to upper layers fallback of the RRC connection
// TODO
// stop timer T380, if running
// TODO not implemented yet
}
// perform the cell group configuration procedure in accordance with the received masterCellGroup // perform the cell group configuration procedure in accordance with the received masterCellGroup
nr_rrc_ue_process_masterCellGroup(rrc, nr_rrc_ue_process_masterCellGroup(rrc,
...@@ -925,6 +969,9 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, ...@@ -925,6 +969,9 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc,
// enter RRC_CONNECTED // enter RRC_CONNECTED
rrc->nrRrcState = RRC_STATE_CONNECTED_NR; rrc->nrRrcState = RRC_STATE_CONNECTED_NR;
// resetting the RA trigger state after receiving MSG4 with RRCSetup
rrc->ra_trigger = RA_NOT_RUNNING;
// set the content of RRCSetupComplete message // set the content of RRCSetupComplete message
// TODO procedues described in 5.3.3.4 seems more complex than what we actualy do // TODO procedues described in 5.3.3.4 seems more complex than what we actualy do
rrc_ue_generate_RRCSetupComplete(rrc, rrcSetup->rrc_TransactionIdentifier); rrc_ue_generate_RRCSetupComplete(rrc, rrcSetup->rrc_TransactionIdentifier);
......
...@@ -104,6 +104,7 @@ typedef enum RA_trigger_e { ...@@ -104,6 +104,7 @@ typedef enum RA_trigger_e {
RA_NOT_RUNNING, RA_NOT_RUNNING,
INITIAL_ACCESS_FROM_RRC_IDLE, INITIAL_ACCESS_FROM_RRC_IDLE,
RRC_CONNECTION_REESTABLISHMENT, RRC_CONNECTION_REESTABLISHMENT,
RRC_RESUME_REQUEST,
DURING_HANDOVER, DURING_HANDOVER,
NON_SYNCHRONISED, NON_SYNCHRONISED,
TRANSITION_FROM_RRC_INACTIVE, TRANSITION_FROM_RRC_INACTIVE,
......
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