mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-20 16:10:29 +00:00
Compare commits
5 Commits
test-vecto
...
NR_gNB_UE_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae6864c4ac | ||
|
|
a6a367e603 | ||
|
|
b9f43502d6 | ||
|
|
10ab618638 | ||
|
|
d03bda6fdd |
@@ -64,16 +64,17 @@ void seq_arr_init(seq_arr_t* arr, size_t elt_size) //__attribute__(malloc)
|
||||
assert(arr->data != NULL);
|
||||
}
|
||||
|
||||
void seq_arr_free(seq_arr_t* arr, void (*free_func)(void*))
|
||||
void seq_arr_free(seq_arr_t* arr, seq_arr_free_func_t free_func, void *user)
|
||||
{
|
||||
assert(arr != NULL);
|
||||
assert(arr->data != NULL);
|
||||
assert(user == NULL || free_func != NULL);
|
||||
|
||||
if (free_func != NULL) {
|
||||
void* start_it = seq_arr_front(arr);
|
||||
void* end_it = seq_arr_end(arr);
|
||||
while (start_it != end_it) {
|
||||
free_func(start_it);
|
||||
free_func(start_it, user);
|
||||
start_it = seq_arr_next(arr, start_it);
|
||||
}
|
||||
}
|
||||
@@ -100,33 +101,36 @@ void seq_arr_erase(seq_arr_t* arr, void* start_it)
|
||||
// start_it must be in the range of arr->data
|
||||
assert(arr != NULL);
|
||||
assert(start_it != NULL);
|
||||
return seq_arr_erase_deep(arr, start_it, NULL);
|
||||
return seq_arr_erase_deep(arr, start_it, NULL, NULL);
|
||||
}
|
||||
|
||||
void seq_arr_erase_deep(seq_arr_t* arr, void* start_it, void (*free_func)(void* it))
|
||||
void seq_arr_erase_deep(seq_arr_t* arr, void* start_it, seq_arr_free_func_t free_func, void *user)
|
||||
{
|
||||
// start_it must be in the range of arr->data
|
||||
assert(arr != NULL);
|
||||
assert(start_it != NULL);
|
||||
return seq_arr_erase_it(arr, start_it, seq_arr_next(arr, start_it), free_func);
|
||||
assert(user == NULL || free_func != NULL);
|
||||
return seq_arr_erase_it(arr, start_it, seq_arr_next(arr, start_it), free_func, user);
|
||||
}
|
||||
|
||||
void seq_arr_erase_it(seq_arr_t* arr, void* start_it, void* end_it, void (*free_func)(void* it))
|
||||
void seq_arr_erase_it(seq_arr_t* arr, void* start_it, void* end_it, seq_arr_free_func_t free_func, void *user)
|
||||
{
|
||||
// start_it && end_it must be in the range of arr->data
|
||||
assert(arr != NULL);
|
||||
assert(start_it != NULL);
|
||||
assert(end_it != NULL);
|
||||
assert(end_it >= start_it);
|
||||
assert(user == NULL || free_func != NULL);
|
||||
|
||||
if (start_it == end_it)
|
||||
return;
|
||||
|
||||
if (free_func != NULL) {
|
||||
void* it = start_it;
|
||||
while (it != end_it) {
|
||||
free_func(it);
|
||||
it = seq_arr_next(arr, it);
|
||||
void* start_it = seq_arr_front(arr);
|
||||
void* end_it = seq_arr_end(arr);
|
||||
while (start_it != end_it) {
|
||||
free_func(start_it, user);
|
||||
start_it = seq_arr_next(arr, start_it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ typedef struct seq_arr_s {
|
||||
size_t cap;
|
||||
} seq_arr_t;
|
||||
|
||||
typedef void (*seq_arr_free_func_t)(void *it, void *user);
|
||||
|
||||
/**
|
||||
* Init a sequence container, similar to a constructor
|
||||
* @brief Constructor.
|
||||
@@ -57,8 +59,9 @@ void seq_arr_init(seq_arr_t* arr, size_t elm_sz);
|
||||
* @brief Destructor.
|
||||
* @param arr The sequence container
|
||||
* @param free_func Function called for every element while destructing e.g., useful to free memory of deep objects.
|
||||
* @param user user-supplied data to be passed to free_func
|
||||
*/
|
||||
void seq_arr_free(seq_arr_t* arr, void (*free_func)(void* it));
|
||||
void seq_arr_free(seq_arr_t* arr, seq_arr_free_func_t free_func, void *user);
|
||||
|
||||
/**
|
||||
* @brief Push back elements into the sequence container. Value semantic. i.e., the void* data will be shallowly copied in the
|
||||
@@ -82,17 +85,18 @@ void seq_arr_erase(seq_arr_t*, void* it);
|
||||
* @param it Iterator to the element to erase
|
||||
* @param free_func Function to call while erasing element
|
||||
*/
|
||||
void seq_arr_erase_deep(seq_arr_t* arr, void* it, void (*free_func)(void* it));
|
||||
void seq_arr_erase_deep(seq_arr_t* arr, void* it, seq_arr_free_func_t free_func, void *user);
|
||||
|
||||
/**
|
||||
* @brief Erase the elements in the semi-open range [first,last)
|
||||
* @param arr The sequence container
|
||||
* @param first Iterator to the first element to erase
|
||||
* @param last Iterator to the last element. Note that this element will NOT be erased
|
||||
* @param f Function that will be called by every element while erasing. Useful for deep copies. Pass NULL if shallow
|
||||
* @param free_func Function that will be called by every element while erasing. Useful for deep copies. Pass NULL if shallow
|
||||
* erased required
|
||||
* @param user user-supplied data to be passed to free_func
|
||||
*/
|
||||
void seq_arr_erase_it(seq_arr_t* arr, void* first, void* last, void (*free_func)(void* it));
|
||||
void seq_arr_erase_it(seq_arr_t* arr, void* first, void* last, seq_arr_free_func_t free_func, void *user);
|
||||
|
||||
/**
|
||||
* @brief Elements in the array
|
||||
|
||||
@@ -77,7 +77,7 @@ int main()
|
||||
assert(*(int*)seq_arr_at(&arr, 50) == 51);
|
||||
|
||||
// Erase range and force shrink
|
||||
seq_arr_erase_it(&arr, seq_arr_front(&arr), seq_arr_at(&arr, 90), NULL);
|
||||
seq_arr_erase_it(&arr, seq_arr_front(&arr), seq_arr_at(&arr, 90), NULL, NULL);
|
||||
assert(seq_arr_size(&arr) == 9);
|
||||
assert(*(int*)seq_arr_front(&arr) == 91);
|
||||
|
||||
@@ -104,7 +104,7 @@ int main()
|
||||
assert(*(int*)seq_arr_at(&arr, 5) == 99);
|
||||
|
||||
// Free data structure
|
||||
seq_arr_free(&arr, NULL);
|
||||
seq_arr_free(&arr, NULL, NULL);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t
|
||||
bool res = add_connected_nr_ue(nrmac, UE);
|
||||
if (!res) {
|
||||
LOG_E(NR_MAC, "Error adding UE %04x\n", rnti);
|
||||
delete_nr_ue_data(UE, NULL, &nrmac->UE_info.uid_allocator);
|
||||
delete_nr_ue_data(UE, &nrmac->UE_info.uid_allocator);
|
||||
NR_SCHED_UNLOCK(&nrmac->sched_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ int nr_fill_successrar(const NR_UE_sched_ctrl_t *ue_sched_ctl,
|
||||
/** @brief find UE with RA process for given preamble */
|
||||
static NR_UE_info_t *get_existing_ra(gNB_MAC_INST *nr_mac, uint16_t preamble_index)
|
||||
{
|
||||
UE_iterator(nr_mac->UE_info.access_ue_list, UE) {
|
||||
UE_arr_iterator(&nr_mac->UE_info.access_ue_list, UE) {
|
||||
NR_RA_t *ra = UE->ra;
|
||||
for (int i = 0; i < ra->preambles.num_preambles; ++i) {
|
||||
if (ra->preambles.preamble_list[i] == preamble_index)
|
||||
@@ -642,10 +642,14 @@ static NR_UE_info_t *get_existing_ra(gNB_MAC_INST *nr_mac, uint16_t preamble_ind
|
||||
/** @brief add UE to list of UEs doing RA.
|
||||
*
|
||||
* Remove with nr_release_ra_UE(). */
|
||||
#define MAX_UE_RA 10
|
||||
bool add_new_UE_RA(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE)
|
||||
{
|
||||
if (seq_arr_size(&nr_mac->UE_info.access_ue_list) == MAX_UE_RA)
|
||||
return false;
|
||||
DevAssert(UE->ra); // a UE in the acess_ue_list needs to have an RA process
|
||||
return add_UE_to_list(NR_NB_RA_PROC_MAX, nr_mac->UE_info.access_ue_list, UE);
|
||||
seq_arr_push_back(&nr_mac->UE_info.access_ue_list, &UE, sizeof(NR_UE_info_t *));
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint8_t nr_get_msg3_tpc(uint32_t preamble_power)
|
||||
@@ -703,7 +707,9 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
return;
|
||||
}
|
||||
|
||||
bool new_UE = false;
|
||||
if (!UE) {
|
||||
new_UE = true;
|
||||
/* in CBRA: we don't know this UE yet. There might be CFRA (e.g., HO IN SA)
|
||||
* where we know the UE */
|
||||
rnti_t rnti;
|
||||
@@ -715,12 +721,6 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
}
|
||||
|
||||
UE = get_new_nr_ue_inst(&nr_mac->UE_info.uid_allocator, rnti, NULL);
|
||||
if (!add_new_UE_RA(nr_mac, UE)) {
|
||||
LOG_E(NR_MAC, "FAILURE: %4d.%2d initiating RA procedure for preamble index %d: no free RA process\n", frame, slot, preamble_index);
|
||||
delete_nr_ue_data(UE, NULL, &nr_mac->UE_info.uid_allocator);
|
||||
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NR_RA_t *ra = UE->ra;
|
||||
@@ -758,6 +758,12 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
int n_ssb = ssb_index_from_prach(module_idP, frame, slot, preamble_index, freq_index, symbol);
|
||||
UE->UE_beam_index = get_fapi_beamforming_index(nr_mac, cc->ssb_index[n_ssb]);
|
||||
|
||||
if (new_UE) {
|
||||
if (!add_new_UE_RA(nr_mac, UE)) {
|
||||
LOG_E(NR_MAC, "FAILURE: %4d.%2d initiating RA procedure for preamble index %d: no free RA process\n", frame, slot, preamble_index);
|
||||
delete_nr_ue_data(UE, &nr_mac->UE_info.uid_allocator);
|
||||
}
|
||||
}
|
||||
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
|
||||
}
|
||||
@@ -2106,22 +2112,6 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_UE_info_t *UE, uint8_t *dlsch_buffer
|
||||
ra->msg3_TPC = 1;
|
||||
}
|
||||
|
||||
/** @brief remove the UE with RNTI rnti from list of UEs doing RA.
|
||||
*
|
||||
* The corresponding function to add is add_new_UE_RA(). */
|
||||
void nr_release_ra_UE(gNB_MAC_INST *mac, rnti_t rnti)
|
||||
{
|
||||
NR_UEs_t *UE_info = &mac->UE_info;
|
||||
NR_SCHED_LOCK(&UE_info->mutex);
|
||||
NR_UE_info_t *UE = remove_UE_from_list(NR_NB_RA_PROC_MAX, UE_info->access_ue_list, rnti);
|
||||
NR_SCHED_UNLOCK(&UE_info->mutex);
|
||||
if (UE) {
|
||||
delete_nr_ue_data(UE, mac->common_channels, &UE_info->uid_allocator);
|
||||
} else {
|
||||
LOG_W(NR_MAC,"Call to release RA UE with rnti %04x, but not existing\n", rnti);
|
||||
}
|
||||
}
|
||||
|
||||
void nr_schedule_RA(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
slot_t slotP,
|
||||
@@ -2135,7 +2125,7 @@ void nr_schedule_RA(module_id_t module_idP,
|
||||
|
||||
start_meas(&mac->schedule_ra);
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
UE_iterator(mac->UE_info.access_ue_list, UE) {
|
||||
UE_arr_iterator(&mac->UE_info.access_ue_list, UE) {
|
||||
NR_RA_t *ra = UE->ra;
|
||||
if (ra->ra_state != nrRA_gNB_IDLE)
|
||||
LOG_D(NR_MAC, "UE %04x frame.slot %d.%d RA state: %d\n", UE->rnti, frameP, slotP, ra->ra_state);
|
||||
|
||||
@@ -2192,6 +2192,14 @@ void remove_front_nr_list(NR_list_t *listP)
|
||||
listP->tail = -1;
|
||||
}
|
||||
|
||||
// Comparison function to check for UE with RNTI
|
||||
static bool is_rnti(const void *rnti, const void* element)
|
||||
{
|
||||
const NR_UE_info_t* UE_it = *(const NR_UE_info_t**)element;
|
||||
const rnti_t target_rnti = *(const rnti_t*)rnti;
|
||||
return UE_it->rnti == target_rnti;
|
||||
}
|
||||
|
||||
NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
|
||||
{
|
||||
UE_iterator(UEs->connected_ue_list, UE) {
|
||||
@@ -2203,24 +2211,35 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NR_UE_info_t *find_ra_UE(NR_UEs_t *UEs, rnti_t rntiP)
|
||||
NR_UE_info_t *find_ra_UE(NR_UEs_t *UEs, rnti_t rnti)
|
||||
{
|
||||
UE_iterator(UEs->access_ue_list, UE) {
|
||||
if (UE->rnti == rntiP) {
|
||||
LOG_D(NR_MAC,"Search and found rnti: %04x\n", rntiP);
|
||||
return UE;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
elm_arr_t elm = find_if(&UEs->access_ue_list, &rnti, is_rnti);
|
||||
return elm.found ? *(NR_UE_info_t **)elm.it : NULL;
|
||||
}
|
||||
|
||||
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia)
|
||||
/** @brief remove the UE with RNTI rnti from list of UEs doing RA.
|
||||
*
|
||||
* The corresponding function to add is add_new_UE_RA(). */
|
||||
void nr_release_ra_UE(gNB_MAC_INST *mac, rnti_t rnti)
|
||||
{
|
||||
NR_UEs_t *UE_info = &mac->UE_info;
|
||||
NR_SCHED_LOCK(&UE_info->mutex);
|
||||
elm_arr_t elm = find_if(&UE_info->access_ue_list, &rnti, is_rnti);
|
||||
if (elm.found) {
|
||||
seq_arr_erase_deep(&mac->UE_info.access_ue_list, elm.it, (seq_arr_free_func_t)delete_nr_ue_data, &UE_info->uid_allocator);
|
||||
} else {
|
||||
LOG_W(NR_MAC,"Call to release RA UE with rnti %04x, but not existing\n", rnti);
|
||||
}
|
||||
NR_SCHED_UNLOCK(&UE_info->mutex);
|
||||
}
|
||||
|
||||
void delete_nr_ue_data(NR_UE_info_t *UE, uid_allocator_t *uia)
|
||||
{
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup);
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_SpCellConfig, UE->reconfigSpCellConfig);
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
seq_arr_free(&sched_ctrl->lc_config, NULL);
|
||||
seq_arr_free(&sched_ctrl->lc_config, NULL, NULL);
|
||||
destroy_nr_list(&sched_ctrl->available_dl_harq);
|
||||
destroy_nr_list(&sched_ctrl->feedback_dl_harq);
|
||||
destroy_nr_list(&sched_ctrl->retrans_dl_harq);
|
||||
@@ -2742,11 +2761,12 @@ NR_UE_info_t *remove_UE_from_list(int list_size, NR_UE_info_t *list[list_size],
|
||||
bool transition_ra_connected_nr_ue(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE)
|
||||
{
|
||||
NR_UEs_t *UE_info = &nr_mac->UE_info;
|
||||
|
||||
// remove UE from initial access list (moved to connected mode)
|
||||
NR_UE_info_t *r = remove_UE_from_list(NR_NB_RA_PROC_MAX, UE_info->access_ue_list, UE->rnti);
|
||||
DevAssert(r == UE); /* sanity check: we should have removed the current UE ptr from list */
|
||||
|
||||
elm_arr_t elm = find_if(&UE_info->access_ue_list, &UE->rnti, is_rnti);
|
||||
DevAssert(elm.found);
|
||||
/* verify that the UE found is the one we already have */
|
||||
DevAssert(UE == *(NR_UE_info_t **)elm.it);
|
||||
seq_arr_erase(&UE_info->access_ue_list, elm.it);
|
||||
free_and_zero(UE->ra);
|
||||
|
||||
return add_connected_nr_ue(nr_mac, UE);
|
||||
@@ -2767,7 +2787,7 @@ bool add_connected_nr_ue(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE)
|
||||
bool success = add_UE_to_list(MAX_MOBILES_PER_GNB, UE_info->connected_ue_list, UE);
|
||||
if (!success) {
|
||||
LOG_E(NR_MAC,"Try to add UE %04x but the list is full\n", UE->rnti);
|
||||
delete_nr_ue_data(UE, NULL, &UE_info->uid_allocator);
|
||||
delete_nr_ue_data(UE, &UE_info->uid_allocator);
|
||||
NR_SCHED_UNLOCK(&UE_info->mutex);
|
||||
return false;
|
||||
}
|
||||
@@ -2838,7 +2858,7 @@ void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
|
||||
NR_UE_info_t *UE = remove_UE_from_list(MAX_MOBILES_PER_GNB + 1, UE_info->connected_ue_list, rnti);
|
||||
NR_SCHED_UNLOCK(&UE_info->mutex);
|
||||
if (UE)
|
||||
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
|
||||
delete_nr_ue_data(UE, &UE_info->uid_allocator);
|
||||
else
|
||||
nr_release_ra_UE(nr_mac, rnti);
|
||||
}
|
||||
|
||||
@@ -212,9 +212,9 @@ void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frame, slot_t slot)
|
||||
if (!is_ul_slot(slot, &nrmac->frame_structure))
|
||||
return;
|
||||
|
||||
UE_iterator(nrmac->UE_info.access_ue_list, init_UE) {
|
||||
if (init_UE->ra->ra_state == nrRA_WAIT_Msg4_MsgB_ACK)
|
||||
schedule_pucch_core(nrmac, init_UE, frame, slot);
|
||||
UE_arr_iterator(&nrmac->UE_info.access_ue_list, UE) {
|
||||
if (UE->ra->ra_state == nrRA_WAIT_Msg4_MsgB_ACK)
|
||||
schedule_pucch_core(nrmac, UE, frame, slot);
|
||||
}
|
||||
|
||||
UE_iterator(nrmac->UE_info.connected_ue_list, UE) {
|
||||
|
||||
@@ -839,7 +839,7 @@ static void nr_rx_ra_sdu(const module_id_t mod_id,
|
||||
configure_UE_BWP(mac, scc, UE, false, ss_type, -1, -1);
|
||||
if (!transition_ra_connected_nr_ue(mac, UE)) {
|
||||
LOG_E(NR_MAC, "cannot add UE %04x: list is full\n", UE->rnti);
|
||||
delete_nr_ue_data(UE, NULL, &mac->UE_info.uid_allocator);
|
||||
delete_nr_ue_data(UE, &mac->UE_info.uid_allocator);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,7 @@ 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 delete_nr_ue_data(NR_UE_info_t *UE, uid_allocator_t *uia);
|
||||
|
||||
void mac_top_init_gNB(ngran_node_t node_type,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
@@ -316,7 +316,7 @@ void remove_front_nr_list(NR_list_t *listP);
|
||||
void nr_release_ra_UE(gNB_MAC_INST *mac, rnti_t rnti);
|
||||
NR_UE_info_t * find_nr_UE(NR_UEs_t* UEs, rnti_t rntiP);
|
||||
NR_UE_info_t *find_ra_UE(NR_UEs_t *UEs, rnti_t rntiP);
|
||||
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia);
|
||||
void delete_nr_ue_data(NR_UE_info_t *UE, uid_allocator_t *uia);
|
||||
void configure_UE_BWP(gNB_MAC_INST *nr_mac,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_UE_info_t *UE,
|
||||
|
||||
@@ -595,12 +595,12 @@ static NR_UE_info_t *create_new_UE(gNB_MAC_INST *mac, uint32_t cu_id, const NR_C
|
||||
bool res = add_connected_nr_ue(mac, UE);
|
||||
DevAssert(res);
|
||||
} else {
|
||||
nr_mac_prepare_ra_ue(mac, UE);
|
||||
if (!add_new_UE_RA(mac, UE)) {
|
||||
delete_nr_ue_data(UE, /*not used*/ NULL, &mac->UE_info.uid_allocator);
|
||||
delete_nr_ue_data(UE, &mac->UE_info.uid_allocator);
|
||||
LOG_E(NR_MAC, "UE list full while creating new UE\n");
|
||||
return NULL;
|
||||
}
|
||||
nr_mac_prepare_ra_ue(mac, UE);
|
||||
|
||||
if (is_SA) {
|
||||
/* SRB1 is added to RLC and MAC in the handler later */
|
||||
|
||||
@@ -265,7 +265,7 @@ void mac_top_init_gNB(ngran_node_t node_type,
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);
|
||||
|
||||
bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
|
||||
|
||||
|
||||
RC.nrmac[i]->Mod_id = i;
|
||||
|
||||
RC.nrmac[i]->tag = (NR_TAG_t*)malloc(sizeof(NR_TAG_t));
|
||||
@@ -318,6 +318,7 @@ void mac_top_init_gNB(ngran_node_t node_type,
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[i];
|
||||
nrmac->if_inst = NR_IF_Module_init(i);
|
||||
memset(&nrmac->UE_info, 0, sizeof(nrmac->UE_info));
|
||||
seq_arr_init(&nrmac->UE_info.access_ue_list, sizeof(NR_UE_info_t *));
|
||||
}
|
||||
|
||||
du_init_f1_ue_data();
|
||||
@@ -335,10 +336,8 @@ void mac_top_destroy_gNB(gNB_MAC_INST *mac)
|
||||
NR_UEs_t *UE_info = &mac->UE_info;
|
||||
for (int i = 0; i < sizeofArray(UE_info->connected_ue_list); ++i)
|
||||
if (UE_info->connected_ue_list[i])
|
||||
delete_nr_ue_data(UE_info->connected_ue_list[i], cc, &UE_info->uid_allocator);
|
||||
for (int i = 0; i < sizeofArray(UE_info->access_ue_list); ++i)
|
||||
if (UE_info->access_ue_list[i])
|
||||
delete_nr_ue_data(UE_info->access_ue_list[i], cc, &UE_info->uid_allocator);
|
||||
delete_nr_ue_data(UE_info->connected_ue_list[i], &UE_info->uid_allocator);
|
||||
seq_arr_free(&mac->UE_info.access_ue_list, (seq_arr_free_func_t)delete_nr_ue_data, &UE_info->uid_allocator);
|
||||
if (mac->f1_config.setup_resp)
|
||||
free_f1ap_setup_response(mac->f1_config.setup_resp);
|
||||
free(mac->f1_config.setup_resp);
|
||||
|
||||
@@ -95,8 +95,6 @@
|
||||
#define MAX_NUM_BWP 5
|
||||
#define MAX_NUM_CORESET 12
|
||||
#define MAX_NUM_CCE 90
|
||||
/*!\brief Maximum number of random access process */
|
||||
#define NR_NB_RA_PROC_MAX 4
|
||||
#define MAX_NUM_OF_SSB 64
|
||||
#define MAX_NUM_NR_PRACH_PREAMBLES 64
|
||||
|
||||
@@ -769,7 +767,7 @@ typedef struct {
|
||||
// last element always NULL
|
||||
pthread_mutex_t mutex;
|
||||
NR_UE_info_t *connected_ue_list[MAX_MOBILES_PER_GNB + 1];
|
||||
NR_UE_info_t *access_ue_list[NR_NB_RA_PROC_MAX + 1];
|
||||
seq_arr_t access_ue_list; // array over NR_UE_info_t*
|
||||
// bitmap of CSI-RS already scheduled in current slot
|
||||
int sched_csirs;
|
||||
uid_allocator_t uid_allocator;
|
||||
@@ -791,6 +789,12 @@ typedef struct {
|
||||
} NR_beam_info_t;
|
||||
|
||||
#define UE_iterator(BaSe, VaR) NR_UE_info_t ** VaR##pptr=BaSe, *VaR; while ((VaR=*(VaR##pptr++)))
|
||||
/* defines an iterator over all elements in the list. Since seq_arr stores
|
||||
* pointers to NR_UE_info_t, the iterators are pointers to pointers of
|
||||
* NR_UE_info_t (NR_UE_info_t **), but the user expects the actual
|
||||
* NR_UE_info_t *, hence both ITRTR (ITeRaToR) and it_var. */
|
||||
#define UE_arr_iterator(arr, it_var) \
|
||||
for (NR_UE_info_t **ITRTR = seq_arr_front(arr), *it_var = *ITRTR; ITRTR != seq_arr_end(arr); ITRTR = seq_arr_next(arr, ITRTR), it_var = *ITRTR)
|
||||
|
||||
typedef struct {
|
||||
/// current frame for DCI
|
||||
|
||||
@@ -225,7 +225,7 @@ static void remove_unassociated_e1_connections(gNB_RRC_INST *rrc, sctp_assoc_t e
|
||||
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(0, p, cause);
|
||||
rrc_remove_ue(rrc, p);
|
||||
}
|
||||
seq_arr_free(&ue_context_to_remove, NULL);
|
||||
seq_arr_free(&ue_context_to_remove, NULL, NULL);
|
||||
|
||||
for (int i = 0; i < seq_arr_size(&affected_du); ++i) {
|
||||
void *it = seq_arr_at(&affected_du, i);
|
||||
@@ -233,7 +233,7 @@ static void remove_unassociated_e1_connections(gNB_RRC_INST *rrc, sctp_assoc_t e
|
||||
LOG_W(NR_RRC, "trigger F1 reset on DU %d due to E1 connection loss\n", du_assoc_id);
|
||||
trigger_f1_reset(rrc, du_assoc_id);
|
||||
}
|
||||
seq_arr_free(&affected_du, NULL);
|
||||
seq_arr_free(&affected_du, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -479,7 +479,7 @@ static int invalidate_du_connections(gNB_RRC_INST *rrc, sctp_assoc_t assoc_id)
|
||||
rrc_gNB_ue_context_t *p = *(rrc_gNB_ue_context_t **)seq_arr_at(&ue_context_to_remove, i);
|
||||
rrc_remove_nsa_user_context(rrc, p);
|
||||
}
|
||||
seq_arr_free(&ue_context_to_remove, NULL);
|
||||
seq_arr_free(&ue_context_to_remove, NULL, NULL);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user