Commit 187b9523 authored by rmagueta's avatar rmagueta

gNB-CU sends the ue_context_setup_request to the target gNB-DU

parent 2fa0a34a
......@@ -420,14 +420,31 @@ typedef struct f1ap_drb_to_be_released_t {
long rb_id;
} f1ap_drb_to_be_released_t;
typedef struct protocol_extension_container_s {
uint8_t *handover_oreparation_information;
uint32_t handover_oreparation_information_length;
uint8_t *cell_group_config;
uint32_t cell_group_config_length;
uint8_t *measurement_timing_configuration;
uint32_t measurement_timing_configuration_length;
uint8_t *ue_assistance_information;
uint32_t ue_assistance_information_length;
uint8_t *cg_config;
uint32_t cg_config_length;
uint8_t *ue_ssistance_information_EUTRA;
uint32_t ue_ssistance_information_EUTRA_length;
} protocol_extension_container_t;
typedef struct cu_to_du_rrc_information_s {
uint8_t * cG_ConfigInfo;
uint32_t cG_ConfigInfo_length;
uint8_t * uE_CapabilityRAT_ContainerList;
uint32_t uE_CapabilityRAT_ContainerList_length;
uint8_t * measConfig;
uint32_t measConfig_length;
}cu_to_du_rrc_information_t;
uint8_t *cG_ConfigInfo;
uint32_t cG_ConfigInfo_length;
uint8_t *uE_CapabilityRAT_ContainerList;
uint32_t uE_CapabilityRAT_ContainerList_length;
uint8_t *measConfig;
uint32_t measConfig_length;
protocol_extension_container_t *ie_extensions;
uint32_t ie_extensions_length;
} cu_to_du_rrc_information_t;
typedef struct du_to_cu_rrc_information_s {
uint8_t * cellGroupConfig;
......@@ -463,6 +480,7 @@ typedef struct f1ap_ue_context_setup_s {
//uint8_t *du_to_cu_rrc_information;
du_to_cu_rrc_information_t *du_to_cu_rrc_information;
uint32_t du_to_cu_rrc_information_length;
uint16_t *crnti;
f1ap_drb_to_be_setup_t *drbs_to_be_setup;
uint8_t drbs_to_be_setup_length;
f1ap_drb_to_be_setup_t *drbs_to_be_modified;
......
......@@ -272,6 +272,22 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_context_setu
OCTET_STRING_fromBuf(measConfig, (const char*)f1ap_ue_context_setup_req->cu_to_du_rrc_information->measConfig,
f1ap_ue_context_setup_req->cu_to_du_rrc_information->measConfig_length);
}
/* optional */
/* 6.4 iE_Extensions */
if (f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions != NULL) {
F1AP_ProtocolExtensionContainer_10696P60_t *p_10696P60 = calloc(1, sizeof(*p_10696P60));
ie6->value.choice.CUtoDURRCInformation.iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_10696P60;
if (f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config != NULL) {
asn1cSequenceAdd(p_10696P60->list, F1AP_CUtoDURRCInformation_ExtIEs_t, cu_to_du__ExtIEs);
cu_to_du__ExtIEs->id = F1AP_ProtocolIE_ID_id_CellGroupConfig;
cu_to_du__ExtIEs->criticality = F1AP_Criticality_reject;
cu_to_du__ExtIEs->extensionValue.present = F1AP_CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig;
F1AP_CellGroupConfig_t *CellGroupConfig = &cu_to_du__ExtIEs->extensionValue.choice.CellGroupConfig;
OCTET_STRING_fromBuf(CellGroupConfig,
(const char *)f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config,
f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length);
}
}
}
/* optional */
......
......@@ -176,6 +176,24 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_i
f1ap_ue_context_setup_req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length = ieCuRrcInfo->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList->size;
LOG_D(F1AP, "Size f1ap_ue_context_setup_req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length: %d \n", f1ap_ue_context_setup_req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length);
}
if (ieCuRrcInfo->value.choice.CUtoDURRCInformation.iE_Extensions != NULL) {
f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions = (protocol_extension_container_t *)calloc(1, sizeof(protocol_extension_container_t));
F1AP_ProtocolExtensionContainer_10696P60_t *ie_extensions = (F1AP_ProtocolExtensionContainer_10696P60_t *)ieCuRrcInfo->value.choice.CUtoDURRCInformation.iE_Extensions;
for (int i_ext = 0; i_ext < ie_extensions->list.count; i_ext++) {
F1AP_CUtoDURRCInformation_ExtIEs_t *ie = ie_extensions->list.array[i_ext];
switch (ie->extensionValue.present) {
case F1AP_CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig:
f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config =
(uint8_t *)calloc(1, ie->extensionValue.choice.CellGroupConfig.size*sizeof(uint8_t));
memcpy(f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config, ie->extensionValue.choice.CellGroupConfig.buf, ie->extensionValue.choice.CellGroupConfig.size);
f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length = ie->extensionValue.choice.CellGroupConfig.size;
break;
default:
LOG_E(F1AP, "%s: Procedures for extension value %i are not implemented yet!\n", __FUNCTION__, ie->extensionValue.present);
break;
}
}
}
}
/* DRB */
......
......@@ -31,6 +31,7 @@
#include "uper_decoder.h"
#include "uper_encoder.h"
#include "SIMULATION/TOOLS/sim.h"
// Standarized 5QI values and Default Priority levels as mentioned in 3GPP TS 23.501 Table 5.7.4-1
const uint64_t qos_fiveqi[26] = {1, 2, 3, 4, 65, 66, 67, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86};
......@@ -161,11 +162,19 @@ static int handle_ue_context_srbs_setup(NR_UE_info_t *UE,
for (int i = 0; i < srbs_len; i++) {
const f1ap_srb_to_be_setup_t *srb = &req_srbs[i];
NR_RLC_BearerConfig_t *rlc_BearerConfig = get_bearerconfig_from_srb(srb);
nr_rlc_add_srb(UE->rnti, srb->srb_id, rlc_BearerConfig);
int priority = rlc_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority;
nr_lc_config_t c = {.lcid = rlc_BearerConfig->logicalChannelIdentity, .priority = priority};
nr_mac_add_lcid(&UE->UE_sched_ctrl, &c);
rnti_t rnti = UE ? UE->rnti
: cellGroupConfig->spCellConfig && cellGroupConfig->spCellConfig->reconfigurationWithSync
? cellGroupConfig->spCellConfig->reconfigurationWithSync->newUE_Identity
: 0;
AssertFatal(rnti > 0, "Invalid RNTI\n");
nr_rlc_add_srb(rnti, srb->srb_id, rlc_BearerConfig);
if (UE) {
int priority = rlc_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority;
nr_lc_config_t c = {.lcid = rlc_BearerConfig->logicalChannelIdentity, .priority = priority};
nr_mac_add_lcid(&UE->UE_sched_ctrl, &c);
}
(*resp_srbs)[i] = *srb;
......@@ -227,16 +236,24 @@ static int handle_ue_context_drbs_setup(NR_UE_info_t *UE,
const f1ap_drb_to_be_setup_t *drb = &req_drbs[i];
f1ap_drb_to_be_setup_t *resp_drb = &(*resp_drbs)[i];
NR_RLC_BearerConfig_t *rlc_BearerConfig = get_bearerconfig_from_drb(drb);
nr_rlc_add_drb(UE->rnti, drb->drb_id, rlc_BearerConfig);
nr_lc_config_t c = {.lcid = rlc_BearerConfig->logicalChannelIdentity, .nssai = drb->nssai};
int prio = 100;
for (int q = 0; q < drb->drb_info.flows_to_be_setup_length; ++q) {
c.qos_config[q] = get_qos_config(&drb->drb_info.flows_mapped_to_drb[q].qos_params.qos_characteristics);
prio = min(prio, c.qos_config[q].priority);
rnti_t rnti = UE ? UE->rnti
: cellGroupConfig->spCellConfig && cellGroupConfig->spCellConfig->reconfigurationWithSync
? cellGroupConfig->spCellConfig->reconfigurationWithSync->newUE_Identity
: 0;
AssertFatal(rnti > 0, "Invalid RNTI\n");
nr_rlc_add_drb(rnti, drb->drb_id, rlc_BearerConfig);
if (UE) {
nr_lc_config_t c = {.lcid = rlc_BearerConfig->logicalChannelIdentity, .nssai = drb->nssai};
int prio = 100;
for (int q = 0; q < drb->drb_info.flows_to_be_setup_length; ++q) {
c.qos_config[q] = get_qos_config(&drb->drb_info.flows_mapped_to_drb[q].qos_params.qos_characteristics);
prio = min(prio, c.qos_config[q].priority);
}
c.priority = prio;
nr_mac_add_lcid(&UE->UE_sched_ctrl, &c);
}
c.priority = prio;
nr_mac_add_lcid(&UE->UE_sched_ctrl, &c);
*resp_drb = *drb;
// just put same number of tunnels in DL as in UL
......@@ -247,7 +264,7 @@ static int handle_ue_context_drbs_setup(NR_UE_info_t *UE,
int qfi = -1; // don't put PDU session marker in GTP
gtpv1u_gnb_create_tunnel_resp_t resp_f1 = {0};
int ret = drb_gtpu_create(f1inst,
UE->rnti,
rnti,
drb->drb_id,
drb->drb_id,
qfi,
......@@ -376,9 +393,50 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
NR_SCHED_LOCK(&mac->sched_lock);
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id);
AssertFatal(UE, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id);
NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup);
NR_CellGroupConfig_t *new_CellGroup = NULL;
if (UE == NULL) {
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&new_CellGroup,
(uint8_t *)req->cu_to_du_rrc_information->ie_extensions->cell_group_config,
(int)req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length);
AssertFatal(dec_rval.code == RC_OK, "could not decode cellGroupConfig\n");
rnti_t newUE_Identity = 0;
if (new_CellGroup->spCellConfig &&
new_CellGroup->spCellConfig->reconfigurationWithSync) {
newUE_Identity = new_CellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
} else {
newUE_Identity = (taus() % 65518) + 1;
}
if (new_CellGroup->spCellConfig && new_CellGroup->spCellConfig->reconfigurationWithSync) {
NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon;
asn_copy(&asn_DEF_NR_ServingCellConfigCommon,
(void **)&new_CellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon,
scc);
}
resp.crnti = calloc(1, sizeof(uint16_t));
*resp.crnti = newUE_Identity;
resp.gNB_DU_ue_id = newUE_Identity;
asn_set_empty(&new_CellGroup->rlc_BearerToAddModList->list);
new_CellGroup->rlc_BearerToAddModList->list.count = 0;
if (!du_exists_f1_ue_data(resp.gNB_DU_ue_id)) {
LOG_I(NR_MAC, "No CU UE ID stored for UE RNTI %04x, adding CU UE ID %d\n", resp.gNB_DU_ue_id, resp.gNB_CU_ue_id);
f1_ue_data_t new_ue_data = {.secondary_ue = resp.gNB_CU_ue_id};
du_add_f1_ue_data(resp.gNB_DU_ue_id, &new_ue_data);
}
nr_mac_prepare_ra_ue(mac, newUE_Identity, new_CellGroup);
} else {
new_CellGroup = clone_CellGroupConfig(UE->CellGroup);
}
if (req->srbs_to_be_setup_length > 0) {
resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(UE,
......@@ -401,9 +459,9 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, id, req->rrc_container, req->rrc_container_length);
}
UE->capability = ue_cap;
if (ue_cap != NULL) {
// store the new UE capabilities, and update the cellGroupConfig
UE->capability = ue_cap;
NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon;
update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc);
}
......@@ -417,7 +475,8 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
AssertFatal(enc_rval.encoded > 0, "Could not encode CellGroup, failed element %s\n", enc_rval.failed_type->name);
resp.du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded + 7) >> 3;
nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup);
if (UE != NULL)
nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup);
NR_SCHED_UNLOCK(&mac->sched_lock);
......
......@@ -73,6 +73,17 @@ static void ue_context_setup_request_f1ap(sctp_assoc_t assoc_id, const f1ap_ue_c
AssertFatal(du2cu_new->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n");
memcpy(du2cu_new->uE_CapabilityRAT_ContainerList, du2cu_req->uE_CapabilityRAT_ContainerList, du2cu_new->uE_CapabilityRAT_ContainerList_length);
}
if (req->cu_to_du_rrc_information->ie_extensions != NULL && req->cu_to_du_rrc_information->ie_extensions->cell_group_config != NULL) {
const cu_to_du_rrc_information_t *du2cu_req = req->cu_to_du_rrc_information;
cu_to_du_rrc_information_t *du2cu_new = f1ap_msg->cu_to_du_rrc_information;
du2cu_new->ie_extensions = calloc(1, sizeof(protocol_extension_container_t));
AssertFatal(du2cu_new->ie_extensions != NULL, "out of memory\n");
DevAssert(du2cu_req->ie_extensions->cell_group_config_length > 0);
du2cu_new->ie_extensions->cell_group_config_length = du2cu_req->ie_extensions->cell_group_config_length;
du2cu_new->ie_extensions->cell_group_config = malloc(du2cu_new->ie_extensions->cell_group_config_length);
AssertFatal(du2cu_new->ie_extensions->cell_group_config != NULL, "out of memory\n");
memcpy(du2cu_new->ie_extensions->cell_group_config, du2cu_req->ie_extensions->cell_group_config, du2cu_new->ie_extensions->cell_group_config_length);
}
}
if (req->drbs_to_be_setup_length > 0) {
int n = req->drbs_to_be_setup_length;
......
......@@ -446,6 +446,7 @@ typedef struct gNB_RRC_INST_s {
// RRC configuration
gNB_RrcConfigurationReq configuration;
f1ap_drb_to_be_setup_t drbs[32];
// gNB N3 GTPU instance
instance_t e1_inst;
......
......@@ -265,9 +265,134 @@ static void rrc_gNB_CU_DU_init(gNB_RRC_INST *rrc)
cu_init_f1_ue_data();
}
void nr_HO_trigger()
static uint64_t get_ssb_bitmap_from_SIB1(const NR_SIB1_t *sib1)
{
LOG_E(NR_RRC, "Handover procedures are not implemented yet!\n");
return ((uint64_t)sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf[0]) << 56;
}
static rnti_t get_new_rnti(gNB_RRC_INST *rrc)
{
rnti_t rnti;
do {
rnti = (taus() % 65518) + 1;
} while (rrc_gNB_get_ue_context(rrc, rnti) != NULL);
return rnti;
}
void nr_HO_trigger(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_pP, nr_rrc_du_container_t *du)
{
LOG_I(NR_RRC, "Handover triggered\n");
// The gNB-CU sends a UE CONTEXT SETUP REQUEST message to the target gNB-DU to create a UE context and setup
// SRBs and DRBs bearers
// Handover information
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
nr_rrc_du_container_t *target_du = find_target_du(rrc, du->assoc_id);
if (target_du == NULL) {
LOG_E(NR_RRC, "Target gNB-DU not found. Handover aborted.\n");
return;
}
if (!ue_p->masterCellGroup || !ue_p->masterCellGroup->spCellConfig) {
LOG_E(NR_RRC, "CellGroupConfig or SpCellConfig not found. Handover aborted.\n");
return;
}
ue_p->StatusRrc = NR_RRC_HO_EXECUTION;
ue_p->handover_info.source_assoc_id = du->assoc_id;
ue_p->handover_info.source_rnti = ue_p->rnti;
ue_p->handover_info.target_assoc_id = target_du->assoc_id;
ue_p->handover_info.target_rnti = get_new_rnti(rrc);
// ReconfigurationWithSync
if (ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync == NULL) {
ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync =
calloc(1, sizeof(*ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync));
}
NR_ReconfigurationWithSync_t *reconfigurationWithSync = ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync;
reconfigurationWithSync->newUE_Identity = ue_p->handover_info.target_rnti;
reconfigurationWithSync->t304 = NR_ReconfigurationWithSync__t304_ms2000;
reconfigurationWithSync->rach_ConfigDedicated = NULL;
reconfigurationWithSync->ext1 = NULL;
if (ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated == NULL) {
ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated =
calloc(1, sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated));
}
struct NR_ReconfigurationWithSync__rach_ConfigDedicated *rach_ConfigDedicated =
ue_p->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated;
rach_ConfigDedicated->present = NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
if (rach_ConfigDedicated->choice.uplink == NULL) {
rach_ConfigDedicated->choice.uplink = calloc(1, sizeof(struct NR_RACH_ConfigDedicated));
}
rach_ConfigDedicated->choice.uplink->ra_Prioritization = NULL;
rach_ConfigDedicated->choice.uplink->ext1 = NULL;
if (rach_ConfigDedicated->choice.uplink->cfra == NULL) {
rach_ConfigDedicated->choice.uplink->cfra = calloc(1, sizeof(struct NR_CFRA));
}
struct NR_CFRA *cfra = rach_ConfigDedicated->choice.uplink->cfra;
if (cfra->occasions == NULL) {
cfra->occasions = calloc(1, sizeof(struct NR_CFRA__occasions));
}
memcpy(&reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric,
&du->sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric,
sizeof(NR_RACH_ConfigGeneric_t));
if (cfra->occasions->ssb_perRACH_Occasion == NULL) {
cfra->occasions->ssb_perRACH_Occasion = calloc(1, sizeof(long));
}
*cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one;
cfra->resources.present = NR_CFRA__resources_PR_ssb;
if (cfra->resources.choice.ssb == NULL) {
cfra->resources.choice.ssb = calloc(1, sizeof(struct NR_CFRA__resources__ssb));
}
cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
int n_ssb = 0;
uint64_t bitmap = get_ssb_bitmap_from_SIB1(du->sib1); // TODO: Is this right?
struct NR_CFRA_SSB_Resource *ssbElem[64];
for (int i = 0; i < 64; i++) {
if ((bitmap >> (63 - i)) & 0x01) {
ssbElem[n_ssb] = calloc(1, sizeof(struct NR_CFRA_SSB_Resource));
ssbElem[n_ssb]->ssb = i;
ssbElem[n_ssb]->ra_PreambleIndex = 63 - (taus() % 64);
ASN_SEQUENCE_ADD(&cfra->resources.choice.ssb->ssb_ResourceList.list, ssbElem[n_ssb]);
n_ssb++;
}
}
cu_to_du_rrc_information_t cu2du = {0};
cu2du.ie_extensions = calloc(1, sizeof(protocol_extension_container_t));
cu2du.ie_extensions->cell_group_config = calloc(1, 4096);
asn_enc_rval_t enc_rval =
uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, ue_p->masterCellGroup, cu2du.ie_extensions->cell_group_config, 4096);
AssertFatal(enc_rval.encoded > 0,
"ASN1 NR_CellGroupConfig encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name,
enc_rval.encoded);
cu2du.ie_extensions->cell_group_config_length = (enc_rval.encoded + 7) >> 3;
// SRBs
f1ap_srb_to_be_setup_t srbs[2] = {{.srb_id = 1, .lcid = 1}, {.srb_id = 2, .lcid = 2}};
// The callback will fill the UE context setup request and forward it
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_p->rrc_ue_id);
f1ap_served_cell_info_t *cell_info = &target_du->setup_req->cell[0].info;
RETURN_IF_INVALID_ASSOC_ID(ue_data);
f1ap_ue_context_setup_t ue_context_setup_req = {
.gNB_CU_ue_id = ue_p->rrc_ue_id,
.gNB_DU_ue_id = reconfigurationWithSync->newUE_Identity,
.plmn.mcc = cell_info->plmn.mcc,
.plmn.mnc = cell_info->plmn.mnc,
.plmn.mnc_digit_length = cell_info->plmn.mnc_digit_length,
.nr_cellid = cell_info->nr_cellid,
.servCellId = 0, // TODO: correct value?
.srbs_to_be_setup_length = 2,
.srbs_to_be_setup = srbs,
.drbs_to_be_setup_length = 1,
.drbs_to_be_setup = (f1ap_drb_to_be_setup_t *)&rrc->drbs[0],
.cu_to_du_rrc_information = &cu2du,
};
rrc->mac_rrc.ue_context_setup_request(ue_p->handover_info.target_assoc_id, &ue_context_setup_req);
}
void nr_rrc_update_ho_timer(gNB_RRC_INST *rrc)
......@@ -285,7 +410,8 @@ void nr_rrc_update_ho_timer(gNB_RRC_INST *rrc)
ue_p->handover_info.location_ho_timer--;
if (ue_p->handover_info.location_ho_timer == 0) {
nr_HO_trigger();
ue_p->handover_info.location_ho_timer_active = false;
nr_HO_trigger(rrc, ue_context_p, du);
}
} else {
......@@ -2165,14 +2291,13 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
}
/* Instruction towards the DU for DRB configuration and tunnel creation */
f1ap_drb_to_be_setup_t drbs[32]; // maximum DRB can be 32
int nb_drb = 0;
for (int p = 0; p < resp->numPDUSessions; ++p) {
rrc_pdu_session_param_t *RRC_pduSession = find_pduSession(UE, resp->pduSession[p].id, false);
DevAssert(RRC_pduSession);
for (int i = 0; i < resp->pduSession[p].numDRBSetup; i++) {
DRB_nGRAN_setup_t *drb_config = &resp->pduSession[p].DRBnGRanList[i];
f1ap_drb_to_be_setup_t *drb = &drbs[nb_drb];
f1ap_drb_to_be_setup_t *drb = &rrc->drbs[nb_drb];
drb->drb_id = resp->pduSession[p].DRBnGRanList[i].id;
drb->rlc_mode = rrc->configuration.um_on_default_drb ? RLC_MODE_UM : RLC_MODE_AM;
drb->up_ul_tnl[0].tl_address = drb_config->UpParamList[0].tlAddress;
......@@ -2216,9 +2341,9 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
AssertFatal(UE->as_security_active, "logic bug: security should be active when activating DRBs\n");
if (!UE->f1_ue_context_active)
rrc_gNB_generate_UeContextSetupRequest(rrc, ue_context_p, nb_drb, drbs);
rrc_gNB_generate_UeContextSetupRequest(rrc, ue_context_p, nb_drb, rrc->drbs);
else
rrc_gNB_generate_UeContextModificationRequest(rrc, ue_context_p, nb_drb, drbs, 0, NULL);
rrc_gNB_generate_UeContextModificationRequest(rrc, ue_context_p, nb_drb, rrc->drbs, 0, NULL);
}
/**
......
......@@ -517,3 +517,31 @@ void dump_du_info(const gNB_RRC_INST *rrc, FILE *f)
}
}
}
nr_rrc_du_container_t *find_target_du(gNB_RRC_INST *rrc, sctp_assoc_t source_assoc_id)
{
nr_rrc_du_container_t *target_du = NULL;
nr_rrc_du_container_t *it = NULL;
bool next_du = false;
RB_FOREACH (it, rrc_du_tree, &rrc->dus) {
if(next_du == false && source_assoc_id != it->assoc_id) {
continue;
} else if (source_assoc_id == it->assoc_id) {
next_du = true;
} else {
target_du = it;
break;
}
}
if (target_du == NULL) {
RB_FOREACH (it, rrc_du_tree, &rrc->dus) {
if (source_assoc_id == it->assoc_id) {
continue;
} else {
target_du = it;
break;
}
}
}
return target_du;
}
\ No newline at end of file
......@@ -48,4 +48,5 @@ int get_dl_band(const struct f1ap_served_cell_info_t *cell_info);
int get_ssb_scs(const struct f1ap_served_cell_info_t *cell_info);
int get_ssb_arfcn(const struct nr_rrc_du_container_t *du);
struct nr_rrc_du_container_t *find_target_du(struct gNB_RRC_INST_s *rrc, sctp_assoc_t source_assoc_id);
#endif /* RRC_GNB_DU_H_ */
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