Commit f6d53094 authored by Raymond Knopp's avatar Raymond Knopp

added DUtoCURRCContainer IE in UL INITIAL RRC MESSAGE TRANSFER

added generation of initial Master Cell Group Configuration for both CU/DU and monolithic gNB.

Tested until transmission of RRCSetupComplete from UE
parent 9dd6e3bb
......@@ -30,6 +30,7 @@
#define MAC_MESSAGES_TYPES_H_
#include <LTE_DRX-Config.h>
#include "OCTET_STRING.h"
//-------------------------------------------------------------------------------------------//
// Defines to access message fields.
......@@ -143,6 +144,7 @@ typedef struct NRRrcMacCcchDataInd_s {
uint16_t rnti;
uint32_t sdu_size;
uint8_t sdu[CCCH_SDU_SIZE];
OCTET_STRING_t *du_to_cu_rrc_container;
uint8_t gnb_index;
int CC_id;
} NRRrcMacCcchDataInd;
......
......@@ -114,7 +114,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* RRC Container */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_RRCContainer, true);
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
// create an ITTI message and copy SDU
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND);
......@@ -136,6 +136,18 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
printf("\n");
/* DUtoCURRCContainer */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, true);
if (ie) {
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t));
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(ie->value.choice.DUtoCURRCContainer.size);
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf,
ie->value.choice.DUtoCURRCContainer.buf,
ie->value.choice.DUtoCURRCContainer.size);
}
// Find instance from nr_cellid
int rrc_inst = -1;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
......
......@@ -798,7 +798,9 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int UE_id,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP) {
sdu_size_t sdu_lenP,
const uint8_t *sdu2P,
sdu_size_t sdu2_lenP) {
F1AP_F1AP_PDU_t pdu;
F1AP_InitialULRRCMessageTransfer_t *out;
F1AP_InitialULRRCMessageTransferIEs_t *ie;
......@@ -868,15 +870,17 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
/* optional */
/* c5. DUtoCURRCContainer */
if (0) {
if (sdu2P) {
ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val",
strlen("dummy_val"));
OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer,
sdu2P,
sdu2_lenP);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
}
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
......
......@@ -49,6 +49,8 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int UE_id,
rnti_t rntiP,
const uint8_t *sduP,
sdu_size_t sdu_lenP);
sdu_size_t sdu_lenP,
const uint8_t *sdu2P,
sdu_size_t sdu2_lenP);
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
......@@ -189,7 +189,10 @@ void *F1AP_DU_task(void *arg) {
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg);
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
msg->rrc_container,
msg->rrc_container_length);
msg->rrc_container_length,
msg->du2cu_rrc_container,
msg->du2cu_rrc_container_length
);
break;
case F1AP_UL_RRC_MESSAGE: // to rrc
......
......@@ -316,7 +316,9 @@ mac_rrc_data_ind(
UE_id,
rntiP,
sduP,
sdu_lenP
sdu_lenP,
NULL,
0
);
return(0);
}
......
......@@ -313,6 +313,25 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) {
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
// Generate DUtoCURRCContainer
// call do_RRCSetup like full procedure and extract masterCellGroup
NR_CellGroupConfig_t cellGroupConfig;
NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon;
uint8_t sdu2[100];
memset(&cellGroupConfig,0,sizeof(cellGroupConfig));
fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)&cellGroupConfig,
sdu2,
100);
int sdu2_len = (enc_rval.encoded+7)/8;
if (enc_rval.encoded == -1) {
LOG_I(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name);
exit(-1);
}
/* do ITTI message */
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_idP,
......@@ -320,7 +339,9 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
UE_id,
rntiP,
sduP,
sdu_lenP
sdu_lenP,
sdu2,
sdu2_len
);
return(0);
}
......@@ -332,7 +353,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
ctxt.brOption = brOption;
if (sdu_lenP > 0) {
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id);
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id);
}
}
......
This diff is collapsed.
......@@ -89,12 +89,19 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
uint8_t do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer);
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
void fill_initial_SpCellConfig(rnti_t rnti,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc);
void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc);
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
NR_SRB_ToAddModList_t **SRB_configList);
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc);
uint8_t do_NR_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
......
......@@ -301,6 +301,7 @@ typedef struct gNB_RRC_UE_s {
int UE_MRDC_Capability_size;
NR_CellGroupConfig_t *secondaryCellGroup;
NR_CellGroupConfig_t *masterCellGroup;
NR_RRCReconfiguration_t *reconfig;
NR_RadioBearerConfig_t *rb_config;
......
......@@ -102,6 +102,14 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
NR_RRCReconfiguration_t *reconfig,
NR_RadioBearerConfig_t *rbconfig);
void
rrc_gNB_generate_RRCSetup(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
const int CC_id);
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
void
......@@ -173,7 +181,8 @@ int8_t nr_mac_rrc_data_ind(
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer,
int buffer_length,
const int CC_id);
OCTET_STRING_t *du_to_cu_rrc_container,
const int CC_id);
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
......
......@@ -381,9 +381,11 @@ rrc_gNB_get_next_transaction_identifier(
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_RRCSetup(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
const int CC_id
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
const int CC_id
)
//-----------------------------------------------------------------------------
{
......@@ -397,13 +399,11 @@ rrc_gNB_generate_RRCSetup(
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
SRB_configList = &ue_p->SRB_configList;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP,
ue_context_pP,
CC_id,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList);
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
masterCellGroup_from_DU,
scc);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload),
......@@ -504,17 +504,17 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
NR_SRB_ToAddModList_t **SRB_configList = NULL;
rrc_gNB_ue_context_t *ue_context_pP = NULL;
gNB_RRC_INST *rrc_instance_p = RC.nrrrc[ctxt_pP->module_id];
NR_ServingCellConfigCommon_t *scc=rrc_instance_p->carrier.servingcellconfigcommon;
ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0);
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
SRB_configList = &ue_p->SRB_configList;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP,
ue_context_pP,
CC_id,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList);
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
NULL,
scc);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload),
......@@ -1475,6 +1475,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer,
int buffer_length,
OCTET_STRING_t *du_to_cu_rrc_container,
const int CC_id)
{
module_id_t Idx;
......@@ -1599,9 +1600,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
LOG_E(RRC, "%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
}
if (ue_context_p != NULL) {
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE;
ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1;
if (ue_context_p != NULL) {
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE;
ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1;
}
}
} else {
......@@ -1624,7 +1625,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
rrc_gNB_generate_RRCSetup(ctxt_pP,
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
CC_id);
du_to_cu_rrc_container,
gnb_rrc_inst->carrier.servingcellconfigcommon,
CC_id);
}
break;
......@@ -2568,9 +2571,14 @@ void *rrc_gnb_task(void *args_p) {
}
nr_rrc_gNB_decode_ccch(&ctxt,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) {
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf);
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container);
}
break;
/* Messages from PDCP */
......
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