NR RRC - Choose the next available DRB from the 5QI

If it is a GBR flow, assign a dedicated DRB
If is is a NGBR flow, use an existing DRB, from the same PDU Session

Note: the case that we run out of DRBs is not handled yet, it is still a todo
parent 984bf765
......@@ -862,14 +862,18 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
break;
}
NR_DRB_ToAddMod_t *DRB_config = generateDRB(ue_p,
drb_id,
&ue_context_pP->ue_context.pduSession[i],
rrc->configuration.enable_sdap,
rrc->security.do_drb_integrity,
rrc->security.do_drb_ciphering);
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
if(drb_is_active(ue_p, drb_id)){ /* Non-GBR flow using the same DRB or a GBR flow with no available DRBs*/
nb_drb_to_setup--;
} else {
NR_DRB_ToAddMod_t *DRB_config = generateDRB(ue_p,
drb_id,
&ue_context_pP->ue_context.pduSession[i],
rrc->configuration.enable_sdap,
rrc->security.do_drb_integrity,
rrc->security.do_drb_ciphering);
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
}
}
}
......
......@@ -58,6 +58,11 @@ NR_DRB_ToAddMod_t *generateDRB(gNB_RRC_UE_t *ue,
NR_QFI_t *qfi = calloc(1, sizeof(NR_QFI_t));
*qfi = pduSession->param.qos[qos_flow_index].qfi;
ASN_SEQUENCE_ADD(&SDAP_config->mappedQoS_FlowsToAdd->list, qfi);
if(pduSession->param.qos[qos_flow_index].fiveQI > 5)
ue->pduSession[pduSession->param.pdusession_id].param.used_drbs[drb_id-1] = DRB_ACTIVE_NONGBR;
else
ue->pduSession[pduSession->param.pdusession_id].param.used_drbs[drb_id-1] = DRB_ACTIVE;
}
SDAP_config->mappedQoS_FlowsToRelease = NULL;
......@@ -100,18 +105,28 @@ NR_DRB_ToAddMod_t *generateDRB(gNB_RRC_UE_t *ue,
}
ue->DRB_active[drb_id-1] = DRB_ACTIVE;
ue->pduSession[pduSession->param.pdusession_id].param.used_drbs[drb_id] = DRB_ACTIVE;
return DRB_config;
}
uint8_t next_available_drb(gNB_RRC_UE_t *ue, uint8_t pdusession_id, bool is_gbr) {
uint8_t drb_id;
for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++) {
if(ue->DRB_active[drb_id] == DRB_INACTIVE)
return drb_id+1;
if(is_gbr) { /* GBR Flow */
for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++)
if(ue->DRB_active[drb_id] == DRB_INACTIVE)
return drb_id+1;
} else { /* Non-GBR Flow */
/* Find if Non-GBR DRB exists in the same PDU Session */
for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++)
if(ue->pduSession[pdusession_id].param.used_drbs[drb_id-1] == DRB_ACTIVE_NONGBR)
return drb_id+1;
/* If a Non-GBR DRB does not exist in the same PDU Session, find an available DRB */
for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++)
if(ue->DRB_active[drb_id] == DRB_INACTIVE)
return drb_id+1;
}
/* From this point, we handle the case that all DRBs are already used by the UE. */
/* 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;
}
......
......@@ -28,6 +28,7 @@
#define MAX_DRBS_PER_UE (32) /* Maximum number of Data Radio Bearers per UE */
#define MAX_PDUS_PER_UE (8) /* Maximum number of PDU Sessions per UE */
#define DRB_ACTIVE_NONGBR (2) /* DRB is used for Non-GBR Flows */
#define DRB_ACTIVE (1)
#define DRB_INACTIVE (0)
#define GBR_FLOW (1)
......
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