Commit 59b27ee8 authored by General ABS's avatar General ABS Committed by abs

gNB-CU triggers the handover and sends an UE_context_setup_request to target...

gNB-CU triggers the handover and sends an UE_context_setup_request to target gNB-DU with the CellGroupConfig
parent 0ec09ea9
......@@ -348,6 +348,21 @@ typedef struct f1ap_rb_failed_to_be_setup_s {
long rb_id;
} f1ap_rb_failed_to_be_setup_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;
......@@ -355,6 +370,8 @@ typedef struct cu_to_du_rrc_information_s {
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 {
......
......@@ -90,7 +90,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
f1ap_get_rnti_by_cu_id(DUtype, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id);
}
if(f1ap_ue_context_setup_req->rnti<0)
if (f1ap_ue_context_setup_req->rnti == (uint16_t)(-1))
LOG_E(F1AP, "Could not retrieve UE rnti based on the CU/DU UE id \n");
/* SpCell_ID */
......@@ -126,14 +126,39 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
F1AP_UEContextSetupRequestIEs_t *ieCuRrcInfo;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieCuRrcInfo, container,
F1AP_ProtocolIE_ID_id_CUtoDURRCInformation, false);
if(ieCuRrcInfo!=NULL){
f1ap_ue_context_setup_req->cu_to_du_rrc_information = (cu_to_du_rrc_information_t *)calloc(1,sizeof(cu_to_du_rrc_information_t));
if(ieCuRrcInfo->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList!=NULL){
f1ap_ue_context_setup_req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList = (uint8_t *)calloc(1,ieCuRrcInfo->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList->size);
memcpy(f1ap_ue_context_setup_req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList, ieCuRrcInfo->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList->buf, ieCuRrcInfo->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList->size);
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;
LOG_I(F1AP,
"Size f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length = %i\n",
f1ap_ue_context_setup_req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length);
break;
default:
LOG_E(F1AP, "%s: Procedures for extension value %i are not implemented yet!\n", __FUNCTION__, ie->extensionValue.present);
break;
}
}
}
}
/* DRB */
......@@ -217,7 +242,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
}
ue_context_setup_request(f1ap_ue_context_setup_req);
ue_context_setup_request(instance, f1ap_ue_context_setup_req);
return 0;
}
......
......@@ -124,7 +124,7 @@ static void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl, NR_SetupRelease_P
AssertFatal(false, "%s() not implemented\n", __func__);
}
static void process_rachConfigDedicated(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup)
void process_rachConfigDedicated(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup)
{
DevAssert(nrmac != NULL);
DevAssert(CellGroup != NULL);
......
......@@ -56,6 +56,8 @@ void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1);
bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
bool nr_mac_prepare_ra_nsa_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
void process_rachConfigDedicated(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
int nr_transmission_action_indicator_stop(module_id_t module_id, rnti_t rnti);
void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
int CC_idP,
......
......@@ -24,6 +24,8 @@
#include "mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/RRC/NR/MESSAGES/asn1_msg.h"
#include "SIMULATION/TOOLS/sim.h"
#include <arpa/inet.h>
#include "uper_decoder.h"
#include "uper_encoder.h"
......@@ -93,7 +95,16 @@ static int handle_ue_context_drbs_setup(int rnti,
return drbs_len;
}
void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
rnti_t mac_new_rnti(gNB_MAC_INST *mac)
{
rnti_t rnti = 0;
do {
rnti = (taus() % 65518) + 1;
} while (find_nr_UE(&mac->UE_info, rnti) != NULL);
return rnti;
}
void ue_context_setup_request(instance_t instance, const f1ap_ue_context_setup_t *req)
{
gNB_MAC_INST *mac = RC.nrmac[0];
/* response has same type as request... */
......@@ -112,22 +123,52 @@ 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->rnti);
AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->rnti);
NR_CellGroupConfig_t *CellGroup = NULL;
if (UE == NULL) {
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&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 (CellGroup->spCellConfig &&
CellGroup->spCellConfig->reconfigurationWithSync) {
newUE_Identity = CellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
} else {
newUE_Identity = mac_new_rnti(mac);
}
resp.rnti = newUE_Identity;
resp.crnti = calloc(1, sizeof(uint16_t));
*resp.crnti = resp.rnti;
asn_set_empty(&CellGroup->rlc_BearerToAddModList->list);
CellGroup->rlc_BearerToAddModList->list.count = 0;
process_rachConfigDedicated(mac, resp.rnti, CellGroup);
} else {
CellGroup = UE->CellGroup;
}
if (req->srbs_to_be_setup_length > 0) {
resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(req->rnti,
resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(resp.rnti,
req->srbs_to_be_setup_length,
req->srbs_to_be_setup,
&resp.srbs_to_be_setup,
UE->CellGroup);
CellGroup);
}
if (req->drbs_to_be_setup_length > 0) {
resp.drbs_to_be_setup_length = handle_ue_context_drbs_setup(req->rnti,
resp.drbs_to_be_setup_length = handle_ue_context_drbs_setup(resp.rnti,
req->drbs_to_be_setup_length,
req->drbs_to_be_setup,
&resp.drbs_to_be_setup,
UE->CellGroup);
CellGroup);
}
if (req->rrc_container != NULL)
......@@ -136,18 +177,20 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
//nr_mac_update_cellgroup()
resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t));
AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n");
resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024);
resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, RRC_BUF_SIZE);
AssertFatal(resp.du_to_cu_rrc_information->cellGroupConfig != NULL, "out of memory\n");
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
UE->CellGroup,
CellGroup,
resp.du_to_cu_rrc_information->cellGroupConfig,
1024);
RRC_BUF_SIZE);
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;
/* TODO: need to apply after UE context reconfiguration confirmed? */
process_CellGroup(UE->CellGroup, UE);
if (UE != NULL) {
process_CellGroup(UE->CellGroup, UE);
}
NR_SCHED_UNLOCK(&mac->sched_lock);
......@@ -156,7 +199,7 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
DevAssert(resp.du_to_cu_rrc_information != NULL);
DevAssert(resp.rrc_container == NULL && resp.rrc_container_length == 0);
mac->mac_rrc.ue_context_setup_response(req, &resp);
mac->mac_rrc.ue_context_setup_response(instance, req, &resp);
/* free the memory we allocated above */
free(resp.srbs_to_be_setup);
......
......@@ -25,7 +25,7 @@
#include "platform_types.h"
#include "f1ap_messages_types.h"
void ue_context_setup_request(const f1ap_ue_context_setup_t *req);
void ue_context_setup_request(instance_t instance, const f1ap_ue_context_setup_t *req);
void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req);
void ue_context_release_command(const f1ap_ue_context_release_cmd_t *cmd);
......
......@@ -25,7 +25,9 @@
#include "platform_types.h"
#include "f1ap_messages_types.h"
typedef void (*ue_context_setup_response_func_t)(const f1ap_ue_context_setup_t* req, const f1ap_ue_context_setup_t *resp);
typedef void (*ue_context_setup_response_func_t)(instance_t instance,
const f1ap_ue_context_setup_t *req,
const f1ap_ue_context_setup_t *resp);
typedef void (*ue_context_modification_response_func_t)(const f1ap_ue_context_modif_req_t *req,
const f1ap_ue_context_modif_resp_t *resp);
typedef void (*ue_context_release_request_func_t)(const f1ap_ue_context_release_req_t* req);
......
......@@ -59,7 +59,7 @@ extern UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
extern pthread_mutex_t ue_pf_po_mutex;
extern uint16_t reestablish_rnti_map[MAX_MOBILES_PER_ENB][2];
extern uint16_t ho_rnti_map[NUMBER_OF_DU_PER_CU_MAX][4];
#endif
......@@ -89,5 +89,5 @@ MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
// insert one when eNB received RRCConnectionReestablishmentRequest message
// delete one when eNB received RRCConnectionReestablishmentComplete message
uint16_t reestablish_rnti_map[MAX_MOBILES_PER_ENB][2] = {{0}};
uint16_t ho_rnti_map[NUMBER_OF_DU_PER_CU_MAX][4] = {{0}};
#endif
......@@ -25,7 +25,7 @@
#include "platform_types.h"
#include "f1ap_messages_types.h"
typedef void (*ue_context_setup_request_func_t)(const f1ap_ue_context_setup_t *req);
typedef void (*ue_context_setup_request_func_t)(instance_t instance, const f1ap_ue_context_setup_t *req);
typedef void (*ue_context_modification_request_func_t)(const f1ap_ue_context_modif_req_t *req);
typedef void (*ue_context_release_command_func_t)(const f1ap_ue_context_release_cmd_t *cmd);
......
......@@ -24,7 +24,7 @@
#include "mac_rrc_dl.h"
#include "nr_rrc_defs.h"
static void ue_context_setup_request_f1ap(const f1ap_ue_context_setup_t *req)
static void ue_context_setup_request_f1ap(instance_t instance, const f1ap_ue_context_setup_t *req)
{
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_t *f1ap_msg = &F1AP_UE_CONTEXT_SETUP_REQ(msg);
......
......@@ -53,4 +53,6 @@ extern UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
extern pthread_mutex_t ue_pf_po_mutex;
extern uint16_t ho_rnti_map[NUMBER_OF_DU_PER_CU_MAX][4];
#endif
......@@ -1874,10 +1874,160 @@ static void rrc_gNB_process_MeasurementReport(const protocol_ctxt_t *ctxt_p, rrc
}
if (trigger_ho == true && ue_ctxt->StatusRrc != NR_RRC_HO_EXECUTION) {
LOG_D(NR_RRC, "Trigger handover procedures are not implemented yet!\n");
LOG_I(NR_RRC, "Handover triggered\n");
// The gNB-CU sends an UE CONTEXT SETUP REQUEST message to the target gNB-DU to create an UE context and setup
// SRBs and DRBs bearers
ue_ctxt->StatusRrc = NR_RRC_HO_EXECUTION;
NR_PhysCellId_t physCellId = *meas_results->measResultServingMOList.list.array[0]->measResultBestNeighCell->physCellId;
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_t *req = &F1AP_UE_CONTEXT_SETUP_REQ(message_p);
// UE_IDs will be extracted from F1AP layer
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_p->module_id];
req->gNB_CU_ue_id = 0;
req->gNB_DU_ue_id = 0;
req->rnti = ue_ctxt->rnti;
req->mcc = rrc->configuration.mcc[0];
req->mnc = rrc->configuration.mnc[0];
req->mnc_digit_length = rrc->configuration.mnc_digit_length[0];
req->nr_cellid = rrc->nr_cellid;
// Instruction towards the DU for SRBs configuration
req->srbs_to_be_setup_length = 2;
req->srbs_to_be_setup = calloc(req->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t));
f1ap_srb_to_be_setup_t *SRBs = req->srbs_to_be_setup;
SRBs[0].srb_id = 1;
SRBs[0].lcid = 1;
SRBs[1].srb_id = 2;
SRBs[1].lcid = 2;
// Instruction towards the DU for DRB configuration and tunnel creation
req->drbs_to_be_setup = malloc(1 * sizeof(f1ap_drb_to_be_setup_t));
req->drbs_to_be_setup_length = 1;
f1ap_drb_to_be_setup_t *DRBs = req->drbs_to_be_setup;
DRBs[0].drb_id = 1;
DRBs[0].rlc_mode = RLC_MODE_AM;
DRBs[0].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
DRBs[0].up_ul_tnl[0].port = rrc->eth_params_s.my_portd;
DRBs[0].up_ul_tnl_length = 1;
DRBs[0].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr);
DRBs[0].up_dl_tnl[0].port = rrc->eth_params_s.remote_portd;
DRBs[0].up_dl_tnl_length = 1;
// CellGroupConfig
instance_t instance = get_instance_by_NR_physCellId(physCellId);
NR_ServingCellConfigCommon_t *scc = RC.nrrrc[instance]->carrier.servingcellconfigcommon;
if (ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync == NULL) {
ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync = calloc(1, sizeof(*ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync));
NR_ReconfigurationWithSync_t *reconfigurationWithSync = ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync;
reconfigurationWithSync->spCellConfigCommon = scc;
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon =
rrc->carrier.sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon;
reconfigurationWithSync->newUE_Identity = get_new_rnti(rrc);
reconfigurationWithSync->t304 = NR_ReconfigurationWithSync__t304_ms2000;
reconfigurationWithSync->rach_ConfigDedicated = NULL;
reconfigurationWithSync->ext1 = NULL;
}
if (ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated == NULL) {
ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1, sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated));
struct NR_ReconfigurationWithSync__rach_ConfigDedicated *rach_ConfigDedicated = ue_ctxt->masterCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated;
rach_ConfigDedicated->present = NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
rach_ConfigDedicated->choice.uplink = calloc(1, sizeof(struct NR_RACH_ConfigDedicated));
rach_ConfigDedicated->choice.uplink->ra_Prioritization = NULL;
rach_ConfigDedicated->choice.uplink->ext1 = NULL;
rach_ConfigDedicated->choice.uplink->cfra = calloc(1, sizeof(struct NR_CFRA));
struct NR_CFRA *cfra = rach_ConfigDedicated->choice.uplink->cfra;
cfra->occasions = calloc(1, sizeof(struct NR_CFRA__occasions));
memcpy(&cfra->occasions->rach_ConfigGeneric, &scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t));
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;
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(scc);
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 - (ue_ctxt->gNB_ue_ngap_id % 64);
ASN_SEQUENCE_ADD(&cfra->resources.choice.ssb->ssb_ResourceList.list, ssbElem[n_ssb]);
n_ssb++;
}
}
}
req->cu_to_du_rrc_information = calloc(1, sizeof(cu_to_du_rrc_information_t));
req->cu_to_du_rrc_information->ie_extensions = calloc(1, sizeof(protocol_extension_container_t));
req->cu_to_du_rrc_information->ie_extensions->cell_group_config = calloc(1, RRC_BUF_SIZE);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
ue_ctxt->masterCellGroup,
req->cu_to_du_rrc_information->ie_extensions->cell_group_config,
RRC_BUF_SIZE);
AssertFatal(enc_rval.encoded > 0, "ASN1 NR_CellGroupConfig encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded);
req->cu_to_du_rrc_information->ie_extensions->cell_group_config_length = (enc_rval.encoded + 7) >> 3;
if (ue_ctxt->handover_info == NULL) {
ue_ctxt->handover_info = calloc(1, sizeof(NR_HANDOVER_INFO));
}
ue_ctxt->handover_info->modid_s = ctxt_p->module_id;
ue_ctxt->handover_info->modid_t = instance;
for (int ho_idx = 0; ho_idx < NUMBER_OF_DU_PER_CU_MAX; ho_idx++) {
if (ho_rnti_map[ho_idx][0] == 0) {
ho_rnti_map[ho_idx][0] = ue_ctxt->rnti;
ho_rnti_map[ho_idx][1] = ue_ctxt->handover_info->modid_s;
ho_rnti_map[ho_idx][2] = 0;
ho_rnti_map[ho_idx][3] = ue_ctxt->handover_info->modid_t;
}
}
itti_send_msg_to_task(TASK_CU_F1, RC.nrrrc[instance]->f1_instance, message_p);
}
}
void nr_update_ngu_tunnel_after_handover(gNB_RRC_INST *rrc_instance_source, const long rnti_s, struct rrc_gNB_ue_context_s *ue_context_target, const long rnti_t)
{
struct rrc_gNB_ue_context_s *ue_context_source = rrc_gNB_get_ue_context_by_rnti(rrc_instance_source, rnti_s);
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req = {0};
int j = 0;
for (int i = 0; i < NB_RB_MAX; i++) {
if (ue_context_source->ue_context.pduSession[i].status == PDU_SESSION_STATUS_ESTABLISHED || ue_context_source->ue_context.pduSession[i].status == PDU_SESSION_STATUS_DONE) {
create_tunnel_req.pdusession_id[j] = ue_context_source->ue_context.pduSession[i].param.pdusession_id;
create_tunnel_req.incoming_rb_id[j] = i + 1;
create_tunnel_req.outgoing_teid[j] = ue_context_source->ue_context.pduSession[i].param.gtp_teid;
create_tunnel_req.outgoing_qfi[j] = ue_context_source->ue_context.pduSession[i].param.qos[0].qfi;
memcpy(create_tunnel_req.dst_addr[j].buffer, ue_context_source->ue_context.pduSession[i].param.upf_addr.buffer, sizeof(uint8_t) * 20);
create_tunnel_req.dst_addr[j].length = ue_context_source->ue_context.pduSession[i].param.upf_addr.length;
j++;
}
}
create_tunnel_req.ue_id = rnti_t;
create_tunnel_req.num_tunnels = j;
gtpv1u_update_ngu_tunnel(0, &create_tunnel_req, rnti_s);
}
rnti_t find_ho_rnti_by_modid_s(const uint8_t modid_s)
{
for (int ho_id = 0; ho_id < NUMBER_OF_DU_PER_CU_MAX; ho_id++) {
if (ho_rnti_map[ho_id][1] == modid_s) {
return ho_rnti_map[ho_id][0];
}
}
return -1;
}
static int handle_rrcReestablishmentComplete(const protocol_ctxt_t *const ctxt_pP,
const NR_RRCReestablishmentComplete_t *reestablishment_complete)
{
......@@ -3034,7 +3184,7 @@ static void rrc_deliver_ue_ctxt_setup_req(void *deliver_pdu_data, ue_id_t ue_id,
.rrc_container = (uint8_t*) buf, /* security mode command */
.rrc_container_length = size,
};
rrc->mac_rrc.ue_context_setup_request(&ue_context_setup_req);
rrc->mac_rrc.ue_context_setup_request(0, &ue_context_setup_req);
}
//-----------------------------------------------------------------------------
......
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