Commit 1c2e4c71 authored by Robert Schmidt's avatar Robert Schmidt

Remove drb_active array

The drb_active array keeps track of active DRBs. However, it only
replicates some of the information in established_drbs, and could lead
to a reuse of DRB IDs when two bearers are to be set up. Consider the
following:
1. trigger first DRB creation at RRC
2. DRB ID chosen from free drb_active entry
3. trigger second DRB creation at RRC
   -> The first reconfiguration has not been acknowledged
   -> drb_active is not marked as DRB_ACTIVE
4. The second DRB ID is chosen from a free drb_active entry, which is
   the same as in 2.

By reusing established_drbs everywhere, this cannot happen, as we
1. select the DRB to be used using next_available_drb() and then
2. use generateDRB(), which marks the DRB used
all from within fill_DRB_configList, which gives a new DRB.

The logic is still overly complex, though.
parent 37929dca
......@@ -237,7 +237,6 @@ typedef enum {
typedef struct gNB_RRC_UE_s {
drb_t established_drbs[MAX_DRBS_PER_UE];
uint8_t DRB_active[MAX_DRBS_PER_UE];
NR_DRB_ToReleaseList_t *DRB_ReleaseList;
NR_SRB_INFO_TABLE_ENTRY Srb[maxSRBs]; // 3gpp max is 3 SRBs, number 1..3, we waste the entry 0 for code simplicity
......
......@@ -954,27 +954,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
*/
static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP, const uint8_t xid)
{
int drb_id;
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
NR_DRB_ToAddModList_t *DRB_configList = createDRBlist(ue_p, false);
/* Refresh SRBs/DRBs */
LOG_D(NR_RRC, "Configuring PDCP DRBs/SRBs for UE %04x\n", ue_p->rnti);
ue_context_pP->ue_context.ue_reconfiguration_after_reestablishment_counter++;
/* Loop through DRBs and establish if necessary */
if (DRB_configList != NULL) {
for (int i = 0; i < DRB_configList->list.count; i++) {
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
if (ue_p->DRB_active[drb_id - 1] == 0) {
ue_p->DRB_active[drb_id - 1] = DRB_ACTIVE;
}
} // end if (DRB_configList->list.array[i])
} // end for (int i = 0; i < DRB_configList->list.count; i++)
} // end if DRB_configList != NULL
freeDRBlist(DRB_configList);
}
//-----------------------------------------------------------------------------
......
......@@ -154,16 +154,15 @@ uint8_t next_available_drb(gNB_RRC_UE_t *ue, rrc_pdu_session_param_t *pdusession
}
/* GBR Flow or a Non-GBR DRB does not exist in the same PDU Session, find an available DRB */
for (drb_id = 0; drb_id < MAX_DRBS_PER_UE; drb_id++)
if (ue->DRB_active[drb_id] == DRB_INACTIVE)
if (ue->established_drbs[drb_id].status == DRB_INACTIVE)
return drb_id + 1;
/* From this point, we need to handle the case that all DRBs are already used by the UE. */
LOG_E(RRC, "Error - All the DRBs are used - Handle this\n");
return DRB_INACTIVE;
}
bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id) {
bool drb_is_active(gNB_RRC_UE_t *ue, uint8_t drb_id)
{
DevAssert(drb_id > 0);
if(ue->DRB_active[drb_id-1] == DRB_ACTIVE)
return true;
return false;
return ue->established_drbs[drb_id - 1].status == DRB_ACTIVE;
}
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