Commit c1668cd7 authored by Robert Schmidt's avatar Robert Schmidt

Refactor fill_default_reconfig(): return reconfig

Simplify code by returning an allocated object to an RRCReconfiguration.
It leads to less code and is easier to reason about, because each call
will return a new RRCReconfiguration, which can be freed, irrespective
of other calls to fill_default_reconfig().
parent 4cb0bd37
...@@ -66,12 +66,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a ...@@ -66,12 +66,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);
void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p); void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p);
void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_RRCReconfiguration_IEs_t *get_default_reconfig(const NR_CellGroupConfig_t *secondaryCellGroup);
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
NR_UE_NR_Capability_t *uecap,
int uid);
int generate_CG_Config(gNB_RRC_INST *rrc, int generate_CG_Config(gNB_RRC_INST *rrc,
NR_CG_Config_t *cg_Config, NR_CG_Config_t *cg_Config,
......
...@@ -159,8 +159,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a ...@@ -159,8 +159,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
memset((void *)UE->reconfig, 0, sizeof(NR_RRCReconfiguration_t)); memset((void *)UE->reconfig, 0, sizeof(NR_RRCReconfiguration_t));
UE->reconfig->rrc_TransactionIdentifier = 0; UE->reconfig->rrc_TransactionIdentifier = 0;
UE->reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; UE->reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
UE->reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){ if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){
UE->rb_config = get_default_rbconfig(10 /* EPS bearer ID */, 1 /* drb ID */, NR_CipheringAlgorithm_nea0, NR_SecurityConfig__keyToUse_master); UE->rb_config = get_default_rbconfig(10 /* EPS bearer ID */, 1 /* drb ID */, NR_CipheringAlgorithm_nea0, NR_SecurityConfig__keyToUse_master);
} else { } else {
...@@ -259,7 +257,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a ...@@ -259,7 +257,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
AssertFatal(UE->secondaryCellGroup != NULL, "out of memory\n"); AssertFatal(UE->secondaryCellGroup != NULL, "out of memory\n");
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->secondaryCellGroup); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->secondaryCellGroup);
fill_default_reconfig(sccc, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, ue_context_p->ue_context.rrc_ue_id); UE->reconfig->criticalExtensions.choice.rrcReconfiguration = get_default_reconfig(UE->secondaryCellGroup);
UE->rnti = UE->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; UE->rnti = UE->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
memset((void *)CG_Config,0,sizeof(*CG_Config)); memset((void *)CG_Config,0,sizeof(*CG_Config));
......
...@@ -49,14 +49,10 @@ ...@@ -49,14 +49,10 @@
#include "nr_rrc_config.h" #include "nr_rrc_config.h"
#include "MESSAGES/asn1_msg.h" #include "MESSAGES/asn1_msg.h"
void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_RRCReconfiguration_IEs_t *get_default_reconfig(const NR_CellGroupConfig_t *secondaryCellGroup)
NR_ServingCellConfig_t *servingcellconfigdedicated, {
NR_RRCReconfiguration_IEs_t *reconfig, NR_RRCReconfiguration_IEs_t *reconfig = calloc(1, sizeof(NR_RRCReconfiguration_IEs_t));
NR_CellGroupConfig_t *secondaryCellGroup, AssertFatal(reconfig != NULL, "out of memory\n");
NR_UE_NR_Capability_t *uecap,
int uid) {
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
AssertFatal(reconfig!=NULL,"reconfig is null\n");
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
// radioBearerConfig // radioBearerConfig
reconfig->radioBearerConfig=NULL; reconfig->radioBearerConfig=NULL;
...@@ -74,6 +70,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon ...@@ -74,6 +70,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
reconfig->lateNonCriticalExtension = NULL; reconfig->lateNonCriticalExtension = NULL;
// nonCriticalExtension // nonCriticalExtension
reconfig->nonCriticalExtension = NULL; reconfig->nonCriticalExtension = NULL;
return reconfig;
} }
/* Function to set or overwrite PTRS DL RRC parameters */ /* Function to set or overwrite PTRS DL RRC parameters */
......
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