Commit 7e7b3c13 authored by luis_pereira87's avatar luis_pereira87 Committed by Robert Schmidt

Fix multiple PDUSessions

parent ed7b6753
...@@ -589,7 +589,14 @@ static int fill_BEARER_CONTEXT_SETUP_REQUEST(e1ap_setup_req_t *setup, e1ap_beare ...@@ -589,7 +589,14 @@ static int fill_BEARER_CONTEXT_SETUP_REQUEST(e1ap_setup_req_t *setup, e1ap_beare
for (DRB_nGRAN_to_setup_t *j=i->DRBnGRanList; j < i->DRBnGRanList+i->numDRB2Setup; j++) { for (DRB_nGRAN_to_setup_t *j=i->DRBnGRanList; j < i->DRBnGRanList+i->numDRB2Setup; j++) {
asn1cSequenceAdd(ieC6_1->dRB_To_Setup_List_NG_RAN.list, E1AP_DRB_To_Setup_Item_NG_RAN_t, ieC6_1_1); asn1cSequenceAdd(ieC6_1->dRB_To_Setup_List_NG_RAN.list, E1AP_DRB_To_Setup_Item_NG_RAN_t, ieC6_1_1);
ieC6_1_1->dRB_ID = j->id;
ieC6_1_1->dRB_ID = ieC6_1->pDU_Session_ID;
LOG_W(E1AP,
"%s: %d Current implementation configures one DRB per PDUSession, ieC6_1->pDU_Session_ID %ld, ieC6_1_1->dRB_ID %ld\n",
__FUNCTION__,
__LINE__,
ieC6_1->pDU_Session_ID,
ieC6_1_1->dRB_ID);
ieC6_1_1->sDAP_Configuration.defaultDRB = j->defaultDRB; ieC6_1_1->sDAP_Configuration.defaultDRB = j->defaultDRB;
ieC6_1_1->sDAP_Configuration.sDAP_Header_UL = j->sDAP_Header_UL; ieC6_1_1->sDAP_Configuration.sDAP_Header_UL = j->sDAP_Header_UL;
......
...@@ -113,6 +113,44 @@ mui_t rrc_gNB_mui = 0; ...@@ -113,6 +113,44 @@ mui_t rrc_gNB_mui = 0;
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
static NR_SRB_ToAddModList_t *createSRBlist(gNB_RRC_UE_t *ue, bool reestablish)
{
if (!ue->Srb[1].Active) {
LOG_E(NR_RRC, "Call SRB list while SRB1 doesn't exist\n");
return NULL;
}
NR_SRB_ToAddModList_t *list = CALLOC(sizeof(*list), 1);
for (int i = 0; i < maxSRBs; i++) {
if (ue->Srb[i].Active) {
asn1cSequenceAdd(list->list, NR_SRB_ToAddMod_t, srb);
srb->srb_Identity = i;
if (reestablish && i == 2) {
asn1cCallocOne(srb->reestablishPDCP, NR_SRB_ToAddMod__reestablishPDCP_true);
}
}
}
return list;
}
static NR_DRB_ToAddModList_t *createDRBlist(gNB_RRC_UE_t *ue, bool reestablish)
{
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_DRB_ToAddModList_t *DRB_configList = CALLOC(sizeof(*DRB_configList), 1);
for (int i = 0; i < NGAP_MAX_DRBS_PER_UE; i++) {
if (ue->established_drbs[i].status != DRB_INACTIVE) {
ue->established_drbs[i].reestablishPDCP = NR_DRB_ToAddMod__reestablishPDCP_true;
DRB_config = generateDRB_ASN1(&ue->established_drbs[i]);
if (reestablish) {
asn1cCallocOne(DRB_config->reestablishPDCP, NR_DRB_ToAddMod__reestablishPDCP_true);
}
asn1cSeqAdd(&DRB_configList->list, DRB_config);
}
}
return DRB_configList;
}
NR_DRB_ToAddModList_t *fill_DRB_configList(gNB_RRC_UE_t *ue) NR_DRB_ToAddModList_t *fill_DRB_configList(gNB_RRC_UE_t *ue)
{ {
gNB_RRC_INST *rrc = RC.nrrrc[0]; gNB_RRC_INST *rrc = RC.nrrrc[0];
...@@ -374,24 +412,6 @@ unsigned int rrc_gNB_get_next_transaction_identifier(module_id_t gnb_mod_idP) ...@@ -374,24 +412,6 @@ unsigned int rrc_gNB_get_next_transaction_identifier(module_id_t gnb_mod_idP)
return tmp; return tmp;
} }
static NR_SRB_ToAddModList_t *createSRBlist(gNB_RRC_UE_t *ue, bool reestablish)
{
if (!ue->Srb[1].Active) {
LOG_E(NR_RRC, "Call SRB list while SRB1 doesn't exist\n");
return NULL;
}
NR_SRB_ToAddModList_t *list = CALLOC(sizeof(*list), 1);
for (int i = 0; i < maxSRBs; i++)
if (ue->Srb[i].Active) {
asn1cSequenceAdd(list->list, NR_SRB_ToAddMod_t, srb);
srb->srb_Identity = i;
if (reestablish && i == 2) {
asn1cCallocOne(srb->reestablishPDCP, NR_SRB_ToAddMod__reestablishPDCP_true);
}
}
return list;
}
static void freeSRBlist(NR_SRB_ToAddModList_t *l) static void freeSRBlist(NR_SRB_ToAddModList_t *l)
{ {
if (l) { if (l) {
...@@ -702,6 +722,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c ...@@ -702,6 +722,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
ue_p->pduSession[j].xid = xid; ue_p->pduSession[j].xid = xid;
} }
freeDRBlist(DRB_configList);
/* If list is empty free the list and reset the address */ /* If list is empty free the list and reset the address */
if (dedicatedNAS_MessageList->list.count == 0) { if (dedicatedNAS_MessageList->list.count == 0) {
...@@ -709,16 +730,27 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c ...@@ -709,16 +730,27 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
dedicatedNAS_MessageList = NULL; dedicatedNAS_MessageList = NULL;
} }
/* Free all NAS PDUs */
for (int i = 0; i < ue_p->nb_of_pdusessions; i++) {
if (ue_p->pduSession[i].param.nas_pdu.buffer != NULL) {
/* Free the NAS PDU buffer and invalidate it */
free(ue_p->pduSession[i].param.nas_pdu.buffer);
ue_p->pduSession[i].param.nas_pdu.buffer = NULL;
}
}
NR_CellGroupConfig_t *cellGroupConfig = ue_p->masterCellGroup; NR_CellGroupConfig_t *cellGroupConfig = ue_p->masterCellGroup;
uint8_t buffer[RRC_BUF_SIZE] = {0}; uint8_t buffer[RRC_BUF_SIZE] = {0};
NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false); NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false);
NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, false);
int size = do_RRCReconfiguration(ctxt_pP, int size = do_RRCReconfiguration(ctxt_pP,
buffer, buffer,
RRC_BUF_SIZE, RRC_BUF_SIZE,
xid, xid,
SRBs, SRBs,
DRB_configList, DRBs,
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -731,15 +763,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c ...@@ -731,15 +763,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
cellGroupConfig); cellGroupConfig);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n");
freeSRBlist(SRBs); freeSRBlist(SRBs);
/* Free all NAS PDUs */ freeDRBlist(DRBs);
for (int i = 0; i < ue_p->nb_of_pdusessions; i++) {
if (ue_p->pduSession[i].param.nas_pdu.buffer != NULL) {
/* Free the NAS PDU buffer and invalidate it */
free(ue_p->pduSession[i].param.nas_pdu.buffer);
ue_p->pduSession[i].param.nas_pdu.buffer = NULL;
}
}
freeDRBlist(DRB_configList);
LOG_I(NR_RRC, "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_p->rnti); LOG_I(NR_RRC, "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_p->rnti);
LOG_D(NR_RRC, LOG_D(NR_RRC,
"[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
......
...@@ -778,7 +778,13 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins ...@@ -778,7 +778,13 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins
for (int j=0; j < pdu->numDRB2Setup; j++) { for (int j=0; j < pdu->numDRB2Setup; j++) {
DRB_nGRAN_to_setup_t *drb = pdu->DRBnGRanList + j; DRB_nGRAN_to_setup_t *drb = pdu->DRBnGRanList + j;
drb->id = i + j + UE->nb_of_pdusessions; drb->id = session->pdusession_id;
LOG_W(NR_RRC,
"%s: %d Current implementation configures one DRB per PDUSession, session->pdusession_id %d, drb->id %ld\n",
__FUNCTION__,
__LINE__,
session->pdusession_id,
drb->id);
drb->defaultDRB = E1AP_DefaultDRB_true; drb->defaultDRB = E1AP_DefaultDRB_true;
......
...@@ -147,6 +147,16 @@ uint8_t next_available_drb(gNB_RRC_UE_t *ue, rrc_pdu_session_param_t *pdusession ...@@ -147,6 +147,16 @@ uint8_t next_available_drb(gNB_RRC_UE_t *ue, rrc_pdu_session_param_t *pdusession
{ {
uint8_t drb_id; uint8_t drb_id;
drb_id = pdusession->param.pdusession_id;
LOG_W(NR_RRC,
"%s: %d Current implementation configures one DRB per PDUSession, pdusession_id %d, drb_id %d\n",
__FUNCTION__,
__LINE__,
pdusession->param.pdusession_id,
drb_id);
return drb_id;
if(!is_gbr) { /* Find if Non-GBR DRB exists in the same PDU Session */ if(!is_gbr) { /* Find if Non-GBR DRB exists in the same PDU Session */
for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++) for (drb_id = 0; drb_id < NGAP_MAX_DRBS_PER_UE; drb_id++)
if (pdusession->param.used_drbs[drb_id] == DRB_ACTIVE_NONGBR) if (pdusession->param.used_drbs[drb_id] == DRB_ACTIVE_NONGBR)
......
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