|
|
|
@@ -196,7 +196,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
|
|
|
|
|
pthread_mutex_unlock(&rrc->cell_info_mutex);
|
|
|
|
|
|
|
|
|
|
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
UE->spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
|
|
|
|
|
UE->spCellConfig->spCellConfigDedicated = configuration->scd;
|
|
|
|
@@ -344,27 +344,21 @@ void apply_macrlc_config_reest(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
static void rrc_gNB_generate_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
static void rrc_gNB_generate_RRCSetup(instance_t instance,
|
|
|
|
|
rnti_t rnti,
|
|
|
|
|
rrc_gNB_ue_context_t *const ue_context_pP,
|
|
|
|
|
const uint8_t *masterCellGroup,
|
|
|
|
|
int masterCellGroup_len,
|
|
|
|
|
NR_ServingCellConfigCommon_t *scc)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04lx\n", ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04x\n", rnti);
|
|
|
|
|
|
|
|
|
|
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[instance];
|
|
|
|
|
unsigned char buf[1024];
|
|
|
|
|
const NR_ServingCellConfig_t *sccd = rrc->configuration.scd;
|
|
|
|
|
int size = do_RRCSetup(ue_context_pP,
|
|
|
|
|
buf,
|
|
|
|
|
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
|
|
|
|
|
masterCellGroup,
|
|
|
|
|
masterCellGroup_len,
|
|
|
|
|
scc,
|
|
|
|
|
sccd,
|
|
|
|
|
&rrc->configuration);
|
|
|
|
|
int size = do_RRCSetup(ue_context_pP, buf, rrc_gNB_get_next_transaction_identifier(instance), masterCellGroup, masterCellGroup_len, scc, sccd, &rrc->configuration);
|
|
|
|
|
AssertFatal(size > 0, "do_RRCSetup failed\n");
|
|
|
|
|
AssertFatal(size <= 1024, "memory corruption\n");
|
|
|
|
|
|
|
|
|
@@ -379,7 +373,7 @@ static void rrc_gNB_generate_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
|
|
|
|
|
|
|
|
|
|
/* TODO: this should go through the E1 interface */
|
|
|
|
|
nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL);
|
|
|
|
|
nr_pdcp_add_srbs(true, rnti, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
f1ap_dl_rrc_message_t dl_rrc = {
|
|
|
|
|
.old_gNB_DU_ue_id = 0xFFFFFF,
|
|
|
|
@@ -388,31 +382,24 @@ static void rrc_gNB_generate_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
.rnti = ue_p->rnti,
|
|
|
|
|
.srb_id = CCCH
|
|
|
|
|
};
|
|
|
|
|
rrc->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
|
|
|
|
|
rrc->mac_rrc.dl_rrc_message_transfer(instance, &dl_rrc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
static void rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(const protocol_ctxt_t *const ctxt_pP, const int CC_id)
|
|
|
|
|
static void rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id_t module_id, rnti_t rnti, const int CC_id)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
LOG_I(NR_RRC, "generate RRCSetup for RRCReestablishmentRequest \n");
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_pP = NULL;
|
|
|
|
|
gNB_RRC_INST *rrc_instance_p = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
gNB_RRC_INST *rrc_instance_p = RC.nrrrc[module_id];
|
|
|
|
|
const NR_ServingCellConfigCommon_t *scc=rrc_instance_p->carrier.servingcellconfigcommon;
|
|
|
|
|
const NR_ServingCellConfig_t *sccd = rrc_instance_p->configuration.scd;
|
|
|
|
|
|
|
|
|
|
ue_context_pP = rrc_gNB_create_ue_context(ctxt_pP, rrc_instance_p, 0);
|
|
|
|
|
ue_context_pP = rrc_gNB_create_ue_context(rnti, rrc_instance_p, 0);
|
|
|
|
|
|
|
|
|
|
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
|
|
|
|
unsigned char buf[1024];
|
|
|
|
|
int size = do_RRCSetup(ue_context_pP,
|
|
|
|
|
buf,
|
|
|
|
|
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
|
|
|
|
|
NULL,
|
|
|
|
|
0,
|
|
|
|
|
scc,
|
|
|
|
|
sccd,
|
|
|
|
|
&rrc_instance_p->configuration);
|
|
|
|
|
int size = do_RRCSetup(ue_context_pP, buf, rrc_gNB_get_next_transaction_identifier(module_id), NULL, 0, scc, sccd, &rrc_instance_p->configuration);
|
|
|
|
|
AssertFatal(size > 0, "do_RRCSetup failed\n");
|
|
|
|
|
AssertFatal(size <= 1024, "memory corruption\n");
|
|
|
|
|
|
|
|
|
@@ -423,9 +410,7 @@ static void rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(const protoc
|
|
|
|
|
size,
|
|
|
|
|
"[MSG] RRC Setup\n");
|
|
|
|
|
|
|
|
|
|
LOG_D(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_D(NR_RRC, "RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB for rnti %04x\n", rnti);
|
|
|
|
|
|
|
|
|
|
rrc_mac_config_req_gNB(rrc_instance_p->module_id,
|
|
|
|
|
rrc_instance_p->configuration.pdsch_AntennaPorts,
|
|
|
|
@@ -436,19 +421,18 @@ static void rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(const protoc
|
|
|
|
|
&rrc_instance_p->carrier.mib,
|
|
|
|
|
rrc_instance_p->carrier.siblock1,
|
|
|
|
|
0,
|
|
|
|
|
ue_context_pP->ue_context.rnti,
|
|
|
|
|
rnti,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
size);
|
|
|
|
|
LOG_I(NR_RRC, " [RAPROC] rnti: %04x Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", rnti, size);
|
|
|
|
|
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
|
|
|
|
|
ue_context_pP->ue_context.ue_release_timer = 1;
|
|
|
|
|
// remove UE after 10 frames after RRCConnectionRelease is triggered
|
|
|
|
|
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
|
|
|
|
|
// configure MAC
|
|
|
|
|
apply_macrlc_config(rrc_instance_p,ue_context_pP,ctxt_pP);
|
|
|
|
|
protocol_ctxt_t ctxt = {0};
|
|
|
|
|
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, 0, GNB_FLAG_YES, rnti, 0, 0);
|
|
|
|
|
apply_macrlc_config(rrc_instance_p, ue_context_pP, &ctxt);
|
|
|
|
|
|
|
|
|
|
//nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL);
|
|
|
|
|
//apply_pdcp_config(ue_context_pP,ctxt_pP);
|
|
|
|
@@ -462,18 +446,18 @@ static void rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(const protoc
|
|
|
|
|
.rnti = ue_p->rnti,
|
|
|
|
|
.srb_id = CCCH
|
|
|
|
|
};
|
|
|
|
|
rrc_instance_p->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
|
|
|
|
|
rrc_instance_p->mac_rrc.dl_rrc_message_transfer(module_id, &dl_rrc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rrc_gNB_generate_RRCReject(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP)
|
|
|
|
|
static void rrc_gNB_generate_RRCReject(module_id_t module_id, rrc_gNB_ue_context_t *const ue_context_pP)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n");
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[module_id];
|
|
|
|
|
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
|
|
|
|
|
|
|
|
|
unsigned char buf[1024];
|
|
|
|
|
int size = do_RRCReject(ctxt_pP->module_id, buf);
|
|
|
|
|
int size = do_RRCReject(module_id, buf);
|
|
|
|
|
AssertFatal(size > 0, "do_RRCReject failed\n");
|
|
|
|
|
AssertFatal(size <= 1024, "memory corruption\n");
|
|
|
|
|
|
|
|
|
@@ -481,10 +465,7 @@ static void rrc_gNB_generate_RRCReject(const protocol_ctxt_t *const ctxt_pP, rrc
|
|
|
|
|
(char *)buf,
|
|
|
|
|
size,
|
|
|
|
|
"[MSG] RRCReject \n");
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
size);
|
|
|
|
|
LOG_I(NR_RRC, " [RAPROC] ue %04x Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n", ue_p->rnti, size);
|
|
|
|
|
|
|
|
|
|
f1ap_dl_rrc_message_t dl_rrc = {
|
|
|
|
|
.gNB_CU_ue_id = 0,
|
|
|
|
@@ -497,7 +478,7 @@ static void rrc_gNB_generate_RRCReject(const protocol_ctxt_t *const ctxt_pP, rrc
|
|
|
|
|
.execute_duplication = 1,
|
|
|
|
|
.RAT_frequency_priority_information.en_dc = 0
|
|
|
|
|
};
|
|
|
|
|
rrc->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
|
|
|
|
|
rrc->mac_rrc.dl_rrc_message_transfer(module_id, &dl_rrc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
@@ -525,6 +506,7 @@ static void rrc_gNB_process_RRCSetupComplete(const protocol_ctxt_t *const ctxt_p
|
|
|
|
|
static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
|
|
|
|
|
|
|
|
|
|
/******************** Radio Bearer Config ********************/
|
|
|
|
@@ -554,7 +536,6 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co
|
|
|
|
|
dedicatedNAS_MessageList = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
NR_MeasConfig_t *measconfig = get_defaultMeasConfig(&rrc->configuration);
|
|
|
|
|
|
|
|
|
|
uint8_t buffer[RRC_BUF_SIZE] = {0};
|
|
|
|
@@ -1112,12 +1093,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
|
|
|
|
|
/*
|
|
|
|
|
* Process the RRC Reconfiguration Complete from the UE
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
rrc_gNB_process_RRCReconfigurationComplete(
|
|
|
|
|
const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_pP,
|
|
|
|
|
const uint8_t xid
|
|
|
|
|
)
|
|
|
|
|
static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP, const uint8_t xid)
|
|
|
|
|
{
|
|
|
|
|
int drb_id;
|
|
|
|
|
uint8_t *kRRCenc = NULL;
|
|
|
|
@@ -1309,7 +1285,7 @@ void rrc_gNB_generate_RRCReestablishment(const protocol_ctxt_t *ctxt_pP,
|
|
|
|
|
scc,
|
|
|
|
|
&rrc->carrier);
|
|
|
|
|
|
|
|
|
|
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), size);
|
|
|
|
|
LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size);
|
|
|
|
|
#if (0)
|
|
|
|
|
/* TODO : It may be needed if gNB goes into full stack working. */
|
|
|
|
|
UE = find_nr_UE(module_id, rnti);
|
|
|
|
@@ -1319,7 +1295,7 @@ void rrc_gNB_generate_RRCReestablishment(const protocol_ctxt_t *ctxt_pP,
|
|
|
|
|
/* Reject UE after 10 frames, NR_RRCReestablishmentReject is triggered */
|
|
|
|
|
RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 100;
|
|
|
|
|
} else {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " Generating NR_RRCReestablishment without UE_id(MAC) rnti %x\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), rnti);
|
|
|
|
|
LOG_E(NR_RRC, " Generating NR_RRCReestablishment without UE_id(MAC) rnti %x\n", rnti);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@@ -1345,7 +1321,7 @@ void rrc_gNB_generate_RRCReestablishment(const protocol_ctxt_t *ctxt_pP,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_D(NR_RRC, "UE %04x --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", ue_p->rnti);
|
|
|
|
|
}
|
|
|
|
|
} // if (*SRB_configList != NULL)
|
|
|
|
|
|
|
|
|
@@ -1370,10 +1346,8 @@ void rrc_gNB_generate_RRCReestablishment(const protocol_ctxt_t *ctxt_pP,
|
|
|
|
|
void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctxt_pP, const rnti_t reestablish_rnti, rrc_gNB_ue_context_t *ue_context_pP, const uint8_t xid)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing NR_RRCReestablishmentComplete from UE (SRB1 Active)\n",
|
|
|
|
|
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
|
|
|
|
|
LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel UL-DCCH, processing NR_RRCReestablishmentComplete from UE (SRB1 Active)\n", ue_p->rnti);
|
|
|
|
|
|
|
|
|
|
NR_DRB_ToAddModList_t *DRB_configList = ue_p->DRB_configList;
|
|
|
|
|
NR_SRB_ToAddModList_t *SRB_configList = ue_p->SRB_configList;
|
|
|
|
@@ -1665,26 +1639,20 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------*/
|
|
|
|
|
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
const uint8_t *buffer,
|
|
|
|
|
int buffer_length,
|
|
|
|
|
const uint8_t *du_to_cu_rrc_container,
|
|
|
|
|
int du_to_cu_rrc_container_len)
|
|
|
|
|
static int nr_rrc_gNB_decode_ccch(module_id_t module_id, rnti_t rnti, const uint8_t *buffer, int buffer_length, const uint8_t *du_to_cu_rrc_container, int du_to_cu_rrc_container_len)
|
|
|
|
|
{
|
|
|
|
|
module_id_t Idx;
|
|
|
|
|
asn_dec_rval_t dec_rval;
|
|
|
|
|
NR_UL_CCCH_Message_t *ul_ccch_msg = NULL;
|
|
|
|
|
gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[module_id];
|
|
|
|
|
NR_RRCSetupRequest_IEs_t *rrcSetupRequest = NULL;
|
|
|
|
|
NR_RRCReestablishmentRequest_IEs_t rrcReestablishmentRequest;
|
|
|
|
|
|
|
|
|
|
LOG_I(NR_RRC, "Decoding CCCH: RNTI %04lx, inst %ld, payload_size %d\n", ctxt_pP->rntiMaybeUEid, ctxt_pP->instance, buffer_length);
|
|
|
|
|
LOG_I(NR_RRC, "Decoding CCCH: RNTI %04x, payload_size %d\n", rnti, buffer_length);
|
|
|
|
|
dec_rval = uper_decode(NULL, &asn_DEF_NR_UL_CCCH_Message, (void **) &ul_ccch_msg, buffer, buffer_length, 0, 0);
|
|
|
|
|
|
|
|
|
|
if (dec_rval.code != RC_OK || dec_rval.consumed == 0) {
|
|
|
|
|
LOG_E(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_E(NR_RRC, " FATAL Error in receiving CCCH\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1692,16 +1660,15 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
switch (ul_ccch_msg->message.choice.c1->present) {
|
|
|
|
|
case NR_UL_CCCH_MessageType__c1_PR_NOTHING:
|
|
|
|
|
/* TODO */
|
|
|
|
|
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT " Received PR_NOTHING on UL-CCCH-Message\n", PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
|
|
|
|
|
LOG_I(NR_RRC, "Received PR_NOTHING on UL-CCCH-Message\n");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest:
|
|
|
|
|
LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %lx)\n", ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %04x)\n", rnti);
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(gnb_rrc_inst, rnti);
|
|
|
|
|
if (ue_context_p != NULL) {
|
|
|
|
|
LOG_W(NR_RRC, "Got RRC setup request for a already registered RNTI %x, dropping the old one\n", UE->rnti);
|
|
|
|
|
rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p);
|
|
|
|
|
LOG_W(NR_RRC, "Got RRC setup request for a already registered RNTI %x, dropping the old one and give up this rrcSetupRequest\n", ue_context_p->ue_context.rnti);
|
|
|
|
|
rrc_gNB_remove_ue_context(gnb_rrc_inst, ue_context_p);
|
|
|
|
|
} else {
|
|
|
|
|
rrcSetupRequest = &ul_ccch_msg->message.choice.c1->choice.rrcSetupRequest->rrcSetupRequest;
|
|
|
|
|
if (NR_InitialUE_Identity_PR_randomValue == rrcSetupRequest->ue_Identity.present) {
|
|
|
|
@@ -1716,13 +1683,13 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
/* if there is already a registered UE (with another RNTI) with this random_value,
|
|
|
|
|
* the current one must be removed from MAC/PHY (zombie UE)
|
|
|
|
|
*/
|
|
|
|
|
if ((ue_context_p = rrc_gNB_ue_context_random_exist(RC.nrrrc[ctxt_pP->module_id], random_value))) {
|
|
|
|
|
UE = &ue_context_p->ue_context;
|
|
|
|
|
LOG_W(NR_RRC, "new UE rnti %lx (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", ctxt_pP->rntiMaybeUEid, UE->rnti, UE->rnti);
|
|
|
|
|
if ((ue_context_p = rrc_gNB_ue_context_random_exist(gnb_rrc_inst, random_value))) {
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
LOG_W(NR_RRC, "new UE rnti (coming with random value) is already there, removing UE %x from MAC/PHY\n", rnti);
|
|
|
|
|
UE->ul_failure_timer = 20000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ue_context_p = rrc_gNB_create_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
|
|
|
|
|
ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, random_value);
|
|
|
|
|
} else if (NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1 == rrcSetupRequest->ue_Identity.present) {
|
|
|
|
|
/* TODO */
|
|
|
|
|
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
|
|
|
|
@@ -1738,20 +1705,16 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.buf,
|
|
|
|
|
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
|
|
|
|
|
|
|
|
|
|
if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) {
|
|
|
|
|
UE = &ue_context_p->ue_context;
|
|
|
|
|
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %lx\n", ue_context_p, UE->rnti, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(gnb_rrc_inst, s_tmsi_part1))) {
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, old rnti %04x => %04x\n", UE->rnti, rnti);
|
|
|
|
|
|
|
|
|
|
// TODO: MAC structures should not be accessed directly from the RRC! An implementation using the F1 interface should be developed.
|
|
|
|
|
gNB_MAC_INST *nrmac = RC.nrmac[ctxt_pP->module_id]; // WHAT A BEAUTIFULL RACE CONDITION !!!
|
|
|
|
|
gNB_MAC_INST *nrmac = RC.nrmac[module_id]; // why MAC instances match RRC instances ?
|
|
|
|
|
mac_remove_nr_ue(nrmac, UE->rnti);
|
|
|
|
|
|
|
|
|
|
/* replace rnti in the context */
|
|
|
|
|
/* for that, remove the context from the RB tree */
|
|
|
|
|
RB_REMOVE(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
|
|
|
|
|
/* and insert again, after changing rnti everywhere it has to be changed */
|
|
|
|
|
UE->rnti = ctxt_pP->rntiMaybeUEid;
|
|
|
|
|
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
|
|
|
|
|
UE->rnti = rnti;
|
|
|
|
|
/* reset timers */
|
|
|
|
|
UE->ul_failure_timer = 0;
|
|
|
|
|
UE->ue_release_timer = 0;
|
|
|
|
@@ -1759,32 +1722,33 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
UE->ue_release_timer_s1 = 0;
|
|
|
|
|
UE->ue_release_timer_rrc = 0;
|
|
|
|
|
} else {
|
|
|
|
|
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 to %p => %ld\n", ue_context_p, s_tmsi_part1);
|
|
|
|
|
LOG_I(NR_RRC, "UE %04x 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 => %ld\n", rnti, s_tmsi_part1);
|
|
|
|
|
|
|
|
|
|
ue_context_p = rrc_gNB_create_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1);
|
|
|
|
|
ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, s_tmsi_part1);
|
|
|
|
|
if (ue_context_p == NULL) {
|
|
|
|
|
LOG_E(NR_RRC, "%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
LOG_E(NR_RRC, "rrc_gNB_get_next_free_ue_context returned NULL\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
UE = &ue_context_p->ue_context;
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
UE->Initialue_identity_5g_s_TMSI.presence = true;
|
|
|
|
|
UE->ng_5G_S_TMSI_Part1 = s_tmsi_part1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* TODO */
|
|
|
|
|
uint64_t random_value = 0;
|
|
|
|
|
memcpy(((uint8_t *)&random_value) + 3, rrcSetupRequest->ue_Identity.choice.randomValue.buf, rrcSetupRequest->ue_Identity.choice.randomValue.size);
|
|
|
|
|
|
|
|
|
|
rrc_gNB_create_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
rrc_gNB_generate_RRCReject(ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid));
|
|
|
|
|
ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, random_value);
|
|
|
|
|
LOG_E(NR_RRC, "RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE %04x\n", rnti);
|
|
|
|
|
rrc_gNB_generate_RRCReject(module_id, ue_context_p);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
UE = &ue_context_p->ue_context;
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
UE = &ue_context_p->ue_context;
|
|
|
|
|
UE->establishment_cause = rrcSetupRequest->establishmentCause;
|
|
|
|
|
|
|
|
|
|
rrc_gNB_generate_RRCSetup(
|
|
|
|
|
ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid), du_to_cu_rrc_container, du_to_cu_rrc_container_len, gnb_rrc_inst->carrier.servingcellconfigcommon);
|
|
|
|
|
module_id, rnti, rrc_gNB_get_ue_context_by_rnti(gnb_rrc_inst, rnti), du_to_cu_rrc_container, du_to_cu_rrc_container_len, gnb_rrc_inst->carrier.servingcellconfigcommon);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@@ -1793,30 +1757,28 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NR_UL_CCCH_MessageType__c1_PR_rrcReestablishmentRequest: {
|
|
|
|
|
LOG_I(NR_RRC, "Received rrcReestablishmentRequest message\n");
|
|
|
|
|
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(buffer), buffer_length, "[MSG] RRC Reestablishment Request\n");
|
|
|
|
|
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT "MAC_gNB--- MAC_DATA_IND (rrcReestablishmentRequest on SRB0) --> RRC_gNB\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
|
|
|
|
|
rrcReestablishmentRequest = ul_ccch_msg->message.choice.c1->choice.rrcReestablishmentRequest->rrcReestablishmentRequest;
|
|
|
|
|
const NR_ReestablishmentCause_t cause = rrcReestablishmentRequest.reestablishmentCause;
|
|
|
|
|
const long physCellId = rrcReestablishmentRequest.ue_Identity.physCellId;
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT " NR_RRCReestablishmentRequest cause %s\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
((rrcReestablishmentRequest.reestablishmentCause == NR_ReestablishmentCause_otherFailure) ? "Other Failure"
|
|
|
|
|
: (rrcReestablishmentRequest.reestablishmentCause == NR_ReestablishmentCause_handoverFailure) ? "Handover Failure"
|
|
|
|
|
: "reconfigurationFailure"));
|
|
|
|
|
"UE %04x NR_RRCReestablishmentRequest cause %s\n",
|
|
|
|
|
rnti,
|
|
|
|
|
((cause == NR_ReestablishmentCause_otherFailure) ? "Other Failure"
|
|
|
|
|
: (cause == NR_ReestablishmentCause_handoverFailure) ? "Handover Failure"
|
|
|
|
|
: "reconfigurationFailure"));
|
|
|
|
|
|
|
|
|
|
if (rrcReestablishmentRequest.ue_Identity.physCellId != RC.nrrrc[ctxt_pP->module_id]->carrier.physCellId) {
|
|
|
|
|
if (physCellId != gnb_rrc_inst->carrier.physCellId) {
|
|
|
|
|
/* UE was moving from previous cell so quickly that RRCReestablishment for previous cell was received in this cell */
|
|
|
|
|
LOG_E(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT " NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), fallback to RRC establishment\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
rrcReestablishmentRequest.ue_Identity.physCellId,
|
|
|
|
|
RC.nrrrc[ctxt_pP->module_id]->carrier.physCellId);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0);
|
|
|
|
|
" NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), fallback to RRC establishment\n",
|
|
|
|
|
physCellId,
|
|
|
|
|
gnb_rrc_inst->carrier.physCellId);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id, rnti, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG_I(NR_RRC, "physCellId: %ld\n", rrcReestablishmentRequest.ue_Identity.physCellId);
|
|
|
|
|
LOG_I(NR_RRC, "physCellId: %ld\n", physCellId);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < rrcReestablishmentRequest.ue_Identity.shortMAC_I.size; i++) {
|
|
|
|
|
LOG_D(NR_RRC, "rrcReestablishmentRequest.ue_Identity.shortMAC_I.buf[%d] = %x\n", i, rrcReestablishmentRequest.ue_Identity.shortMAC_I.buf[i]);
|
|
|
|
@@ -1826,7 +1788,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
if (rrcReestablishmentRequest.ue_Identity.c_RNTI < 0x1 || rrcReestablishmentRequest.ue_Identity.c_RNTI > 0xffef) {
|
|
|
|
|
/* c_RNTI range error should not happen */
|
|
|
|
|
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest c_RNTI range error, fallback to RRC establishment\n");
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id, rnti, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1836,17 +1798,14 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
if (ue_context_p == NULL) {
|
|
|
|
|
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest without UE context, fallback to RRC establishment\n");
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id, c_rnti, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if (0)
|
|
|
|
|
/* TODO : It may be needed if gNB goes into full stack working. */
|
|
|
|
|
int UE_id = find_nr_UE_id(ctxt_pP->module_id, c_rnti);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
int UE_id = find_nr_UE_id(gnb_rrc_inst, c_rnti);
|
|
|
|
|
if (UE_id == -1) {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " NR_RRCReestablishmentRequest without UE_id(MAC) rnti %x, fallback to RRC establishment\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), c_rnti);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0);
|
|
|
|
|
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest without MAC context, rnti %04x, fallback to RRC establishment\n", c_rnti);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id, rnti, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1861,14 +1820,11 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (previous_rnti != 0) {
|
|
|
|
|
UE_id = find_nr_UE_id(ctxt_pP->module_id, previous_rnti);
|
|
|
|
|
|
|
|
|
|
UE_id = find_nr_UE_id(gnb_rrc_inst, previous_rnti);
|
|
|
|
|
if (UE_id == -1) {
|
|
|
|
|
LOG_E(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT " RRCReestablishmentRequest without UE_id(MAC) previous rnti %x, fallback to RRC establishment\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
previous_rnti);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0);
|
|
|
|
|
LOG_E(NR_RRC,"RRCReestablishmentRequest without mac context previous rnti %04x, nex rnti %04x, fallback to RRC establishment\n",
|
|
|
|
|
previous_rnti, c_rnti);
|
|
|
|
|
rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id, rnti, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1884,7 +1840,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
LOG_E(NR_RRC, "RRRCReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status NR_RRC_RECONFIGURED\n", UE->StatusRrc);
|
|
|
|
|
UE->StatusRrc = NR_RRC_RECONFIGURED;
|
|
|
|
|
protocol_ctxt_t ctxt_old_p;
|
|
|
|
|
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, ctxt_pP->instance, GNB_FLAG_YES, c_rnti, ctxt_pP->frame, ctxt_pP->subframe);
|
|
|
|
|
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, module_id, GNB_FLAG_YES, c_rnti, 0, 0);
|
|
|
|
|
rrc_gNB_process_RRCReconfigurationComplete(&ctxt_old_p, ue_context_p, UE->reestablishment_xid);
|
|
|
|
|
|
|
|
|
|
for (uint8_t pdusessionid = 0; pdusessionid < UE->nb_of_pdusessions; pdusessionid++) {
|
|
|
|
@@ -1906,18 +1862,18 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
|
|
|
|
|
// Insert C-RNTI to map
|
|
|
|
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
|
|
|
|
nr_reestablish_rnti_map_t *nr_reestablish_rnti_map = &(RC.nrrrc[ctxt_pP->module_id])->nr_reestablish_rnti_map[i];
|
|
|
|
|
nr_reestablish_rnti_map_t *nr_reestablish_rnti_map = &gnb_rrc_inst->nr_reestablish_rnti_map[i];
|
|
|
|
|
LOG_I(NR_RRC, "Insert nr_reestablish_rnti_map[%d] UEid: %lx, RNTI: %04x\n", i, nr_reestablish_rnti_map->ue_id, nr_reestablish_rnti_map->c_rnti);
|
|
|
|
|
if (nr_reestablish_rnti_map->ue_id == 0) {
|
|
|
|
|
nr_reestablish_rnti_map->ue_id = ctxt_pP->rntiMaybeUEid;
|
|
|
|
|
nr_reestablish_rnti_map->ue_id = rnti;
|
|
|
|
|
nr_reestablish_rnti_map->c_rnti = c_rnti;
|
|
|
|
|
LOG_I(NR_RRC, "Insert nr_reestablish_rnti_map[%d] UEid: %lx, RNTI: %04x\n", i, nr_reestablish_rnti_map->ue_id, nr_reestablish_rnti_map->c_rnti);
|
|
|
|
|
LOG_W(NR_RRC, "Insert nr_reestablish_rnti_map[%d] UEid: %lx, RNTI: %04x bug in UEid to fix \n", i, nr_reestablish_rnti_map->ue_id, nr_reestablish_rnti_map->c_rnti);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UE->reestablishment_cause = rrcReestablishmentRequest.reestablishmentCause;
|
|
|
|
|
LOG_D(NR_RRC, "Accept RRCReestablishmentRequest from UE physCellId %ld cause %ld\n", rrcReestablishmentRequest.ue_Identity.physCellId, UE->reestablishment_cause);
|
|
|
|
|
UE->reestablishment_cause = cause;
|
|
|
|
|
LOG_D(NR_RRC, "Accept RRCReestablishmentRequest from UE physCellId %ld cause %ld\n", physCellId, cause);
|
|
|
|
|
|
|
|
|
|
UE->primaryCC_id = 0;
|
|
|
|
|
// LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
|
|
|
|
@@ -1932,20 +1888,19 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
UE->Srb[2].Srb_info.Srb_id = Idx;
|
|
|
|
|
rrc_init_nr_srb_param(&UE->Srb[2].Srb_info.Lchan_desc[0]);
|
|
|
|
|
rrc_init_nr_srb_param(&UE->Srb[2].Srb_info.Lchan_desc[1]);
|
|
|
|
|
|
|
|
|
|
rrc_gNB_generate_RRCReestablishment(ctxt_pP, ue_context_p, du_to_cu_rrc_container, gnb_rrc_inst->carrier.servingcellconfigcommon, 0);
|
|
|
|
|
protocol_ctxt_t ctxt = {.rntiMaybeUEid = UE->rnti, .module_id = module_id, .instance = module_id, .enb_flag = 1, .eNB_index = module_id};
|
|
|
|
|
rrc_gNB_generate_RRCReestablishment(&ctxt, ue_context_p, du_to_cu_rrc_container, gnb_rrc_inst->carrier.servingcellconfigcommon, 0);
|
|
|
|
|
|
|
|
|
|
LOG_I(NR_RRC, "CALLING RLC CONFIG SRB1 (rbid %d)\n", Idx);
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest:
|
|
|
|
|
LOG_I(NR_RRC, "receive rrcSystemInfoRequest message \n");
|
|
|
|
|
LOG_I(NR_RRC, "UE %04x receive rrcSystemInfoRequest message \n", rnti);
|
|
|
|
|
/* TODO */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Unknown message\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_E(NR_RRC, "UE %04x Unknown message\n", rnti);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -2007,21 +1962,16 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
asn_dec_rval_t dec_rval;
|
|
|
|
|
NR_UL_DCCH_Message_t *ul_dcch_msg = NULL;
|
|
|
|
|
uint8_t xid;
|
|
|
|
|
|
|
|
|
|
gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if ((Srb_id != 1) && (Srb_id != 2)) {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld, should not have ...\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
Srb_id);
|
|
|
|
|
LOG_E(NR_RRC, "Received message on SRB%ld, should not have ...\n", Srb_id);
|
|
|
|
|
} else {
|
|
|
|
|
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
Srb_id);
|
|
|
|
|
LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_D(NR_RRC, "Decoding UL-DCCH Message\n");
|
|
|
|
|
|
|
|
|
|
//for (int i=0;i<sdu_sizeP;i++) printf("%02x ",Rx_sdu[i]);
|
|
|
|
|
//printf("\n");
|
|
|
|
@@ -2048,21 +1998,17 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
dec_rval.consumed);
|
|
|
|
|
LOG_E(NR_RRC, "Failed to decode UL-DCCH (%zu bytes)\n", dec_rval.consumed);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
|
|
|
|
|
if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) {
|
|
|
|
|
switch (ul_dcch_msg->message.choice.c1->present) {
|
|
|
|
|
case NR_UL_DCCH_MessageType__c1_PR_NOTHING:
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_FMT" Received PR_NOTHING on UL-DCCH-Message\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
|
|
|
|
|
LOG_I(NR_RRC, "Received PR_NOTHING on UL-DCCH-Message\n");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete:
|
|
|
|
@@ -2389,14 +2335,13 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
ul_dcch_msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)){
|
|
|
|
|
if (!NODE_IS_CU(gnb_rrc_inst->node_type)) {
|
|
|
|
|
if (UE->established_pdu_sessions_flag == 1) {
|
|
|
|
|
rrc_gNB_generate_dedicatedRRCReconfiguration(ctxt_pP, ue_context_p, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
/*Generate a UE context setup request message towards the DU to provide the UE
|
|
|
|
|
*capability info and get the updates on master cell group config from the DU*/
|
|
|
|
|
MessageDef *message_p;
|
|
|
|
@@ -2406,10 +2351,10 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
req->gNB_CU_ue_id = 0;
|
|
|
|
|
req->gNB_DU_ue_id = 0;
|
|
|
|
|
req->rnti = UE->rnti;
|
|
|
|
|
req->mcc = RC.nrrrc[ctxt_pP->module_id]->configuration.mcc[0];
|
|
|
|
|
req->mnc = RC.nrrrc[ctxt_pP->module_id]->configuration.mnc[0];
|
|
|
|
|
req->mnc_digit_length = RC.nrrrc[ctxt_pP->module_id]->configuration.mnc_digit_length[0];
|
|
|
|
|
req->nr_cellid = RC.nrrrc[ctxt_pP->module_id]->nr_cellid;
|
|
|
|
|
req->mcc = gnb_rrc_inst->configuration.mcc[0];
|
|
|
|
|
req->mnc = gnb_rrc_inst->configuration.mnc[0];
|
|
|
|
|
req->mnc_digit_length = gnb_rrc_inst->configuration.mnc_digit_length[0];
|
|
|
|
|
req->nr_cellid = gnb_rrc_inst->nr_cellid;
|
|
|
|
|
|
|
|
|
|
if (UE->established_pdu_sessions_flag == 1) {
|
|
|
|
|
/*Instruction towards the DU for SRB2 configuration*/
|
|
|
|
@@ -2426,11 +2371,11 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
LOG_I(RRC, "Length of DRB list:%d \n", req->drbs_to_be_setup_length);
|
|
|
|
|
DRBs[0].drb_id = 1;
|
|
|
|
|
DRBs[0].rlc_mode = RLC_MODE_AM;
|
|
|
|
|
DRBs[0].up_ul_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt_pP->module_id]->eth_params_s.my_addr);
|
|
|
|
|
DRBs[0].up_ul_tnl[0].port=RC.nrrrc[ctxt_pP->module_id]->eth_params_s.my_portd;
|
|
|
|
|
DRBs[0].up_ul_tnl[0].tl_address = inet_addr(gnb_rrc_inst->eth_params_s.my_addr);
|
|
|
|
|
DRBs[0].up_ul_tnl[0].port = gnb_rrc_inst->eth_params_s.my_portd;
|
|
|
|
|
DRBs[0].up_ul_tnl_length = 1;
|
|
|
|
|
DRBs[0].up_dl_tnl[0].tl_address = inet_addr(RC.nrrrc[ctxt_pP->module_id]->eth_params_s.remote_addr);
|
|
|
|
|
DRBs[0].up_dl_tnl[0].port=RC.nrrrc[ctxt_pP->module_id]->eth_params_s.remote_portd;
|
|
|
|
|
DRBs[0].up_dl_tnl[0].tl_address = inet_addr(gnb_rrc_inst->eth_params_s.remote_addr);
|
|
|
|
|
DRBs[0].up_dl_tnl[0].port = gnb_rrc_inst->eth_params_s.remote_portd;
|
|
|
|
|
DRBs[0].up_dl_tnl_length = 1;
|
|
|
|
|
}
|
|
|
|
|
if( ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.present ==
|
|
|
|
@@ -2457,49 +2402,42 @@ rrc_gNB_decode_dcch(
|
|
|
|
|
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: {
|
|
|
|
|
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)Rx_sdu, sdu_sizeP, "[MSG] NR_RRC Connection Reestablishment Complete\n");
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_RRC_CTXT_UE_FMT
|
|
|
|
|
" RLC RB %02d --- RLC_DATA_IND %d bytes "
|
|
|
|
|
"(rrcReestablishmentComplete) ---> RRC_gNB\n",
|
|
|
|
|
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
DCCH,
|
|
|
|
|
sdu_sizeP);
|
|
|
|
|
LOG_I(NR_RRC, "RLC RB %02d --- RLC_DATA_IND %d bytes (rrcReestablishmentComplete) ---> RRC_gNB\n", DCCH, sdu_sizeP);
|
|
|
|
|
|
|
|
|
|
rnti_t reestablish_rnti = 0;
|
|
|
|
|
|
|
|
|
|
// Select C-RNTI from map
|
|
|
|
|
for (i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
|
|
|
|
nr_reestablish_rnti_map_t *nr_reestablish_rnti_map = &(RC.nrrrc[ctxt_pP->module_id])->nr_reestablish_rnti_map[i];
|
|
|
|
|
nr_reestablish_rnti_map_t *nr_reestablish_rnti_map = &gnb_rrc_inst->nr_reestablish_rnti_map[i];
|
|
|
|
|
LOG_I(NR_RRC, "nr_reestablish_rnti_map[%d] UEid %lx, RNTI %04x, ctxt_pP->rntiMaybeUEid: %lx\n", i, nr_reestablish_rnti_map->ue_id, nr_reestablish_rnti_map->c_rnti, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
if (nr_reestablish_rnti_map->ue_id == ctxt_pP->rntiMaybeUEid) {
|
|
|
|
|
LOG_I(NR_RRC, "Removing nr_reestablish_rnti_map[%d] UEid %lx, RNTI %04x\n", i, nr_reestablish_rnti_map->ue_id, nr_reestablish_rnti_map->c_rnti);
|
|
|
|
|
reestablish_rnti = nr_reestablish_rnti_map->c_rnti;
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], reestablish_rnti);
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, reestablish_rnti);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ue_context_p) {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " NR_RRCReestablishmentComplete without UE context, falt\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
|
|
|
|
LOG_E(NR_RRC, "NR_RRCReestablishmentComplete without UE context, fault\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if (0)
|
|
|
|
|
/* TODO : It may be needed if gNB goes into full stack working. */
|
|
|
|
|
// clear
|
|
|
|
|
int UE_id = find_nr_UE_id(ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
int UE_id = find_nr_UE_id(gnb_rrc_inst, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
|
|
|
|
|
if (UE_id == -1) {
|
|
|
|
|
LOG_E(NR_RRC, PROTOCOL_RRC_CTXT_UE_FMT " NR_RRCReestablishmentComplete without UE_id(MAC) rnti %lx, fault\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RC.nrmac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
|
|
|
|
|
RC.nrmac[gnb_rrc_inst]->UE_info.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (ul_dcch_msg->message.choice.c1->choice.rrcReestablishmentComplete->criticalExtensions.present == NR_RRCReestablishmentComplete__criticalExtensions_PR_rrcReestablishmentComplete) {
|
|
|
|
@@ -2637,14 +2575,7 @@ void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t
|
|
|
|
|
i = 0;
|
|
|
|
|
LOG_W(RRC, "initial UL RRC message nr_cellid %ld does not match RRC's %ld\n", ul_rrc->nr_cellid, RC.nrrrc[0]->nr_cellid);
|
|
|
|
|
}
|
|
|
|
|
protocol_ctxt_t ctxt = { 0 };
|
|
|
|
|
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, i, GNB_FLAG_YES, ul_rrc->crnti, 0, 0);
|
|
|
|
|
|
|
|
|
|
nr_rrc_gNB_decode_ccch(&ctxt,
|
|
|
|
|
ul_rrc->rrc_container,
|
|
|
|
|
ul_rrc->rrc_container_length,
|
|
|
|
|
ul_rrc->du2cu_rrc_container,
|
|
|
|
|
ul_rrc->du2cu_rrc_container_length);
|
|
|
|
|
nr_rrc_gNB_decode_ccch(i, ul_rrc->crnti, ul_rrc->rrc_container, ul_rrc->rrc_container_length, ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container_length);
|
|
|
|
|
|
|
|
|
|
if (ul_rrc->rrc_container)
|
|
|
|
|
free(ul_rrc->rrc_container);
|
|
|
|
@@ -3513,8 +3444,10 @@ static int get_dl_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability
|
|
|
|
|
void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
|
|
|
|
|
|
|
|
|
MessageDef *msg;
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = NULL;
|
|
|
|
|
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
|
|
|
|
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc->rrc_ue_head)
|
|
|
|
|
{
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
ctxt_pP->rntiMaybeUEid = UE->rnti;
|
|
|
|
|
gNB_MAC_INST *nrmac=RC.nrmac[ctxt_pP->module_id]; //WHAT A BEAUTIFULL RACE CONDITION !!!
|
|
|
|
@@ -3535,20 +3468,20 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
|
|
|
|
|
|
|
|
|
// Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G
|
|
|
|
|
if (UE->StatusRrc < NR_RRC_CONNECTED || UE->gNB_ue_ngap_id == 0) {
|
|
|
|
|
if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->instance]->node_type)){
|
|
|
|
|
if (!NODE_IS_CU(rrc->node_type)) {
|
|
|
|
|
mac_remove_nr_ue(nrmac, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
rrc_rlc_remove_ue(ctxt_pP);
|
|
|
|
|
pdcp_remove_UE(ctxt_pP);
|
|
|
|
|
|
|
|
|
|
/* remove RRC UE Context */
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
if (ue_context_p) {
|
|
|
|
|
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
|
|
|
|
rrc_gNB_remove_ue_context(rrc, ue_context_p);
|
|
|
|
|
LOG_I(NR_RRC, "remove UE %lx \n", ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// In case of CU trigger UE context release command towards the DU
|
|
|
|
|
else{
|
|
|
|
|
else {
|
|
|
|
|
MessageDef *message_p;
|
|
|
|
|
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
|
|
|
|
|
f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p);
|
|
|
|
@@ -3575,9 +3508,9 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
|
|
|
|
newGtpuDeleteAllTunnels(ctxt_pP->instance, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
|
|
|
|
|
/* remove RRC UE Context */
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
if (ue_context_p) {
|
|
|
|
|
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
|
|
|
|
rrc_gNB_remove_ue_context(rrc, ue_context_p);
|
|
|
|
|
LOG_I(NR_RRC, "remove UE %lx \n", ctxt_pP->rntiMaybeUEid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -3936,10 +3869,7 @@ rrc_gNB_generate_SecurityModeCommand(
|
|
|
|
|
NR_IntegrityProtAlgorithm_t integrity_algorithm = (NR_IntegrityProtAlgorithm_t)ue_p->integrity_algorithm;
|
|
|
|
|
size = do_NR_SecurityModeCommand(ctxt_pP, buffer, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), ue_p->ciphering_algorithm, &integrity_algorithm);
|
|
|
|
|
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Security Mode Command\n");
|
|
|
|
|
LOG_I(NR_RRC,
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n",
|
|
|
|
|
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
|
|
|
|
size);
|
|
|
|
|
LOG_I(NR_RRC, "UE %04x Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", ue_p->rnti, size);
|
|
|
|
|
|
|
|
|
|
switch (RC.nrrrc[ctxt_pP->module_id]->node_type) {
|
|
|
|
|
case ngran_gNB_CU:
|
|
|
|
|