Commit 86564fdb authored by francescomani's avatar francescomani

reception of RRC Setup as response to re-establishment request

parent a02b8cf1
...@@ -1352,8 +1352,7 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up ...@@ -1352,8 +1352,7 @@ 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) {
...@@ -1368,13 +1367,14 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, ...@@ -1368,13 +1367,14 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
mac->ra.ra_state = RA_UE_IDLE; mac->ra.ra_state = RA_UE_IDLE;
} }
reset_mac_inst(mac); if (cause != RRC_SETUP_NOT_FROM_IDLE)
reset_mac_inst(mac);
nr_ue_mac_default_configs(mac); nr_ue_mac_default_configs(mac);
release_mac_configuration(mac, cause); release_mac_configuration(mac, cause);
// 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_NOT_FROM_IDLE) {
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;
......
...@@ -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_NOT_FROM_IDLE
} NR_UE_MAC_reset_cause_t; } NR_UE_MAC_reset_cause_t;
typedef enum { typedef enum {
......
...@@ -874,7 +874,52 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, ...@@ -874,7 +874,52 @@ 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
rrcPerNB_t *nb = &rrc->perNB[gNB_index];
for (int i = 0; i < MAX_DRBS_PER_UE; i++) {
if (nb->status_DRBs[i] != RB_NOT_PRESENT) {
nb->status_DRBs[i] = RB_NOT_PRESENT;
nr_pdcp_release_drb(rrc->ue_id, i + 1);
}
}
for (int i = 1; i < NR_NUM_SRB; i++) {
if (nb->Srb[i] != RB_NOT_PRESENT) {
nb->Srb[i] = RB_NOT_PRESENT;
nr_pdcp_release_srb(rrc->ue_id, i);
}
}
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
if (nb->active_RLC_entity[i]) {
nb->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_NOT_FROM_IDLE;
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,
...@@ -902,6 +947,8 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, ...@@ -902,6 +947,8 @@ 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;
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);
...@@ -1198,8 +1245,10 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, ...@@ -1198,8 +1245,10 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc,
if (LOG_DEBUGFLAG(DEBUG_ASN1)) if (LOG_DEBUGFLAG(DEBUG_ASN1))
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)radioBearerConfig); xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)radioBearerConfig);
if (radioBearerConfig->srb3_ToRelease) if (radioBearerConfig->srb3_ToRelease) {
nr_pdcp_release_srb(ue_rrc->ue_id, 3); nr_pdcp_release_srb(ue_rrc->ue_id, 3);
rrcNB->Srb[3] = RB_NOT_PRESENT;
}
uint8_t kRRCenc[16] = {0}; uint8_t kRRCenc[16] = {0};
uint8_t kRRCint[16] = {0}; uint8_t kRRCint[16] = {0};
...@@ -1245,8 +1294,10 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, ...@@ -1245,8 +1294,10 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc,
if (radioBearerConfig->drb_ToReleaseList) { if (radioBearerConfig->drb_ToReleaseList) {
for (int cnt = 0; cnt < radioBearerConfig->drb_ToReleaseList->list.count; cnt++) { for (int cnt = 0; cnt < radioBearerConfig->drb_ToReleaseList->list.count; cnt++) {
NR_DRB_Identity_t *DRB_id = radioBearerConfig->drb_ToReleaseList->list.array[cnt]; NR_DRB_Identity_t *DRB_id = radioBearerConfig->drb_ToReleaseList->list.array[cnt];
if (DRB_id) if (DRB_id) {
nr_pdcp_release_drb(ue_rrc->ue_id, *DRB_id); nr_pdcp_release_drb(ue_rrc->ue_id, *DRB_id);
rrcNB->status_DRBs[*DRB_id - 1] = RB_NOT_PRESENT;
}
} }
} }
...@@ -1316,6 +1367,9 @@ static void nr_rrc_ue_process_rrcReestablishment(NR_UE_RRC_INST_t *rrc, ...@@ -1316,6 +1367,9 @@ static void nr_rrc_ue_process_rrcReestablishment(NR_UE_RRC_INST_t *rrc,
// release the measurement gap configuration indicated by the measGapConfig, if configured // release the measurement gap configuration indicated by the measGapConfig, if configured
rrcPerNB_t *rrcNB = rrc->perNB + gNB_index; rrcPerNB_t *rrcNB = rrc->perNB + gNB_index;
asn1cFreeStruc(asn_DEF_NR_MeasGapConfig, rrcNB->measGapConfig); asn1cFreeStruc(asn_DEF_NR_MeasGapConfig, rrcNB->measGapConfig);
rrc->ra_trigger = RA_NOT_RUNNING;
// submit the RRCReestablishmentComplete message to lower layers for transmission // submit the RRCReestablishmentComplete message to lower layers for transmission
nr_rrc_ue_generate_rrcReestablishmentComplete(rrc, rrcReestablishment); nr_rrc_ue_generate_rrcReestablishmentComplete(rrc, rrcReestablishment);
} }
......
...@@ -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