Commit 150400e7 authored by rmagueta's avatar rmagueta

gNB-CU sends the ue_context_modification_request to the source gNB-DU with the...

gNB-CU sends the ue_context_modification_request to the source gNB-DU with the TransmissionActionIndicator and RRCReconfiguration. This RRC Reconfiguration is sent to the UE.
parent 78120fb0
......@@ -497,6 +497,7 @@ typedef struct f1ap_ue_context_setup_s {
ReconfigurationCompl_t ReconfigComplOutcome;
uint8_t *rrc_container;
int rrc_container_length;
uint8_t *transmission_action_indicator;
} f1ap_ue_context_setup_t, f1ap_ue_context_modif_req_t, f1ap_ue_context_modif_resp_t;
typedef enum F1ap_Cause_e {
......
......@@ -1023,12 +1023,12 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_conte
/* optional */
/* c7. TransmissionActionIndicator */
if (0) {
if (f1ap_ue_context_modification_req->transmission_action_indicator != NULL) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie7);
ie7->id = F1AP_ProtocolIE_ID_id_TransmissionActionIndicator;
ie7->criticality = F1AP_Criticality_ignore;
ie7->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator;
ie7->value.choice.TransmissionActionIndicator = F1AP_TransmissionActionIndicator_stop;
ie7->value.choice.TransmissionActionIndicator = *f1ap_ue_context_modification_req->transmission_action_indicator;
}
/* optional */
......
......@@ -1030,6 +1030,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t
/* correct here */
if ( ieRRC->value.choice.RRCContainer.size ) {
f1ap_ue_context_modification_req->rrc_container = malloc(ieRRC->value.choice.RRCContainer.size);
f1ap_ue_context_modification_req->rrc_container_length = ieRRC->value.choice.RRCContainer.size;
memcpy(f1ap_ue_context_modification_req->rrc_container,
ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size);
f1ap_ue_context_modification_req->rrc_container_length = ieRRC->value.choice.RRCContainer.size;
......@@ -1066,6 +1067,19 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t
}
}
/* TransmissionActionIndicator */
F1AP_UEContextModificationRequestIEs_t *ieTxInd;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextModificationRequestIEs_t,
ieTxInd,
container,
F1AP_ProtocolIE_ID_id_TransmissionActionIndicator,
false);
if (ieTxInd) {
f1ap_ue_context_modification_req->transmission_action_indicator = calloc(1, sizeof(uint8_t));
*f1ap_ue_context_modification_req->transmission_action_indicator = ieTxInd->value.choice.TransmissionActionIndicator;
}
ue_context_modification_request(f1ap_ue_context_modification_req);
return 0;
}
......
......@@ -26,6 +26,7 @@
#include "openair2/F1AP/f1ap_common.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "F1AP_CauseRadioNetwork.h"
#include "NR_HandoverCommand.h"
#include "openair3/ocp-gtpu/gtp_itf.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
......@@ -544,8 +545,32 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req)
if (req->rrc_container != NULL) {
logical_chan_id_t id = 1;
NR_HandoverCommand_t *ho_command = NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL,
&asn_DEF_NR_HandoverCommand,
(void **)&ho_command,
req->rrc_container,
req->rrc_container_length,
0,
0);
if (dec_rval.code == RC_OK && ho_command->criticalExtensions.present == NR_HandoverCommand__criticalExtensions_PR_c1
&& ho_command->criticalExtensions.choice.c1->present == NR_HandoverCommand__criticalExtensions__c1_PR_handoverCommand) {
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_HandoverCommand, ho_command);
}
OCTET_STRING_t *handoverCommandMessage =
&ho_command->criticalExtensions.choice.c1->choice.handoverCommand->handoverCommandMessage;
// handoverCommandMessage->buf contains the RRCReconfiguration
nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, id, handoverCommandMessage->buf, handoverCommandMessage->size);
nr_mac_enable_ue_rrc_processing_timer(mac, UE, UE->apply_cellgroup);
} else {
nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, id, req->rrc_container, req->rrc_container_length);
}
}
if (req->ReconfigComplOutcome != RRCreconf_info_not_present && req->ReconfigComplOutcome != RRCreconf_success) {
LOG_E(NR_MAC,
......
......@@ -80,6 +80,7 @@
#include "NR_PCCH-Message.h"
#include "NR_PagingRecord.h"
#include "NR_UE-CapabilityRequestFilterNR.h"
#include "NR_HandoverCommand.h"
#include "common/utils/nr/nr_common.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
......@@ -1372,3 +1373,25 @@ int do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi)
return((enc_rval.encoded+7)/8);
}
int16_t do_NR_HandoverCommand(uint8_t *ho_buf, int16_t ho_size, uint8_t *rrc_buffer, int16_t rrc_size)
{
NR_HandoverCommand_t *ho_command = calloc(1, sizeof(NR_HandoverCommand_t));
ho_command->criticalExtensions.present = NR_HandoverCommand__criticalExtensions_PR_c1;
ho_command->criticalExtensions.choice.c1 = calloc(1, sizeof(struct NR_HandoverCommand__criticalExtensions__c1));
ho_command->criticalExtensions.choice.c1->present = NR_HandoverCommand__criticalExtensions__c1_PR_handoverCommand;
ho_command->criticalExtensions.choice.c1->choice.handoverCommand = calloc(1, sizeof(struct NR_HandoverCommand_IEs));
AssertFatal(OCTET_STRING_fromBuf(&ho_command->criticalExtensions.choice.c1->choice.handoverCommand->handoverCommandMessage,
(char *)rrc_buffer, rrc_size) != -1, "fatal: OCTET_STRING_fromBuf failed\n");
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_HandoverCommand, ho_command);
}
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_HandoverCommand, NULL, ho_command, ho_buf, ho_size);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
return ((enc_rval.encoded + 7) / 8);
}
......@@ -106,6 +106,8 @@ int do_RRCReconfiguration(const gNB_RRC_UE_t *UE,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
NR_CellGroupConfig_t *cellGroupConfig);
int16_t do_NR_HandoverCommand(uint8_t *ho_buf, int16_t ho_size, uint8_t *rrc_buffer, int16_t rrc_size);
int do_RRCSetupComplete(uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id,
......
......@@ -192,6 +192,15 @@ static void rrc_deliver_dl_rrc_message(void *deliver_pdu_data, ue_id_t ue_id, in
data->rrc->mac_rrc.dl_rrc_message_transfer(data->assoc_id, data->dl_rrc);
}
static void nr_rrc_prepare_protected_rrc_message(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, char *buf, int size, int sdu_id)
{
DevAssert(deliver_pdu_data != NULL);
deliver_dl_rrc_message_data_t *data = (deliver_dl_rrc_message_data_t *)deliver_pdu_data;
data->dl_rrc->rrc_container_length = size;
memcpy(data->dl_rrc->rrc_container, buf, size);
DevAssert(data->dl_rrc->srb_id == srb_id);
}
void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc,
const gNB_RRC_UE_t *ue_p,
uint8_t srb_id,
......@@ -692,7 +701,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
NR_CellGroupConfig_t *cellGroupConfig = ue_p->masterCellGroup;
const nr_rrc_du_container_t *du = get_du_for_ue(rrc, ue_p->rrc_ue_id);
nr_rrc_du_container_t *du = get_du_for_ue(rrc, ue_p->rrc_ue_id);
DevAssert(du != NULL);
f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info;
NR_MeasConfig_t *measconfig = NULL;
......@@ -747,7 +756,43 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
ctxt_pP->module_id,
DCCH);
if (ue_p->StatusRrc == NR_RRC_HO_EXECUTION) {
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_p->rrc_ue_id);
uint8_t rrc_container[RRC_BUF_SIZE] = {0};
f1ap_dl_rrc_message_t dl_rrc = {.gNB_CU_ue_id = ue_p->rrc_ue_id, .gNB_DU_ue_id = ue_data.secondary_ue, .srb_id = DCCH, .rrc_container = rrc_container};
deliver_dl_rrc_message_data_t data = {.rrc = rrc, .dl_rrc = &dl_rrc, .assoc_id = ue_data.du_assoc_id};
nr_pdcp_data_req_srb(ue_p->rrc_ue_id,
DCCH,
rrc_gNB_mui++,
size,
(unsigned char *const)buffer,
nr_rrc_prepare_protected_rrc_message,
&data);
uint8_t ho_buffer[RRC_BUF_SIZE] = {0};
int16_t ho_size = do_NR_HandoverCommand(ho_buffer, RRC_BUF_SIZE, data.dl_rrc->rrc_container, data.dl_rrc->rrc_container_length);
uint8_t transmission_action_indicator = 0;
RETURN_IF_INVALID_ASSOC_ID(ue_data);
f1ap_ue_context_modif_req_t ue_context_modif_req = {
.gNB_CU_ue_id = ue_p->rrc_ue_id,
.gNB_DU_ue_id = ue_data.secondary_ue,
.plmn.mcc = rrc->configuration.mcc[0],
.plmn.mnc = rrc->configuration.mnc[0],
.plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0],
.nr_cellid = rrc->nr_cellid,
.servCellId = 0, // TODO: correct value?
.ReconfigComplOutcome = RRCreconf_success,
.transmission_action_indicator = &transmission_action_indicator,
.rrc_container_length = ho_size,
.rrc_container = ho_buffer,
};
rrc->mac_rrc.ue_context_modification_request(ue_data.du_assoc_id, &ue_context_modif_req);
} else {
nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size);
}
}
//-----------------------------------------------------------------------------
......
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