Commit ed0fedc1 authored by rmagueta's avatar rmagueta

Merge remote-tracking branch 'origin/NR_SA_F1AP_5GRECORDS' into develop-NR_SA_F1AP_5GRECORDS

# Conflicts:
#	openair1/PHY/NR_TRANSPORT/pucch_rx.c
parents e924caa6 ab0e14ce
...@@ -336,8 +336,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -336,8 +336,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (l==2) uci_stats->current_pucch0_stat1 = dB_fixed64((int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1]); if (l==2) uci_stats->current_pucch0_stat1 = dB_fixed64((int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1]);
} }
} }
//if(nr_sequences>1)
// no_corr=(av_corr-xrtmag)/(nr_sequences-1)/l;
av_corr/=nr_sequences/l; av_corr/=nr_sequences/l;
uint8_t xrtmag_dB = dB_fixed64(xrtmag); uint8_t xrtmag_dB = dB_fixed64(xrtmag);
......
...@@ -103,7 +103,6 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, ...@@ -103,7 +103,6 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) { if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) {
LOG_E(PDCP, "discard NR PDU, integrity failed\n"); LOG_E(PDCP, "discard NR PDU, integrity failed\n");
return;
} }
} }
......
...@@ -657,6 +657,7 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig ...@@ -657,6 +657,7 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig
int t_reassembly; int t_reassembly;
int sn_field_length; int sn_field_length;
LOG_I(RLC,"Trying to add SRB %d\n",srb_id);
if (srb_id != 1 && srb_id != 2) { if (srb_id != 1 && srb_id != 2) {
LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n", LOG_E(RLC, "%s:%d:%s: fatal, bad srb id %d\n",
__FILE__, __LINE__, __FUNCTION__, srb_id); __FILE__, __LINE__, __FUNCTION__, srb_id);
......
...@@ -1081,6 +1081,89 @@ void fill_initial_SpCellConfig(rnti_t rnti, ...@@ -1081,6 +1081,89 @@ void fill_initial_SpCellConfig(rnti_t rnti,
SpCellConfig->spCellConfigDedicated->tag_Id=0; SpCellConfig->spCellConfigDedicated->tag_Id=0;
} }
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig) {
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
NR_RLC_Config_t *rlc_Config = NULL;
NR_LogicalChannelConfig_t *logicalChannelConfig = NULL;
long *logicalChannelGroup = NULL;
cellGroupConfig->cellGroupId = 0;
/* Rlc Bearer Config */
/* TS38.331 9.2.1 Default SRB configurations */
cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
rlc_BearerConfig->logicalChannelIdentity = 2;
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 2;
rlc_BearerConfig->reestablishRLC = NULL;
//if (0) {
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
rlc_Config->present = NR_RLC_Config_PR_am;
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
*(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35;
rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0;
rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
*(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45;
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.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
//}
rlc_BearerConfig->rlc_Config = rlc_Config;
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
/*DRB Configuration*/
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
rlc_BearerConfig->logicalChannelIdentity = 4;
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
rlc_BearerConfig->servedRadioBearer->choice.drb_Identity = 1;
rlc_BearerConfig->reestablishRLC = NULL;
//if (0) {
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
rlc_Config->present = NR_RLC_Config_PR_am;
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
*(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18;
rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms80;
rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms10;
rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
*(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18;
rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms80;
rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64;
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB125;
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t4;
//}
rlc_BearerConfig->rlc_Config = rlc_Config;
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
//if (0) {
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
logicalChannelConfig->ul_SpecificParameters->priority = 3;
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5;
logicalChannelGroup = CALLOC(1, sizeof(long));
*logicalChannelGroup = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = CALLOC(1, sizeof(*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID));
*logicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = 0;
logicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = 0;
//}
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
cellGroupConfig->rlc_BearerToReleaseList = NULL;
}
void fill_initial_cellGroupConfig(rnti_t rnti, void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc) { NR_ServingCellConfigCommon_t *scc) {
...@@ -1503,12 +1586,14 @@ uint16_t do_RRCReconfiguration( ...@@ -1503,12 +1586,14 @@ uint16_t do_RRCReconfiguration(
NR_MeasConfig_t *meas_config, NR_MeasConfig_t *meas_config,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList, *dedicatedNAS_MessageList,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
NR_DL_DCCH_Message_t dl_dcch_msg; NR_DL_DCCH_Message_t dl_dcch_msg;
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
NR_RRCReconfiguration_IEs_t *ie; NR_RRCReconfiguration_IEs_t *ie;
unsigned char masterCellGroup_buf[1000];
memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t)); memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t));
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
...@@ -1551,14 +1636,35 @@ uint16_t do_RRCReconfiguration( ...@@ -1551,14 +1636,35 @@ uint16_t do_RRCReconfiguration(
// lateNonCriticalExtension // lateNonCriticalExtension
ie->lateNonCriticalExtension = NULL; ie->lateNonCriticalExtension = NULL;
// nonCriticalExtension // nonCriticalExtension
if (cellGroupConfig || dedicatedNAS_MessageList)
ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t)); ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t));
if(cellGroupConfig!=NULL){
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)cellGroupConfig,
masterCellGroup_buf,
1000);
if(enc_rval.encoded == -1) {
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig);
ie->nonCriticalExtension->masterCellGroup = calloc(1,sizeof(OCTET_STRING_t));
ie->nonCriticalExtension->masterCellGroup->buf = masterCellGroup_buf;
ie->nonCriticalExtension->masterCellGroup->size = (enc_rval.encoded+7)/8;
}
if (dedicatedNAS_MessageList)
ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList; ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList;
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie; dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
} //}
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
NULL, NULL,
......
...@@ -97,6 +97,8 @@ void fill_initial_cellGroupConfig(rnti_t rnti, ...@@ -97,6 +97,8 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc); NR_ServingCellConfigCommon_t *scc);
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig);
uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, 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,
...@@ -127,7 +129,8 @@ uint16_t do_RRCReconfiguration( ...@@ -127,7 +129,8 @@ uint16_t do_RRCReconfiguration(
NR_MeasConfig_t *meas_config, NR_MeasConfig_t *meas_config,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList, *dedicatedNAS_MessageList,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig); NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig);
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer, uint8_t *buffer,
......
...@@ -809,6 +809,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -809,6 +809,7 @@ rrc_gNB_generate_defaultRRCReconfiguration(
NULL, NULL,
NULL, NULL,
dedicatedNAS_MessageList, dedicatedNAS_MessageList,
NULL,
NULL); NULL);
free(ue_context_pP->ue_context.nas_pdu.buffer); free(ue_context_pP->ue_context.nas_pdu.buffer);
...@@ -909,6 +910,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -909,6 +910,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
NR_QFI_t qfi = 0; NR_QFI_t qfi = 0;
int pdu_sessions_done = 0; int pdu_sessions_done = 0;
int i; int i;
NR_CellGroupConfig_t *cellGroupConfig;
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
...@@ -1046,6 +1048,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -1046,6 +1048,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
} }
memset(buffer, 0, RRC_BUF_SIZE); memset(buffer, 0, RRC_BUF_SIZE);
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig);
size = do_RRCReconfiguration(ctxt_pP, buffer, size = do_RRCReconfiguration(ctxt_pP, buffer,
xid, xid,
*SRB_configList2, *SRB_configList2,
...@@ -1055,7 +1059,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -1055,7 +1059,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
NULL, NULL,
NULL, NULL,
dedicatedNAS_MessageList, dedicatedNAS_MessageList,
NULL); NULL,
cellGroupConfig);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */ /* Free all NAS PDUs */
...@@ -1162,6 +1167,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( ...@@ -1162,6 +1167,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
NULL, NULL,
NULL, NULL,
dedicatedNAS_MessageList, dedicatedNAS_MessageList,
NULL,
NULL); NULL);
ue_context_pP->ue_context.pdu_session_release_command_flag = 1; ue_context_pP->ue_context.pdu_session_release_command_flag = 1;
...@@ -1256,6 +1262,8 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -1256,6 +1262,8 @@ rrc_gNB_process_RRCReconfigurationComplete(
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
#ifndef ITTI_SIM #ifndef ITTI_SIM
LOG_I(NR_RRC,"Configuring PDCP DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
nr_rrc_pdcp_config_asn1_req(ctxt_pP, nr_rrc_pdcp_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, SRB_configList, // NULL,
DRB_configList, DRB_configList,
...@@ -1270,6 +1278,7 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -1270,6 +1278,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList);
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) {
LOG_I(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti);
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_rlc_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, SRB_configList, // NULL,
DRB_configList, DRB_configList,
...@@ -1666,6 +1675,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( ...@@ -1666,6 +1675,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
NULL, NULL,
NULL, // MeasObj_list, NULL, // MeasObj_list,
NULL, NULL,
NULL,
NULL); NULL);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,
"[MSG] RRC Reconfiguration\n"); "[MSG] RRC Reconfiguration\n");
......
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