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 @@ ...@@ -30,6 +30,7 @@
#define MAC_MESSAGES_TYPES_H_ #define MAC_MESSAGES_TYPES_H_
#include <LTE_DRX-Config.h> #include <LTE_DRX-Config.h>
#include "OCTET_STRING.h"
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Defines to access message fields. // Defines to access message fields.
...@@ -143,6 +144,7 @@ typedef struct NRRrcMacCcchDataInd_s { ...@@ -143,6 +144,7 @@ typedef struct NRRrcMacCcchDataInd_s {
uint16_t rnti; uint16_t rnti;
uint32_t sdu_size; uint32_t sdu_size;
uint8_t sdu[CCCH_SDU_SIZE]; uint8_t sdu[CCCH_SDU_SIZE];
OCTET_STRING_t *du_to_cu_rrc_container;
uint8_t gnb_index; uint8_t gnb_index;
int CC_id; int CC_id;
} NRRrcMacCcchDataInd; } NRRrcMacCcchDataInd;
......
...@@ -114,7 +114,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -114,7 +114,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* RRC Container */ /* RRC Container */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_RRCContainer, true); F1AP_ProtocolIE_ID_id_RRCContainer, true);
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
// create an ITTI message and copy SDU // create an ITTI message and copy SDU
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { 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); 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, ...@@ -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("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
printf("\n"); 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 // Find instance from nr_cellid
int rrc_inst = -1; int rrc_inst = -1;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { 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, ...@@ -798,7 +798,9 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int UE_id, int UE_id,
rnti_t rntiP, rnti_t rntiP,
const uint8_t *sduP, 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_F1AP_PDU_t pdu;
F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransfer_t *out;
F1AP_InitialULRRCMessageTransferIEs_t *ie; F1AP_InitialULRRCMessageTransferIEs_t *ie;
...@@ -868,16 +870,18 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -868,16 +870,18 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
/* optional */ /* optional */
/* c5. DUtoCURRCContainer */ /* c5. DUtoCURRCContainer */
if (0) { if (sdu2P) {
ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer;
ie->criticality = F1AP_Criticality_reject; ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, "dummy_val", OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer,
strlen("dummy_val")); sdu2P,
sdu2_lenP);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
} }
/* encode */ /* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 INITIAL UL RRC MESSAGE TRANSFER\n"); LOG_E(F1AP, "Failed to encode F1 INITIAL UL RRC MESSAGE TRANSFER\n");
......
...@@ -49,6 +49,8 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -49,6 +49,8 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int UE_id, int UE_id,
rnti_t rntiP, rnti_t rntiP,
const uint8_t *sduP, 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_ */ #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
...@@ -189,7 +189,10 @@ void *F1AP_DU_task(void *arg) { ...@@ -189,7 +189,10 @@ void *F1AP_DU_task(void *arg) {
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); 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, DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
msg->rrc_container, msg->rrc_container,
msg->rrc_container_length); msg->rrc_container_length,
msg->du2cu_rrc_container,
msg->du2cu_rrc_container_length
);
break; break;
case F1AP_UL_RRC_MESSAGE: // to rrc case F1AP_UL_RRC_MESSAGE: // to rrc
......
...@@ -316,7 +316,9 @@ mac_rrc_data_ind( ...@@ -316,7 +316,9 @@ mac_rrc_data_ind(
UE_id, UE_id,
rntiP, rntiP,
sduP, sduP,
sdu_lenP sdu_lenP,
NULL,
0
); );
return(0); return(0);
} }
......
...@@ -313,6 +313,25 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ...@@ -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)) { 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", 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); 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 */ /* do ITTI message */
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_idP, module_idP,
...@@ -320,7 +339,9 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ...@@ -320,7 +339,9 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
UE_id, UE_id,
rntiP, rntiP,
sduP, sduP,
sdu_lenP sdu_lenP,
sdu2,
sdu2_len
); );
return(0); return(0);
} }
...@@ -332,7 +353,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ...@@ -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); LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
ctxt.brOption = brOption; ctxt.brOption = brOption;
if (sdu_lenP > 0) { 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);
} }
} }
......
...@@ -976,66 +976,82 @@ uint8_t do_RRCReject(uint8_t Mod_id, ...@@ -976,66 +976,82 @@ uint8_t do_RRCReject(uint8_t Mod_id,
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
//------------------------------------------------------------------------------ void fill_initial_SpCellConfig(rnti_t rnti,
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, NR_SpCellConfig_t *SpCellConfig,
rrc_gNB_ue_context_t *const ue_context_pP, NR_ServingCellConfigCommon_t *scc) {
int CC_id,
uint8_t *const buffer, SpCellConfig->servCellIndex = NULL;
const uint8_t transaction_id, SpCellConfig->reconfigurationWithSync = NULL;
NR_SRB_ToAddModList_t **SRB_configList) SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL;
//------------------------------------------------------------------------------ SpCellConfig->rlf_TimersAndConstants = NULL;
{ SpCellConfig->spCellConfigDedicated = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated));
asn_enc_rval_t enc_rval;; SpCellConfig->spCellConfigDedicated->uplinkConfig = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig));
NR_DL_CCCH_Message_t dl_ccch_msg; NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP));
NR_RRCSetup_t *rrcSetup; SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP;
NR_RRCSetup_IEs_t *ie; initialUplinkBWP->pucch_Config = calloc(1,sizeof(*initialUplinkBWP->pucch_Config));
NR_SRB_ToAddMod_t *SRB1_config = NULL; initialUplinkBWP->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup;
NR_PDCP_Config_t *pdcp_Config = NULL; NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config));
NR_CellGroupConfig_t *cellGroupConfig = NULL; initialUplinkBWP->pucch_Config->choice.setup=pucch_Config;
pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList));
pucch_Config->resourceSetToReleaseList = NULL;
NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0));
pucchresset0->pucch_ResourceSetId = 0;
NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0));
*pucchresset0id0=0;
ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0);
pucchresset0->maxPayloadSize=NULL;
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0);
pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList));
pucch_Config->resourceToReleaseList = NULL;
// configure one single PUCCH0 opportunity for initial connection procedure
// one symbol (13)
NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0));
pucchres0->pucch_ResourceId=0;
pucchres0->startingPRB=0;
pucchres0->intraSlotFrequencyHopping=NULL;
pucchres0->secondHopPRB=NULL;
pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0;
pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0));
pucchres0->format.choice.format0->initialCyclicShift=0;
pucchres0->format.choice.format0->nrofSymbols=1;
pucchres0->format.choice.format0->startingSymbolIndex=13;
ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0);
// configure Scheduling request
// 40 slot period
pucch_Config->schedulingRequestResourceToAddModList = calloc(1,sizeof(*pucch_Config->schedulingRequestResourceToAddModList));
NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig = calloc(1,sizeof(*schedulingRequestResourceConfig));
schedulingRequestResourceConfig->schedulingRequestResourceId = 1;
schedulingRequestResourceConfig->schedulingRequestID= 0;
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40;
// note: make sure that there is no issue here. Later choose the RNTI accordingly.
// Here we would be limited to 8 UEs on this resource (2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 8,9,18,19,28,29,38,39).
// This should be a temporary resource until the first RRCReconfiguration gives new pucch resources.
// Check for above configuration and exit for now if it is not the case
AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30,
"SCS != 30kHz\n");
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5,
"TDD period != 5ms : %d\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2);
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
*schedulingRequestResourceConfig->resource = 0;
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
}
void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc) {
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;
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL; NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL;
NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = NULL;
char masterCellGroup_buf[1000];
long *logicalChannelGroup = NULL; long *logicalChannelGroup = NULL;
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
dl_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_CCCH_MessageType__c1));
dl_ccch_msg.message.choice.c1->present = NR_DL_CCCH_MessageType__c1_PR_rrcSetup;
dl_ccch_msg.message.choice.c1->choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_t));
rrcSetup = dl_ccch_msg.message.choice.c1->choice.rrcSetup;
rrcSetup->criticalExtensions.present = NR_RRCSetup__criticalExtensions_PR_rrcSetup;
rrcSetup->rrc_TransactionIdentifier = transaction_id;
rrcSetup->criticalExtensions.choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_IEs_t));
ie = rrcSetup->criticalExtensions.choice.rrcSetup;
/****************************** radioBearerConfig ******************************/
/* Configure SRB1 */
if (*SRB_configList) {
free(*SRB_configList);
}
*SRB_configList = calloc(1, sizeof(NR_SRB_ToAddModList_t));
// SRB1
/* TODO */
SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t));
SRB1_config->srb_Identity = 1;
// pdcp_Config->t_Reordering
SRB1_config->pdcp_Config = pdcp_Config;
ie->radioBearerConfig.srb_ToAddModList = *SRB_configList;
ASN_SEQUENCE_ADD(&(*SRB_configList)->list, SRB1_config);
ie->radioBearerConfig.srb3_ToRelease = NULL;
ie->radioBearerConfig.drb_ToAddModList = NULL;
ie->radioBearerConfig.drb_ToReleaseList = NULL;
ie->radioBearerConfig.securityConfig = NULL;
/****************************** masterCellGroup ******************************/
/* TODO */
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
cellGroupConfig->cellGroupId = 0; cellGroupConfig->cellGroupId = 0;
/* Rlc Bearer Config */ /* Rlc Bearer Config */
...@@ -1047,6 +1063,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1047,6 +1063,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity; rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1; rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1;
rlc_BearerConfig->reestablishRLC = NULL; rlc_BearerConfig->reestablishRLC = NULL;
if (0) {
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t)); rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
rlc_Config->present = NR_RLC_Config_PR_am; rlc_Config->present = NR_RLC_Config_PR_am;
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am)); rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
...@@ -1060,7 +1077,11 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1060,7 +1077,11 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity; rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity;
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity; rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
}
rlc_BearerConfig->rlc_Config = rlc_Config; rlc_BearerConfig->rlc_Config = rlc_Config;
if (0) {
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t)); logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters)); logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
logicalChannelConfig->ul_SpecificParameters->priority = 1; logicalChannelConfig->ul_SpecificParameters->priority = 1;
...@@ -1068,14 +1089,15 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1068,14 +1089,15 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
logicalChannelGroup = CALLOC(1, sizeof(long)); logicalChannelGroup = CALLOC(1, sizeof(long));
*logicalChannelGroup = 0; *logicalChannelGroup = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup; logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
}
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);
cellGroupConfig->rlc_BearerToReleaseList = NULL; cellGroupConfig->rlc_BearerToReleaseList = NULL;
cellGroupConfig->sCellToAddModList = NULL;
cellGroupConfig->sCellToReleaseList = NULL;
/* mac CellGroup Config */ /* mac CellGroup Config */
if (0) {
mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t)); mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t));
mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config)); mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config));
mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
...@@ -1086,9 +1108,94 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1086,9 +1108,94 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10; mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10;
mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10; mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10;
mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1;
}
cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig; cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig;
// cellGroupConfig.physicalCellGroupConfig; cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig;
cellGroupConfig->spCellConfig = malloc(sizeof(*cellGroupConfig->spCellConfig));
fill_initial_SpCellConfig(rnti,cellGroupConfig->spCellConfig,scc);
cellGroupConfig->sCellToAddModList = NULL;
cellGroupConfig->sCellToReleaseList = NULL;
}
//------------------------------------------------------------------------------
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t *const buffer,
const uint8_t transaction_id,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
NR_DL_CCCH_Message_t dl_ccch_msg;
NR_RRCSetup_t *rrcSetup;
NR_RRCSetup_IEs_t *ie;
NR_SRB_ToAddMod_t *SRB1_config = NULL;
NR_PDCP_Config_t *pdcp_Config = NULL;
NR_CellGroupConfig_t *cellGroupConfig = NULL;
char masterCellGroup_buf[1000];
AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n");
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
NR_SRB_ToAddModList_t **SRB_configList = &ue_p->SRB_configList;
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
dl_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_CCCH_MessageType__c1));
dl_ccch_msg.message.choice.c1->present = NR_DL_CCCH_MessageType__c1_PR_rrcSetup;
dl_ccch_msg.message.choice.c1->choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_t));
rrcSetup = dl_ccch_msg.message.choice.c1->choice.rrcSetup;
rrcSetup->criticalExtensions.present = NR_RRCSetup__criticalExtensions_PR_rrcSetup;
rrcSetup->rrc_TransactionIdentifier = transaction_id;
rrcSetup->criticalExtensions.choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_IEs_t));
ie = rrcSetup->criticalExtensions.choice.rrcSetup;
/****************************** radioBearerConfig ******************************/
/* Configure SRB1 */
if (*SRB_configList) {
free(*SRB_configList);
}
*SRB_configList = calloc(1, sizeof(NR_SRB_ToAddModList_t));
// SRB1
/* TODO */
SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t));
SRB1_config->srb_Identity = 1;
// pdcp_Config->t_Reordering
SRB1_config->pdcp_Config = pdcp_Config;
ie->radioBearerConfig.srb_ToAddModList = *SRB_configList;
ASN_SEQUENCE_ADD(&(*SRB_configList)->list, SRB1_config);
ie->radioBearerConfig.srb3_ToRelease = NULL;
ie->radioBearerConfig.drb_ToAddModList = NULL;
ie->radioBearerConfig.drb_ToReleaseList = NULL;
ie->radioBearerConfig.securityConfig = NULL;
/****************************** masterCellGroup ******************************/
/* TODO */
if (masterCellGroup_from_DU) {
memcpy(&ie->masterCellGroup,masterCellGroup_from_DU,sizeof(*masterCellGroup_from_DU));
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
(void **)&cellGroupConfig,
(uint8_t *)masterCellGroup_from_DU->buf,
masterCellGroup_from_DU->size, 0, 0);
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig);
}
else {
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc);
ue_p->masterCellGroup = cellGroupConfig;
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL, NULL,
...@@ -1106,11 +1213,11 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1106,11 +1213,11 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n"); LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n");
return -1; return -1;
} }
}
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
} }
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message,
NULL, NULL,
(void *)&dl_ccch_msg, (void *)&dl_ccch_msg,
...@@ -1126,6 +1233,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1126,6 +1233,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n", LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8); enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
uint8_t do_NR_SecurityModeCommand( uint8_t do_NR_SecurityModeCommand(
......
...@@ -89,12 +89,19 @@ void do_SpCellConfig(gNB_RRC_INST *rrc, ...@@ -89,12 +89,19 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
uint8_t do_RRCReject(uint8_t Mod_id, uint8_t do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer); uint8_t *const buffer);
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, void fill_initial_SpCellConfig(rnti_t rnti,
rrc_gNB_ue_context_t *const ue_context_pP, NR_SpCellConfig_t *SpCellConfig,
int CC_id, 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, uint8_t *const buffer,
const uint8_t transaction_id, 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( uint8_t do_NR_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer, uint8_t *const buffer,
......
...@@ -301,6 +301,7 @@ typedef struct gNB_RRC_UE_s { ...@@ -301,6 +301,7 @@ typedef struct gNB_RRC_UE_s {
int UE_MRDC_Capability_size; int UE_MRDC_Capability_size;
NR_CellGroupConfig_t *secondaryCellGroup; NR_CellGroupConfig_t *secondaryCellGroup;
NR_CellGroupConfig_t *masterCellGroup;
NR_RRCReconfiguration_t *reconfig; NR_RRCReconfiguration_t *reconfig;
NR_RadioBearerConfig_t *rb_config; NR_RadioBearerConfig_t *rb_config;
......
...@@ -102,6 +102,14 @@ int generate_CG_Config(gNB_RRC_INST *rrc, ...@@ -102,6 +102,14 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
NR_RRCReconfiguration_t *reconfig, NR_RRCReconfiguration_t *reconfig,
NR_RadioBearerConfig_t *rbconfig); 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); int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
void void
...@@ -173,6 +181,7 @@ int8_t nr_mac_rrc_data_ind( ...@@ -173,6 +181,7 @@ int8_t nr_mac_rrc_data_ind(
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer, const uint8_t *buffer,
int buffer_length, int buffer_length,
OCTET_STRING_t *du_to_cu_rrc_container,
const int CC_id); const int CC_id);
void void
......
...@@ -383,6 +383,8 @@ void ...@@ -383,6 +383,8 @@ void
rrc_gNB_generate_RRCSetup( rrc_gNB_generate_RRCSetup(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP, rrc_gNB_ue_context_t *const ue_context_pP,
OCTET_STRING_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
const int CC_id const int CC_id
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -397,13 +399,11 @@ rrc_gNB_generate_RRCSetup( ...@@ -397,13 +399,11 @@ rrc_gNB_generate_RRCSetup(
// T_INT(ctxt_pP->subframe), // T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti)); // T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; 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(ue_context_pP,
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP,
ue_context_pP,
CC_id,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList); masterCellGroup_from_DU,
scc);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)(ue_p->Srb0.Tx_buffer.Payload),
...@@ -504,17 +504,17 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ...@@ -504,17 +504,17 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
NR_SRB_ToAddModList_t **SRB_configList = NULL; NR_SRB_ToAddModList_t **SRB_configList = NULL;
rrc_gNB_ue_context_t *ue_context_pP = NULL; rrc_gNB_ue_context_t *ue_context_pP = NULL;
gNB_RRC_INST *rrc_instance_p = RC.nrrrc[ctxt_pP->module_id]; 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); 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; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
SRB_configList = &ue_p->SRB_configList; SRB_configList = &ue_p->SRB_configList;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP, ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP,
ue_context_pP,
CC_id,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList); NULL,
scc);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)(ue_p->Srb0.Tx_buffer.Payload),
...@@ -1475,6 +1475,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( ...@@ -1475,6 +1475,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer, const uint8_t *buffer,
int buffer_length, int buffer_length,
OCTET_STRING_t *du_to_cu_rrc_container,
const int CC_id) const int CC_id)
{ {
module_id_t Idx; module_id_t Idx;
...@@ -1624,6 +1625,8 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ...@@ -1624,6 +1625,8 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
rrc_gNB_generate_RRCSetup(ctxt_pP, rrc_gNB_generate_RRCSetup(ctxt_pP,
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
du_to_cu_rrc_container,
gnb_rrc_inst->carrier.servingcellconfigcommon,
CC_id); CC_id);
} }
break; break;
...@@ -2570,7 +2573,12 @@ void *rrc_gnb_task(void *args_p) { ...@@ -2570,7 +2573,12 @@ void *rrc_gnb_task(void *args_p) {
nr_rrc_gNB_decode_ccch(&ctxt, nr_rrc_gNB_decode_ccch(&ctxt,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, (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).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); 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; break;
/* Messages from PDCP */ /* 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