Commit b46077c2 authored by KARIM BOUTIBA's avatar KARIM BOUTIBA Committed by Robert Schmidt

add multiple pdu session support (tested with 2 pdu sessions)

parent 5bf454c7
...@@ -451,7 +451,7 @@ int nr_process_mac_pdu(module_id_t module_idP, ...@@ -451,7 +451,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
0); 0);
break; break;
case UL_SCH_LCID_DTCH: case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28):
// check if LCID is valid at current time. // check if LCID is valid at current time.
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
return 0; return 0;
......
...@@ -977,11 +977,6 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -977,11 +977,6 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
exit(1); exit(1);
} }
if (drb_id != 1) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n",
__FILE__, __LINE__, __FUNCTION__, drb_id);
exit(1);
}
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
......
...@@ -2161,7 +2161,7 @@ void fill_initial_SpCellConfig(int uid, ...@@ -2161,7 +2161,7 @@ void fill_initial_SpCellConfig(int uid,
} }
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb) { void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb, uint8_t configure_srb, uint8_t bearer_id_start, uint8_t nb_bearers_to_setup, long *priority ) {
cellGroupConfig->cellGroupId = 0; cellGroupConfig->cellGroupId = 0;
cellGroupConfig->rlc_BearerToReleaseList = NULL; cellGroupConfig->rlc_BearerToReleaseList = NULL;
...@@ -2169,6 +2169,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr ...@@ -2169,6 +2169,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
// RLC Bearer Config // RLC Bearer Config
// TS38.331 9.2.1 Default SRB configurations // TS38.331 9.2.1 Default SRB configurations
if (configure_srb){
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
NR_RLC_Config_t *rlc_Config = NULL; NR_RLC_Config_t *rlc_Config = NULL;
NR_LogicalChannelConfig_t *logicalChannelConfig = NULL; NR_LogicalChannelConfig_t *logicalChannelConfig = NULL;
...@@ -2208,40 +2209,41 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr ...@@ -2208,40 +2209,41 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig; rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig);
}
// DRB Configuration // DRB Configuration
NR_RLC_BearerConfig_t *rlc_BearerConfig_drb = NULL; for (int i = bearer_id_start; i < bearer_id_start + nb_bearers_to_setup; i++ ){
NR_RLC_Config_t *rlc_Config_drb = NULL; NR_RLC_BearerConfig_t *rlc_BearerConfig_drb = NULL;
NR_LogicalChannelConfig_t *logicalChannelConfig_drb = NULL; NR_RLC_Config_t *rlc_Config_drb = NULL;
long *logicalChannelGroup_drb = NULL; NR_LogicalChannelConfig_t *logicalChannelConfig_drb = NULL;
rlc_BearerConfig_drb = calloc(1, sizeof(NR_RLC_BearerConfig_t)); long *logicalChannelGroup_drb = NULL;
rlc_BearerConfig_drb->logicalChannelIdentity = 4; rlc_BearerConfig_drb = calloc(1, sizeof(NR_RLC_BearerConfig_t));
rlc_BearerConfig_drb->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig_drb->servedRadioBearer)); rlc_BearerConfig_drb->logicalChannelIdentity = 3 + i ;
rlc_BearerConfig_drb->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity; rlc_BearerConfig_drb->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig_drb->servedRadioBearer));
rlc_BearerConfig_drb->servedRadioBearer->choice.drb_Identity = 1; rlc_BearerConfig_drb->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
rlc_BearerConfig_drb->reestablishRLC = NULL; rlc_BearerConfig_drb->servedRadioBearer->choice.drb_Identity = i;
rlc_Config_drb = calloc(1, sizeof(NR_RLC_Config_t)); rlc_BearerConfig_drb->reestablishRLC = NULL;
rlc_Config_drb = calloc(1, sizeof(NR_RLC_Config_t));
if (use_rlc_um_for_drb) nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_um_Bi_Directional);
else nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_am); if (use_rlc_um_for_drb) nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_um_Bi_Directional);
else nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_am);
rlc_BearerConfig_drb->rlc_Config = rlc_Config_drb; rlc_BearerConfig_drb->rlc_Config = rlc_Config_drb;
logicalChannelConfig_drb = calloc(1, sizeof(NR_LogicalChannelConfig_t)); logicalChannelConfig_drb = calloc(1, sizeof(NR_LogicalChannelConfig_t));
logicalChannelConfig_drb->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters)); logicalChannelConfig_drb->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters));
logicalChannelConfig_drb->ul_SpecificParameters->priority = 13; logicalChannelConfig_drb->ul_SpecificParameters->priority = priority[i-bearer_id_start];
logicalChannelConfig_drb->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; logicalChannelConfig_drb->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
logicalChannelConfig_drb->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100; logicalChannelConfig_drb->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100;
logicalChannelGroup_drb = CALLOC(1, sizeof(long)); logicalChannelGroup_drb = CALLOC(1, sizeof(long));
*logicalChannelGroup_drb = 1; *logicalChannelGroup_drb = 1;
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup_drb; logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup_drb;
logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID)); logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID));
*logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = 0; *logicalChannelConfig_drb->ul_SpecificParameters->schedulingRequestID = 0;
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_Mask = 0; logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_Mask = 0;
logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0; logicalChannelConfig_drb->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
rlc_BearerConfig_drb->mac_LogicalChannelConfig = logicalChannelConfig_drb; rlc_BearerConfig_drb->mac_LogicalChannelConfig = logicalChannelConfig_drb;
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig_drb); ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig_drb);
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig_drb); ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig_drb);
}
} }
......
...@@ -117,7 +117,13 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, ...@@ -117,7 +117,13 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
NR_UE_NR_Capability_t *uecap, NR_UE_NR_Capability_t *uecap,
const gNB_RrcConfigurationReq *configuration); const gNB_RrcConfigurationReq *configuration);
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb); void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
NR_CellGroupConfig_t *ue_context_mastercellGroup,
int use_rlc_um_for_drb,
uint8_t configure_srb,
uint8_t bearer_id_start,
uint8_t nb_bearers_to_setup,
long *priority);
int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer, uint8_t *const buffer,
......
...@@ -845,6 +845,9 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -845,6 +845,9 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
int qos_flow_index = 0; int qos_flow_index = 0;
int pdu_sessions_done = 0; int pdu_sessions_done = 0;
int i; int i;
uint8_t drb_id_to_setup_start = 1;
uint8_t nb_drb_to_setup = 0;
long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
NR_CellGroupConfig_t *cellGroupConfig; NR_CellGroupConfig_t *cellGroupConfig;
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
...@@ -887,6 +890,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -887,6 +890,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = i+1; DRB_config->drb_Identity = i+1;
if (drb_id_to_setup_start == 1) drb_id_to_setup_start = DRB_config->drb_Identity;
nb_drb_to_setup++;
DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation)); DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation));
DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config; DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config;
// sdap_Config // sdap_Config
...@@ -1000,8 +1005,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -1000,8 +1005,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup,
rrc->um_on_default_drb); fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup, rrc->um_on_default_drb, (drb_id_to_setup_start < 2) ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority);
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer), size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid, xid,
*SRB_configList2, *SRB_configList2,
...@@ -3245,10 +3250,9 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3245,10 +3250,9 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p); f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p);
uint32_t incoming_teid = 0; uint32_t incoming_teid = 0;
uint8_t drb_id_to_setup_start = 0;
NR_CellGroupConfig_t *cellGroupConfig; uint8_t nb_drb_to_setup = 0;
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup,rrc->um_on_default_drb);
/* Configure SRB2 */ /* Configure SRB2 */
NR_SRB_ToAddMod_t *SRB2_config = NULL; NR_SRB_ToAddMod_t *SRB2_config = NULL;
...@@ -3277,6 +3281,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3277,6 +3281,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList)); ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList));
} }
DRB_configList = ue_context_p->ue_context.DRB_configList; DRB_configList = ue_context_p->ue_context.DRB_configList;
nb_drb_to_setup = req->drbs_to_be_setup_length;
for (int i=0; i<req->drbs_to_be_setup_length; i++){ for (int i=0; i<req->drbs_to_be_setup_length; i++){
DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id; DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
...@@ -3286,6 +3291,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3286,6 +3291,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address)); memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address));
addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8; addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8;
extern instance_t DUuniqInstance; extern instance_t DUuniqInstance;
if (!drb_id_to_setup_start) drb_id_to_setup_start = drb_p.drb_id;
incoming_teid=newGtpuCreateTunnel(DUuniqInstance, incoming_teid=newGtpuCreateTunnel(DUuniqInstance,
req->rnti, req->rnti,
drb_p.drb_id, drb_p.drb_id,
...@@ -3297,6 +3303,10 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3297,6 +3303,10 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
} }
} }
NR_CellGroupConfig_t *cellGroupConfig;
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup, rrc->um_on_default_drb, SRB2_config ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority);
apply_macrlc_config(rrc, ue_context_p, &ctxt); apply_macrlc_config(rrc, ue_context_p, &ctxt);
/* Fill the UE context setup response ITTI message to send to F1AP */ /* Fill the UE context setup response ITTI message to send to F1AP */
resp->gNB_CU_ue_id = req->gNB_CU_ue_id; resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
......
...@@ -905,7 +905,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( ...@@ -905,7 +905,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) { for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) {
// if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) { // if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) {
if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) { if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) {
pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession]; pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdu_sessions_done];
tmp->pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; tmp->pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id;
// tmp->pdusession_id = 1; // tmp->pdusession_id = 1;
tmp->nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; tmp->nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos;
......
...@@ -462,7 +462,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer ...@@ -462,7 +462,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer
auto inst=&globGtp.instances[instance]; auto inst=&globGtp.instances[instance];
auto it=inst->ue2te_mapping.find(rnti); auto it=inst->ue2te_mapping.find(rnti);
if ( it != inst->ue2te_mapping.end() ) { if ( it != inst->ue2te_mapping.end() && it->second.bearers.find(outgoing_bearer_id) != it->second.bearers.end()) {
LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti); LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti);
inst->ue2te_mapping.erase(it); inst->ue2te_mapping.erase(it);
} }
......
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