improvements in UE detachment, including sending a message from NAS and signaling to MAC and fixing some memory leaks when terminating UE
This commit is contained in:
@@ -401,6 +401,10 @@ typedef struct nas_deregistration_req_s {
|
||||
release_cause_t cause;
|
||||
} nas_deregistration_req_t;
|
||||
|
||||
typedef struct nas_detach_req_s {
|
||||
bool wait_release;
|
||||
} nas_detach_req_t;
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------------
|
||||
* NAS information transfer
|
||||
|
||||
@@ -61,6 +61,7 @@ MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefre
|
||||
MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req)
|
||||
MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req)
|
||||
MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req)
|
||||
MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, NasDetachReq, nas_detach_req)
|
||||
MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, NasDeregistrationReq, nas_deregistration_req)
|
||||
|
||||
MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp)
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
#define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req
|
||||
#define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req
|
||||
#define NAS_UPLINK_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_req
|
||||
#define NAS_DETACH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_detach_req
|
||||
#define NAS_DEREGISTRATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_deregistration_req
|
||||
|
||||
#define NAS_RAB_ESTABLI_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_rab_est_rsp
|
||||
@@ -429,6 +430,7 @@ typedef cell_info_req_t NasCellSelectionReq;
|
||||
typedef nas_establish_req_t NasConnEstabliReq;
|
||||
typedef ul_info_transfer_req_t NasUlDataReq;
|
||||
typedef nas_deregistration_req_t NasDeregistrationReq;
|
||||
typedef nas_detach_req_t NasDetachReq;
|
||||
|
||||
typedef rab_establish_rsp_t NasRabEstRsp;
|
||||
|
||||
|
||||
@@ -4431,20 +4431,18 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
|
||||
type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset;
|
||||
}
|
||||
|
||||
void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) {
|
||||
|
||||
int32_t duration;
|
||||
|
||||
void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config)
|
||||
{
|
||||
if (coreset0 == NULL)
|
||||
coreset0 = calloc(1,sizeof(*coreset0));
|
||||
|
||||
coreset0->controlResourceSetId = 0;
|
||||
|
||||
AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n");
|
||||
|
||||
duration = type0_PDCCH_CSS_config->num_symbols;
|
||||
coreset0->controlResourceSetId = 0;
|
||||
int duration = type0_PDCCH_CSS_config->num_symbols;
|
||||
|
||||
if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||
if(coreset0->frequencyDomainResources.buf == NULL)
|
||||
coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||
|
||||
switch(type0_PDCCH_CSS_config->num_rbs){
|
||||
case 24:
|
||||
@@ -4470,8 +4468,9 @@ void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_conf
|
||||
coreset0->frequencyDomainResources.bits_unused = 3;
|
||||
|
||||
coreset0->duration = duration;
|
||||
coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved));
|
||||
coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||
if (!coreset0->cce_REG_MappingType.choice.interleaved)
|
||||
coreset0->cce_REG_MappingType.choice.interleaved = calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved));
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||
coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL; // -> use cell_id
|
||||
@@ -4481,23 +4480,28 @@ void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_conf
|
||||
coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||
coreset0->tci_PresentInDCI = NULL;
|
||||
coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||
|
||||
}
|
||||
|
||||
void fill_searchSpaceZero(NR_SearchSpace_t *ss0,
|
||||
int slots_per_frame,
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config)
|
||||
{
|
||||
|
||||
if(ss0 == NULL) ss0=calloc(1,sizeof(*ss0));
|
||||
if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId));
|
||||
if(ss0->monitoringSymbolsWithinSlot == NULL) ss0->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss0->monitoringSymbolsWithinSlot));
|
||||
if(ss0->monitoringSymbolsWithinSlot->buf == NULL) ss0->monitoringSymbolsWithinSlot->buf = calloc(1,2);
|
||||
if(ss0->nrofCandidates == NULL) ss0->nrofCandidates = calloc(1,sizeof(*ss0->nrofCandidates));
|
||||
if(ss0->searchSpaceType == NULL) ss0->searchSpaceType = calloc(1,sizeof(*ss0->searchSpaceType));
|
||||
if(ss0->searchSpaceType->choice.common == NULL) ss0->searchSpaceType->choice.common=calloc(1,sizeof(*ss0->searchSpaceType->choice.common));
|
||||
if(ss0 == NULL)
|
||||
ss0 = calloc(1, sizeof(*ss0));
|
||||
if(ss0->controlResourceSetId == NULL)
|
||||
ss0->controlResourceSetId = calloc(1, sizeof(*ss0->controlResourceSetId));
|
||||
if(ss0->monitoringSymbolsWithinSlot == NULL)
|
||||
ss0->monitoringSymbolsWithinSlot = calloc(1, sizeof(*ss0->monitoringSymbolsWithinSlot));
|
||||
if(ss0->monitoringSymbolsWithinSlot->buf == NULL)
|
||||
ss0->monitoringSymbolsWithinSlot->buf = calloc(1, 2);
|
||||
if(ss0->nrofCandidates == NULL)
|
||||
ss0->nrofCandidates = calloc(1, sizeof(*ss0->nrofCandidates));
|
||||
if(ss0->searchSpaceType == NULL)
|
||||
ss0->searchSpaceType = calloc(1, sizeof(*ss0->searchSpaceType));
|
||||
if(ss0->searchSpaceType->choice.common == NULL)
|
||||
ss0->searchSpaceType->choice.common = calloc(1, sizeof(*ss0->searchSpaceType->choice.common));
|
||||
if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL)
|
||||
ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1, sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
|
||||
|
||||
AssertFatal(type0_PDCCH_CSS_config!=NULL,"No type0 CSS configuration\n");
|
||||
|
||||
@@ -4508,13 +4512,15 @@ void fill_searchSpaceZero(NR_SearchSpace_t *ss0,
|
||||
|
||||
ss0->searchSpaceId = 0;
|
||||
*ss0->controlResourceSetId = 0;
|
||||
ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset));
|
||||
if(ss0->monitoringSlotPeriodicityAndOffset == NULL)
|
||||
ss0->monitoringSlotPeriodicityAndOffset = calloc(1, sizeof(*ss0->monitoringSlotPeriodicityAndOffset));
|
||||
set_monitoring_periodicity_offset(ss0,periodicity,offset);
|
||||
const uint32_t duration = type0_PDCCH_CSS_config->search_space_duration;
|
||||
if (duration==1)
|
||||
ss0->duration = NULL;
|
||||
else{
|
||||
ss0->duration = calloc(1,sizeof(*ss0->duration));
|
||||
if (!ss0->duration)
|
||||
ss0->duration = calloc(1, sizeof(*ss0->duration));
|
||||
*ss0->duration = duration;
|
||||
}
|
||||
|
||||
|
||||
@@ -795,6 +795,22 @@ void ue_init_config_request(NR_UE_MAC_INST_t *mac, int scs)
|
||||
pthread_mutex_init(&(mac->ul_config_request[i].mutex_ul_config), NULL);
|
||||
}
|
||||
|
||||
static void update_mib_conf(NR_MIB_t *target, NR_MIB_t *source)
|
||||
{
|
||||
target->systemFrameNumber.size = source->systemFrameNumber.size;
|
||||
target->systemFrameNumber.bits_unused = source->systemFrameNumber.bits_unused;
|
||||
if (!target->systemFrameNumber.buf)
|
||||
target->systemFrameNumber.buf = calloc(target->systemFrameNumber.size, sizeof(*target->systemFrameNumber.buf));
|
||||
for (int i = 0; i < target->systemFrameNumber.size; i++)
|
||||
target->systemFrameNumber.buf[i] = source->systemFrameNumber.buf[i];
|
||||
target->subCarrierSpacingCommon = source->subCarrierSpacingCommon;
|
||||
target->ssb_SubcarrierOffset = source->ssb_SubcarrierOffset;
|
||||
target->dmrs_TypeA_Position = source->dmrs_TypeA_Position;
|
||||
target->pdcch_ConfigSIB1 = source->pdcch_ConfigSIB1;
|
||||
target->cellBarred = source->cellBarred;
|
||||
target->intraFreqReselection = source->intraFreqReselection;
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_mib(module_id_t module_id,
|
||||
int cc_idP,
|
||||
NR_MIB_t *mib,
|
||||
@@ -802,16 +818,16 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
AssertFatal(mib, "MIB should not be NULL\n");
|
||||
// initialize dl and ul config_request upon first reception of MIB
|
||||
mac->mib = mib; // update by every reception
|
||||
if (!mac->mib)
|
||||
mac->mib = calloc(1, sizeof(*mac->mib));
|
||||
update_mib_conf(mac->mib, mib);
|
||||
mac->phy_config.Mod_id = module_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
if (sched_sib == 1)
|
||||
mac->get_sib1 = true;
|
||||
else if (sched_sib == 2)
|
||||
mac->get_otherSI = true;
|
||||
nr_ue_decode_mib(module_id,
|
||||
cc_idP);
|
||||
nr_ue_decode_mib(module_id, cc_idP);
|
||||
}
|
||||
|
||||
static void setup_puschpowercontrol(NR_PUSCH_PowerControl_t *source, NR_PUSCH_PowerControl_t *target)
|
||||
@@ -1365,11 +1381,12 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
|
||||
|
||||
// Sending to PHY a request to resync
|
||||
// with no target cell ID
|
||||
if (reset_cause != DETACH) {
|
||||
mac->synch_request.Mod_id = module_id;
|
||||
mac->synch_request.CC_id = 0;
|
||||
mac->synch_request.synch_req.target_Nid_cell = -1;
|
||||
mac->if_module->synch_request(&mac->synch_request);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
|
||||
@@ -167,6 +167,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
GO_TO_IDLE,
|
||||
DETACH,
|
||||
RE_ESTABLISHMENT
|
||||
} NR_UE_MAC_reset_cause_t;
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac)
|
||||
free(sc->nrofHARQ_ProcessesForPDSCH);
|
||||
free(sc->rateMatching_PUSCH);
|
||||
free(sc->xOverhead_PUSCH);
|
||||
free(sc->maxMIMO_Layers_PDSCH);
|
||||
free(sc->maxMIMO_Layers_PUSCH);
|
||||
memset(&mac->sc_info, 0, sizeof(mac->sc_info));
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
|
||||
case NR_RNTI_SP_CSI:
|
||||
break;
|
||||
case NR_RNTI_SI:
|
||||
sps=14;
|
||||
sps = 14;
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
|
||||
|
||||
@@ -2352,8 +2352,7 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
|
||||
bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, PUCCH_sched_t *pucch, frame_t frame, int slot)
|
||||
{
|
||||
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
|
||||
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config;
|
||||
const int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
|
||||
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP ? current_UL_BWP->pucch_Config : NULL;
|
||||
|
||||
if(!pucch_Config ||
|
||||
!pucch_Config->schedulingRequestResourceToAddModList ||
|
||||
@@ -2366,6 +2365,7 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, PUCCH_sched_t *p
|
||||
int SR_period; int SR_offset;
|
||||
|
||||
find_period_offset_SR(SchedulingRequestResourceConfig,&SR_period,&SR_offset);
|
||||
const int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
|
||||
int sfn_sf = frame * n_slots_frame + slot;
|
||||
|
||||
if ((sfn_sf - SR_offset) % SR_period == 0) {
|
||||
@@ -2454,8 +2454,7 @@ int compute_csi_priority(NR_UE_MAC_INST_t *mac, NR_CSI_ReportConfig_t *csirep)
|
||||
int nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sched_t *pucch)
|
||||
{
|
||||
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
|
||||
NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id;
|
||||
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config;
|
||||
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP ? current_UL_BWP->pucch_Config : NULL;
|
||||
int num_csi = 0;
|
||||
|
||||
if (mac->sc_info.csi_MeasConfig) {
|
||||
@@ -2476,7 +2475,7 @@ int nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCC
|
||||
for (int i = 0; i < csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.count; i++) {
|
||||
const NR_PUCCH_CSI_Resource_t *pucchcsires =
|
||||
csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[i];
|
||||
if (pucchcsires->uplinkBandwidthPartId == bwp_id) {
|
||||
if (pucchcsires->uplinkBandwidthPartId == current_UL_BWP->bwp_id) {
|
||||
csi_res_id = pucchcsires->pucch_Resource;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
|
||||
|
||||
NR_SRS_Config_t *srs_config = current_UL_BWP->srs_Config;
|
||||
NR_SRS_Config_t *srs_config = current_UL_BWP ? current_UL_BWP->srs_Config : NULL;
|
||||
|
||||
if (!srs_config) {
|
||||
return false;
|
||||
|
||||
@@ -877,47 +877,48 @@ uint8_t do_NR_RRCReconfigurationComplete(uint8_t *buffer, size_t buffer_size, co
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
|
||||
const uint8_t Transaction_id, uint8_t sel_plmn_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS){
|
||||
asn_enc_rval_t enc_rval;
|
||||
|
||||
NR_UL_DCCH_Message_t ul_dcch_msg;
|
||||
NR_RRCSetupComplete_t *RrcSetupComplete;
|
||||
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
|
||||
|
||||
uint8_t buf[6];
|
||||
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
|
||||
uint8_t *buffer,
|
||||
size_t buffer_size,
|
||||
const uint8_t Transaction_id,
|
||||
uint8_t sel_plmn_id,
|
||||
const int dedicatedInfoNASLength,
|
||||
const char *dedicatedInfoNAS)
|
||||
{
|
||||
NR_UL_DCCH_Message_t ul_dcch_msg = {0};
|
||||
|
||||
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
|
||||
ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1));
|
||||
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete;
|
||||
ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_t));
|
||||
RrcSetupComplete = ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete;
|
||||
NR_RRCSetupComplete_t *RrcSetupComplete = ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete;
|
||||
RrcSetupComplete->rrc_TransactionIdentifier = Transaction_id;
|
||||
RrcSetupComplete->criticalExtensions.present = NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_IEs_t));
|
||||
// RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension = CALLOC(1,
|
||||
// sizeof(*RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension));
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->selectedPLMN_Identity = sel_plmn_id;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->registeredAMF = NULL;
|
||||
NR_RRCSetupComplete_IEs_t *ies = RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete;
|
||||
ies->selectedPLMN_Identity = sel_plmn_id;
|
||||
ies->registeredAMF = NULL;
|
||||
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value = CALLOC(1, sizeof(struct NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value));
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->present = NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size = 6;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf = buf;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[0] = 0x12;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[1] = 0x34;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[2] = 0x56;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[3] = 0x78;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[4] = 0x9A;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[5] = 0xBC;
|
||||
ies->ng_5G_S_TMSI_Value = CALLOC(1, sizeof(struct NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value));
|
||||
ies->ng_5G_S_TMSI_Value->present = NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI;
|
||||
NR_NG_5G_S_TMSI_t *stmsi = &ies->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI;
|
||||
stmsi->size = 6;
|
||||
stmsi->buf = calloc(stmsi->size, sizeof(*stmsi->buf));
|
||||
AssertFatal(stmsi->buf != NULL, "out of memory\n");
|
||||
stmsi->buf[0] = 0x12;
|
||||
stmsi->buf[1] = 0x34;
|
||||
stmsi->buf[2] = 0x56;
|
||||
stmsi->buf[3] = 0x78;
|
||||
stmsi->buf[4] = 0x9A;
|
||||
stmsi->buf[5] = 0xBC;
|
||||
|
||||
memset(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,0,sizeof(OCTET_STRING_t));
|
||||
OCTET_STRING_fromBuf(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,dedicatedInfoNAS,dedicatedInfoNASLength);
|
||||
memset(&ies->dedicatedNAS_Message,0,sizeof(OCTET_STRING_t));
|
||||
OCTET_STRING_fromBuf(&ies->dedicatedNAS_Message, dedicatedInfoNAS, dedicatedInfoNASLength);
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&ul_dcch_msg,
|
||||
buffer,
|
||||
@@ -926,6 +927,7 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
|
||||
enc_rval.failed_type->name,enc_rval.encoded);
|
||||
LOG_D(NR_RRC,"RRCSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
|
||||
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_UL_DCCH_Message, &ul_dcch_msg);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
|
||||
+24
-26
@@ -229,13 +229,9 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance,
|
||||
}
|
||||
if (ie->measConfig != NULL) {
|
||||
LOG_I(NR_RRC, "Measurement Configuration is present\n");
|
||||
if (rrc->meas_config == NULL) {
|
||||
rrc->meas_config = ie->measConfig;
|
||||
} else {
|
||||
// if some element need to be updated
|
||||
nr_rrc_ue_process_measConfig(rrcNB, ie->measConfig);
|
||||
}
|
||||
}
|
||||
if (ie->lateNonCriticalExtension != NULL) {
|
||||
// unuse now
|
||||
}
|
||||
@@ -447,13 +443,14 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(const instance_t instance,
|
||||
}
|
||||
|
||||
int get_sib = 0;
|
||||
if (get_softmodem_params()->sa && bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_notBarred) {
|
||||
if (get_softmodem_params()->sa &&
|
||||
bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_notBarred &&
|
||||
NR_UE_rrc_inst[instance].nrRrcState != RRC_STATE_DETACH_NR) {
|
||||
NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[instance].perNB[gNB_index].SInfo;
|
||||
// to schedule MAC to get SI if required
|
||||
get_sib = check_si_status(SI_info);
|
||||
}
|
||||
nr_rrc_mac_config_req_mib(instance, 0, bcch_message->message.choice.mib, get_sib);
|
||||
bcch_message->message.choice.mib = NULL;
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
|
||||
return;
|
||||
}
|
||||
@@ -809,10 +806,6 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB,
|
||||
}
|
||||
}
|
||||
|
||||
if(cellGroupConfig->mac_CellGroupConfig != NULL) {
|
||||
// TODO handle MAC CellGroupConfig
|
||||
}
|
||||
|
||||
// TODO verify why we need this limitation
|
||||
if (get_softmodem_params()->sa || get_softmodem_params()->nsa)
|
||||
nr_rrc_manage_rlc_bearers(instance, cellGroupConfig, rrcNB, rrc->rnti);
|
||||
@@ -843,9 +836,7 @@ static void nr_rrc_ue_process_masterCellGroup(instance_t instance,
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig);
|
||||
}
|
||||
|
||||
nr_rrc_cellgroup_configuration(rrcNB,
|
||||
instance,
|
||||
cellGroupConfig);
|
||||
nr_rrc_cellgroup_configuration(rrcNB, instance, cellGroupConfig);
|
||||
|
||||
LOG_D(RRC,"Sending CellGroupConfig to MAC\n");
|
||||
nr_rrc_mac_config_req_cg(instance, 0, cellGroupConfig);
|
||||
@@ -884,7 +875,7 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance,
|
||||
{
|
||||
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance];
|
||||
|
||||
NR_DL_CCCH_Message_t *dl_ccch_msg=NULL;
|
||||
NR_DL_CCCH_Message_t *dl_ccch_msg = NULL;
|
||||
asn_dec_rval_t dec_rval;
|
||||
int rval=0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN);
|
||||
@@ -920,22 +911,21 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance,
|
||||
// Release T300 timer
|
||||
rrc->timers_and_constants.T300_active = 0;
|
||||
rrc->rnti = rnti;
|
||||
nr_rrc_ue_process_masterCellGroup(
|
||||
instance,
|
||||
NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup;
|
||||
nr_rrc_ue_process_masterCellGroup(instance,
|
||||
rnti,
|
||||
rrc->perNB + gNB_index,
|
||||
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup,
|
||||
&rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup,
|
||||
NULL);
|
||||
nr_rrc_ue_process_RadioBearerConfig(
|
||||
rrc,
|
||||
nr_rrc_ue_process_RadioBearerConfig(rrc,
|
||||
rnti,
|
||||
rrc->perNB + gNB_index,
|
||||
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
|
||||
&rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
|
||||
rrc->nrRrcState = RRC_STATE_CONNECTED_NR;
|
||||
|
||||
rrc_ue_generate_RRCSetupComplete(instance,
|
||||
rnti,
|
||||
dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier,
|
||||
rrcSetup->rrc_TransactionIdentifier,
|
||||
rrc->selected_plmn_identity);
|
||||
rval = 0;
|
||||
break;
|
||||
@@ -947,6 +937,7 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance,
|
||||
}
|
||||
}
|
||||
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_DL_CCCH_Message, dl_ccch_msg);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT);
|
||||
return rval;
|
||||
}
|
||||
@@ -1473,7 +1464,6 @@ void *rrc_nrue(void *notUsed)
|
||||
nr_rrc_ue_decode_ccch(instance, ind->rnti, ind, 0);
|
||||
} break;
|
||||
|
||||
/* PDCP messages */
|
||||
case NR_RRC_DCCH_DATA_IND:
|
||||
nr_rrc_ue_decode_dcch(instance,
|
||||
NR_RRC_DCCH_DATA_IND(msg_p).rnti,
|
||||
@@ -1487,6 +1477,14 @@ void *rrc_nrue(void *notUsed)
|
||||
memcpy(rrc->kgnb, NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(rrc->kgnb));
|
||||
break;
|
||||
|
||||
case NAS_DETACH_REQ:
|
||||
if (!NAS_DETACH_REQ(msg_p).wait_release) {
|
||||
rrc->nrRrcState = RRC_STATE_DETACH_NR;
|
||||
NR_Release_Cause_t release_cause = OTHER;
|
||||
nr_rrc_going_to_IDLE(instance, release_cause, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case NAS_UPLINK_DATA_REQ: {
|
||||
uint32_t length;
|
||||
uint8_t *buffer;
|
||||
@@ -1915,9 +1913,6 @@ void nr_rrc_going_to_IDLE(instance_t instance,
|
||||
}
|
||||
}
|
||||
|
||||
asn1cFreeStruc(asn_DEF_NR_MeasConfig, rrc->meas_config);
|
||||
rrc->meas_config = NULL;
|
||||
|
||||
for (int i = 0; i < NB_CNX_UE; i++) {
|
||||
rrcPerNB_t *nb = &rrc->perNB[i];
|
||||
NR_UE_RRC_SI_INFO *SI_info = &nb->SInfo;
|
||||
@@ -1938,11 +1933,14 @@ void nr_rrc_going_to_IDLE(instance_t instance,
|
||||
}
|
||||
|
||||
// reset MAC
|
||||
NR_UE_MAC_reset_cause_t cause = GO_TO_IDLE;
|
||||
NR_UE_MAC_reset_cause_t cause = (rrc->nrRrcState == RRC_STATE_DETACH_NR) ? DETACH : GO_TO_IDLE;
|
||||
nr_rrc_mac_config_req_reset(instance, cause);
|
||||
|
||||
// enter RRC_IDLE
|
||||
LOG_I(NR_RRC, "RRC moved into IDLE state\n");
|
||||
if (rrc->nrRrcState != RRC_STATE_DETACH_NR)
|
||||
rrc->nrRrcState = RRC_STATE_IDLE_NR;
|
||||
|
||||
rrc->rnti = 0;
|
||||
|
||||
// Indicate the release of the RRC connection to upper layers
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef enum Rrc_State_NR_e {
|
||||
RRC_STATE_IDLE_NR = 0,
|
||||
RRC_STATE_INACTIVE_NR,
|
||||
RRC_STATE_CONNECTED_NR,
|
||||
|
||||
RRC_STATE_DETACH_NR,
|
||||
RRC_STATE_FIRST_NR = RRC_STATE_IDLE_NR,
|
||||
RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR,
|
||||
} Rrc_State_NR_t;
|
||||
@@ -206,8 +206,6 @@ typedef struct rrcPerNB {
|
||||
} rrcPerNB_t;
|
||||
|
||||
typedef struct NR_UE_RRC_INST_s {
|
||||
NR_MeasConfig_t *meas_config;
|
||||
|
||||
rrcPerNB_t perNB[NB_CNX_UE];
|
||||
|
||||
char *uecap_file;
|
||||
|
||||
@@ -911,6 +911,14 @@ static void send_nas_uplink_data_req(instance_t instance, const as_nas_info_t *i
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, msg);
|
||||
}
|
||||
|
||||
static void send_nas_detach_req(instance_t instance, bool wait_release)
|
||||
{
|
||||
MessageDef *msg = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_DETACH_REQ);
|
||||
nas_detach_req_t *req = &NAS_DETACH_REQ(msg);
|
||||
req->wait_release = wait_release;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, msg);
|
||||
}
|
||||
|
||||
static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t *buf, const uint32_t len)
|
||||
{
|
||||
int nssai_cnt = 0;
|
||||
@@ -1165,15 +1173,19 @@ void *nas_nrue(void *args_p)
|
||||
case NAS_DEREGISTRATION_REQ: {
|
||||
LOG_I(NAS, "[UE %ld] Received %s\n", instance, ITTI_MSG_NAME(msg_p));
|
||||
nr_ue_nas_t *nas = get_ue_nas_info(0);
|
||||
if (nas->guti) {
|
||||
nas_deregistration_req_t *req = &NAS_DEREGISTRATION_REQ(msg_p);
|
||||
if (req->cause == AS_DETACH)
|
||||
if (nas->guti) {
|
||||
if (req->cause == AS_DETACH) {
|
||||
nas->termination_procedure = true;
|
||||
send_nas_detach_req(instance, true);
|
||||
}
|
||||
as_nas_info_t initialNasMsg = {0};
|
||||
generateDeregistrationRequest(nas, &initialNasMsg, req);
|
||||
send_nas_uplink_data_req(instance, &initialNasMsg);
|
||||
} else {
|
||||
LOG_E(NAS, "no GUTI, cannot trigger deregistration request\n");
|
||||
LOG_W(NAS, "No GUTI, cannot trigger deregistration request.\n");
|
||||
if (req->cause == AS_DETACH)
|
||||
send_nas_detach_req(instance, false);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user