send reject if we reach the max number of UEs allowed
This commit is contained in:
committed by
Robert Schmidt
parent
f9cf458b1c
commit
41da4a3b3a
@@ -971,7 +971,7 @@ bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t
|
||||
NR_SCHED_LOCK(&nrmac->sched_lock);
|
||||
|
||||
NR_UE_info_t *UE = get_new_nr_ue_inst(&nrmac->UE_info.uid_allocator, rnti, CellGroup);
|
||||
DevAssert(UE != NULL); // test-mode: we assume we can always create a UE
|
||||
DevAssert(UE->uid < MAX_MOBILES_PER_GNB); // test-mode: we assume we can always create a UE
|
||||
free_and_zero(UE->ra); // test-mode (sims, phy-test): UE will not do RA
|
||||
bool res = add_connected_nr_ue(nrmac, UE);
|
||||
if (!res) {
|
||||
|
||||
@@ -727,11 +727,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 (!UE) {
|
||||
LOG_E(NR_MAC, "FAILURE: %4d.%2d cannot create UE context, ignoring RA because RRC Reject not implemented yet\n", frame, slot);
|
||||
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
|
||||
return;
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -2577,19 +2577,10 @@ static void init_bler_stats(const NR_bler_options_t *bler_options, NR_bler_stats
|
||||
* error handling). Remove with delete_nr_ue_data(). */
|
||||
NR_UE_info_t *get_new_nr_ue_inst(uid_allocator_t *uia, rnti_t rnti, NR_CellGroupConfig_t *CellGroup)
|
||||
{
|
||||
uid_t uid = uid_linear_allocator_new(uia);
|
||||
/* if the UE list is full, we should reject the UE with an RRC reject
|
||||
* message, but we do not have this functionality. To keep it simple, do not
|
||||
* create a UE context here, so we can print an error message. */
|
||||
if (uid >= MAX_MOBILES_PER_GNB) {
|
||||
uid_linear_allocator_free(uia, uid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NR_UE_info_t *UE = calloc_or_fail(1, sizeof(NR_UE_info_t));
|
||||
UE->uid = uid_linear_allocator_new(uia);
|
||||
UE->rnti = rnti;
|
||||
UE->CellGroup = CellGroup;
|
||||
UE->uid = uid;
|
||||
UE->ra = calloc(1, sizeof(*UE->ra));
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
sched_ctrl->ta_update = 31;
|
||||
@@ -3324,6 +3315,19 @@ bool prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
|
||||
if (!nr_rlc_activate_srb0(UE->rnti, UE, send_initial_ul_rrc_message))
|
||||
return false;
|
||||
|
||||
if (UE->uid >= MAX_MOBILES_PER_GNB) {
|
||||
// verifying if any UE left in the meantime and it is possible to get a valid UID
|
||||
uid_linear_allocator_free(&mac->UE_info.uid_allocator, UE->uid);
|
||||
UE->uid = uid_linear_allocator_new(&mac->UE_info.uid_allocator);
|
||||
if (UE->uid >= MAX_MOBILES_PER_GNB) {
|
||||
// if the UE list is full, we should reject the UE with an RRC reject message
|
||||
// to signal the upper layers to send a reject we send an empty CellGroup information element
|
||||
UE->CellGroup = NULL;
|
||||
LOG_W(NR_MAC, "Maximum number of UE alllowed at DU reached. Cannot serve UE %04x", UE->rnti);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* create this UE's initial CellGroup */
|
||||
int CC_id = 0;
|
||||
int srb_id = 1;
|
||||
@@ -3335,7 +3339,7 @@ bool prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
|
||||
|
||||
if (!cellGroupConfig)
|
||||
return true;
|
||||
|
||||
|
||||
/* the cellGroup sent to CU specifies there is SRB1, so create it */
|
||||
DevAssert(cellGroupConfig->rlc_BearerToAddModList->list.count == 1);
|
||||
const NR_RLC_BearerConfig_t *bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[0];
|
||||
|
||||
@@ -553,7 +553,7 @@ static NR_UE_info_t *create_new_UE(gNB_MAC_INST *mac, uint32_t cu_id, const NR_C
|
||||
DevAssert(success);
|
||||
|
||||
NR_UE_info_t *UE = get_new_nr_ue_inst(&mac->UE_info.uid_allocator, rnti, NULL);
|
||||
AssertFatal(UE != NULL, "cannot create UE context, UE context setup failure not implemented\n");
|
||||
AssertFatal(UE->uid < MAX_MOBILES_PER_GNB, "cannot create UE context, UE context setup failure not implemented\n");
|
||||
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
|
||||
|
||||
Reference in New Issue
Block a user