Introduce mac_top_destroy_gNB(): free MAC memory

This commit is contained in:
Robert Schmidt
2025-04-24 17:22:42 +02:00
parent 6afc0dee50
commit 8ee0b8efdf
3 changed files with 21 additions and 0 deletions
+5
View File
@@ -758,6 +758,11 @@ int main( int argc, char **argv ) {
if (RC.nb_nr_L1_inst > 0 || RC.nb_RU > 0)
stop_L1(0);
if (RC.nb_nr_macrlc_inst > 0) {
DevAssert(RC.nb_nr_macrlc_inst == 1);
mac_top_destroy_gNB(RC.nrmac[0]);
}
pthread_cond_destroy(&sync_cond);
pthread_mutex_destroy(&sync_mutex);
pthread_cond_destroy(&nfapi_sync_cond);
+3
View File
@@ -47,10 +47,13 @@ int get_full_ul_slots_per_period(const frame_structure_t *fs);
int get_full_dl_slots_per_period(const frame_structure_t *fs);
int get_ul_slot_offset(const frame_structure_t *fs, int idx, bool count_mixed);
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia);
void mac_top_init_gNB(ngran_node_t node_type,
NR_ServingCellConfigCommon_t *scc,
NR_ServingCellConfig_t *scd,
const nr_mac_config_t *conf);
void mac_top_destroy_gNB(gNB_MAC_INST *mac);
void nr_mac_send_f1_setup_req(void);
void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config);
+13
View File
@@ -346,6 +346,19 @@ void mac_top_init_gNB(ngran_node_t node_type,
srand48(0);
}
void mac_top_destroy_gNB(gNB_MAC_INST *mac)
{
NR_COMMON_channels_t *cc = &mac->common_channels[0];
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, cc->mib);
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_DL_SCH_Message, cc->sib1);
ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfig, cc->pre_ServingCellConfig);
ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfigCommon, cc->ServingCellConfigCommon);
NR_UEs_t *UE_info = &mac->UE_info;
for (int i = 0; i < sizeofArray(UE_info->list); ++i)
if (UE_info->list[i])
delete_nr_ue_data(UE_info->list[i], cc, &UE_info->uid_allocator);
}
void nr_mac_send_f1_setup_req(void)
{
gNB_MAC_INST *mac = RC.nrmac[0];