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

Conflicts:
	cmake_targets/phy_simulators
	openair1/PHY/CODING/crc_byte.c
	openair2/GNB_APP/gnb_paramdef.h
	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
	openair2/RRC/NR/rrc_gNB.c
This commit is contained in:
Raymond Knopp
2022-02-13 09:55:01 +01:00
607 changed files with 31638 additions and 20847 deletions
@@ -1,247 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file l2_interface.c
* \brief layer 2 interface
* \author Navid Nikaein and Raymond Knopp
* \date 2011
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "platform_types.h"
#include "openair_defs.h"
#ifdef CELLULAR
#include "rrc_L2_proto.h"
#else
#include "RRC/LTE/defs.h"
#endif //CELLULAR
#include "COMMON/mac_rrc_primitives.h"
#include "openair_rrc_L2_interface.h"
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_req(
const module_id_t module_idP,
const int CC_idP,
const frame_t frameP,
const rb_id_t srb_idP,
const uint8_t nb_tbP,
uint8_t* const buffer_pP,
const eNB_flag_t eNB_flagP,
const uint8_t eNB_indexP,
const uint8_t mbsfn_sync_areaP
)
//------------------------------------------------------------------------------
{
return(mac_rrc_lite_data_req(
module_idP,
CC_idP,
frameP,
srb_idP,
nb_tbP,
buffer_pP,
eNB_flagP,
eNB_indexP,
mbsfn_sync_areaP)
);
}
//------------------------------------------------------------------------------
/*int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const eNB_flag_t eNB_flagP,
const mac_enb_index_t eNB_indexP,
const uint8_t mbsfn_sync_area
)
//------------------------------------------------------------------------------
{
return(mac_rrc_lite_data_ind(
module_idP,
CC_idP,
frameP,subframeP,
rntiP,
srb_idP,
sduP,
sdu_lenP,
eNB_flagP,
eNB_indexP,
mbsfn_sync_area)
);
}*/
//------------------------------------------------------------------------------
void
rlcrrc_data_ind(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t srb_idP,
const sdu_size_t sdu_lenP,
const uint8_t * const buffer_pP
)
//------------------------------------------------------------------------------
{
rrc_data_ind(ctxt_pP,
srb_idP,
sdu_lenP,
buffer_pP);
}
//------------------------------------------------------------------------------
uint8_t
pdcp_rrc_data_req(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP,
uint8_t* const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP
)
//------------------------------------------------------------------------------
{
return rrc_lite_data_req (
ctxt_pP,
rb_idP,
muiP,
confirmP,
sdu_buffer_sizeP,
sdu_buffer_pP,
modeP);
}
//------------------------------------------------------------------------------
void
pdcp_rrc_data_ind(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t srb_idP,
const sdu_size_t sdu_sizeP,
uint8_t * const buffer_pP
)
//------------------------------------------------------------------------------
{
rrc_lite_data_ind(
ctxt_pP,
srb_idP,
sdu_sizeP,
buffer_pP);
}
//------------------------------------------------------------------------------
void
mac_rrc_meas_ind(
const module_id_t module_idP,
MAC_MEAS_REQ_ENTRY * const Meas_entry_pP
)
//------------------------------------------------------------------------------
{
// mac_rrc_meas_ind(module_idP,Meas_entry_pP);
}
//------------------------------------------------------------------------------
void
mac_sync_ind(
const module_id_t module_idP,
const uint8_t Status
)
//------------------------------------------------------------------------------
{
mac_lite_sync_ind(module_idP,Status);
}
//------------------------------------------------------------------------------
void
mac_in_sync_ind(
const module_id_t module_idP,
const frame_t frameP,
const uint16_t eNB_indexP
)
//------------------------------------------------------------------------------
{
rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP);
}
//------------------------------------------------------------------------------
void
mac_out_of_sync_ind(
const module_id_t module_idP,
const frame_t frameP,
const uint16_t eNB_indexP
)
//------------------------------------------------------------------------------
{
rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP);
}
//------------------------------------------------------------------------------
int
mac_eNB_get_rrc_status(
const module_id_t module_idP,
const rnti_t rntiP
)
//------------------------------------------------------------------------------
{
return mac_eNB_get_rrc_lite_status(module_idP, rntiP);
}
//------------------------------------------------------------------------------
int
mac_UE_get_rrc_status(
const module_id_t module_idP,
const uint8_t sig_indexP
)
//------------------------------------------------------------------------------
{
return mac_UE_get_rrc_lite_status(module_idP, sig_indexP);
}
//------------------------------------------------------------------------------
char
openair_rrc_ue_init(
const module_id_t module_idP,
const unsigned char eNB_indexP
)
//------------------------------------------------------------------------------
{
return openair_rrc_lite_ue_init(module_idP, eNB_indexP);
}
//------------------------------------------------------------------------------
char
openair_rrc_eNB_init(
const module_id_t module_idP
)
//------------------------------------------------------------------------------
{
return openair_rrc_lite_eNB_init(module_idP);
}
+6
View File
@@ -317,6 +317,12 @@ mac_rrc_data_ind(
sdu_lenP,
NULL,
0);
struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p);
return(0);
}
+320 -62
View File
@@ -2129,7 +2129,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
return((enc_rval.encoded+7)/8);
}
uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv) {
asn_enc_rval_t enc_rval;
uint8_t buf[5],buf2=0;
LTE_UL_CCCH_Message_t ul_ccch_msg;
@@ -2178,7 +2178,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
NULL,
(void *)&ul_ccch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
@@ -2378,12 +2378,39 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin
return((enc_rval.encoded+7)/8);
}
static void assign_scg_ConfigResponseNR_r15(LTE_RRCConnectionReconfigurationComplete_t *rrc, OCTET_STRING_t *str)
{
LTE_RRCConnectionReconfigurationComplete_r8_IEs_t *rrc_r8 = &rrc->criticalExtensions.choice.
rrcConnectionReconfigurationComplete_r8;
typeof(rrc_r8->nonCriticalExtension) nce1;
rrc_r8->nonCriticalExtension = nce1 = CALLOC(1, sizeof(*nce1));
typeof(nce1->nonCriticalExtension) nce2;
nce1->nonCriticalExtension = nce2 = CALLOC(1, sizeof(*nce2));
typeof(nce2->nonCriticalExtension) nce3;
nce2->nonCriticalExtension = nce3 = CALLOC(1, sizeof(*nce3));
typeof(nce3->nonCriticalExtension) nce4;
nce3->nonCriticalExtension = nce4 = CALLOC(1, sizeof(*nce4));
typeof(nce4->nonCriticalExtension) nce5;
nce4->nonCriticalExtension = nce5 = CALLOC(1, sizeof(*nce5));
typeof(nce5->nonCriticalExtension) nce6;
nce5->nonCriticalExtension = nce6 = CALLOC(1, sizeof(*nce6));
nce6->scg_ConfigResponseNR_r15 = str;
}
//------------------------------------------------------------------------------
uint8_t
size_t
do_RRCConnectionReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
const uint8_t Transaction_id
size_t buffer_size,
const uint8_t Transaction_id,
OCTET_STRING_t *str
)
//------------------------------------------------------------------------------
{
@@ -2397,7 +2424,13 @@ do_RRCConnectionReconfigurationComplete(
rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id;
rrcConnectionReconfigurationComplete->criticalExtensions.present =
LTE_RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8;
rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL;
if (str != NULL) {
assign_scg_ConfigResponseNR_r15(rrcConnectionReconfigurationComplete, str);
LOG_D(RRC, "Successfully assigned scg_ConfigResponseNR_r15\n");
}
else {
rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL;
}
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
@@ -2407,7 +2440,7 @@ do_RRCConnectionReconfigurationComplete(
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
@@ -3142,6 +3175,7 @@ uint8_t do_RRCConnectionSetup_BR(
uint8_t do_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
const uint8_t cipheringAlgorithm,
const uint8_t integrityProtAlgorithm
@@ -3171,7 +3205,7 @@ uint8_t do_SecurityModeCommand(
NULL,
(void *)&dl_dcch_msg,
buffer,
100);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -3200,6 +3234,7 @@ uint8_t do_SecurityModeCommand(
//------------------------------------------------------------------------------
uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
int16_t eutra_band,
uint32_t nr_band)
@@ -3220,58 +3255,56 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0;
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
&rat);
/* request NR configuration */
LTE_UECapabilityEnquiry_r8_IEs_t *r8 = &dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8;
LTE_UECapabilityEnquiry_v8a0_IEs_t r8_a0;
LTE_UECapabilityEnquiry_v1180_IEs_t r11_80;
LTE_UECapabilityEnquiry_v1310_IEs_t r13_10;
LTE_UECapabilityEnquiry_v1430_IEs_t r14_30;
LTE_UECapabilityEnquiry_v1510_IEs_t r15_10;
OCTET_STRING_t req_freq;
if (nr_band>0) {
memset(&r8_a0, 0, sizeof(r8_a0));
memset(&r11_80, 0, sizeof(r11_80));
memset(&r13_10, 0, sizeof(r13_10));
memset(&r14_30, 0, sizeof(r14_30));
memset(&r15_10, 0, sizeof(r15_10));
/* request NR configuration */
r8->nonCriticalExtension = &r8_a0;
r8_a0.nonCriticalExtension = &r11_80;
r11_80.nonCriticalExtension = &r13_10;
r13_10.nonCriticalExtension = &r14_30;
r14_30.nonCriticalExtension = &r15_10;
memset(&r8_a0, 0, sizeof(r8_a0));
memset(&r11_80, 0, sizeof(r11_80));
memset(&r13_10, 0, sizeof(r13_10));
memset(&r14_30, 0, sizeof(r14_30));
memset(&r15_10, 0, sizeof(r15_10));
/* TODO: no hardcoded values here */
r8->nonCriticalExtension = &r8_a0;
r8_a0.nonCriticalExtension = &r11_80;
r11_80.nonCriticalExtension = &r13_10;
r13_10.nonCriticalExtension = &r14_30;
r14_30.nonCriticalExtension = &r15_10;
nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
/* TODO: no hardcoded values here */
nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA;
nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t));
nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band;
ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA;
nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t));
nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band;
ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR;
nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t));
//if(nr_band > 0)
nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t));
nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR;
nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t));
if(nr_band > 0)
nsa_band->choice.bandInformationNR->bandNR = nr_band;
//else
// nsa_band->choice.bandInformationNR->bandNR = 78;
ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
else
nsa_band->choice.bandInformationNR->bandNR = 78;
ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band);
OCTET_STRING_t req_freq;
//unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 }; // bands 7 & nr78
unsigned char req_freq_buf[1024];
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList,
NULL,
(void *)nsa_band_list,
req_freq_buf,
1024);
unsigned char req_freq_buf[1024];
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList,
NULL,
(void *)nsa_band_list,
req_freq_buf,
1024);
xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list);
xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list);
@@ -3282,22 +3315,20 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
//0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a
// };
req_freq.buf = req_freq_buf;
req_freq.size = (enc_rval.encoded+7)/8;
req_freq.buf = req_freq_buf;
req_freq.size = (enc_rval.encoded+7)/8;
// req_freq.size = 21;
r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
// Add request for eutra-nr
}
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg);
// }
}
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message,
NULL,
(void *)&dl_dcch_msg,
buffer,
100);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -3324,6 +3355,7 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
//------------------------------------------------------------------------------
uint8_t do_NR_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
int16_t eutra_band,
uint32_t nr_band)
@@ -3417,7 +3449,7 @@ uint8_t do_NR_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
NULL,
(void *)&dl_dcch_msg,
buffer,
100);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -3444,6 +3476,7 @@ uint8_t do_NR_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint16_t do_RRCConnectionReconfiguration_BR(const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
@@ -3545,7 +3578,7 @@ uint16_t do_RRCConnectionReconfiguration_BR(const protocol_ctxt_t *const
NULL,
(void *)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed %s, %lu!\n",
enc_rval.failed_type->name, enc_rval.encoded);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
@@ -3562,6 +3595,7 @@ uint16_t do_RRCConnectionReconfiguration_BR(const protocol_ctxt_t *const
*/
uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
@@ -3722,7 +3756,7 @@ uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
NULL,
(void *)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -3977,6 +4011,7 @@ uint8_t do_RRCConnectionReject(uint8_t Mod_id,
uint8_t do_RRCConnectionRelease(uint8_t Mod_id,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id) {
asn_enc_rval_t enc_rval;
LTE_DL_DCCH_Message_t dl_dcch_msg;
@@ -3998,7 +4033,7 @@ uint8_t do_RRCConnectionRelease(uint8_t Mod_id,
NULL,
(void *)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
buffer_size);
return((enc_rval.encoded+7)/8);
}
@@ -4008,6 +4043,7 @@ uint8_t TMGI[5] = {4,3,2,1,0};//TMGI is a string of octet, ref. TS 24.008 fig. 1
uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
uint8_t sync_area,
uint8_t *buffer,
size_t buffer_size,
LTE_MCCH_Message_t *mcch_message,
LTE_MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration) {
asn_enc_rval_t enc_rval;
@@ -4114,7 +4150,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
NULL,
(void *)mcch_message,
buffer,
100);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -4133,7 +4169,9 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
}
uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) {
uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
int measid, int phy_id, long rsrp_s, long rsrq_s,
long rsrp_t, long rsrq_t) {
asn_enc_rval_t enc_rval;
LTE_UL_DCCH_Message_t ul_dcch_msg;
LTE_MeasurementReport_t *measurementReport;
@@ -4205,7 +4243,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -4220,6 +4258,64 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
return((enc_rval.encoded+7)/8);
}
#define asn1cCallocOne(VaR, VaLue) \
VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue;
#define asn1cCalloc(VaR, lOcPtr) \
typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR));
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \
TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \
ASN_SEQUENCE_ADD(&VaR,lOcPtr);
ssize_t do_nrMeasurementReport(uint8_t *buffer,
size_t bufsize,
LTE_MeasId_t measid,
LTE_PhysCellIdNR_r15_t phy_id,
long rsrp_s,
long rsrq_s,
long rsrp_tar,
long rsrq_tar) {
LTE_UL_DCCH_Message_t ul_dcch_msg={0};
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_measurementReport;
LTE_MeasurementReport_t *measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport;
measurementReport->criticalExtensions.present = LTE_MeasurementReport__criticalExtensions_PR_c1;
measurementReport->criticalExtensions.choice.c1.present = LTE_MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension =
calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension));
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId = measid;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult = rsrp_s;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult = rsrq_s;
asn1cCalloc(measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells,
measResultNeighCells);
measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15;
LTE_MeasResultListEUTRA_t *measResultListEUTRA2=&measResultNeighCells->choice.measResultListEUTRA;
asn1cSequenceAdd(measResultListEUTRA2->list, struct LTE_MeasResultEUTRA, measresulteutra_list);
measresulteutra_list->physCellId = phy_id;
//asn1cCalloc(measresulteutra_list->cgi_Info, measresult_cgi2);
//measresult_cgi2->cellGlobalId= {0};
//measresult_cgi2->trackingAreaCode= {0};
struct LTE_MeasResultEUTRA__measResult* measResult= &measresulteutra_list->measResult;
asn1cCallocOne(measResult->rsrpResult, rsrp_tar);
asn1cCallocOne(measResult->rsrqResult, rsrq_tar);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message,
NULL,
&ul_dcch_msg,
buffer,
bufsize);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal] ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
SEQUENCE_free(&asn_DEF_LTE_UL_DCCH_Message, &ul_dcch_msg, ASFM_FREE_UNDERLYING_AND_RESET);
return -1;
}
return((enc_rval.encoded+7)/8);
}
uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) {
ssize_t encoded;
LTE_DL_DCCH_Message_t dl_dcch_msg;
@@ -4237,7 +4333,8 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans
return encoded;
}
uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain) {
uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain) {
LOG_D(RRC, "[eNB %d] do_Paging start\n", Mod_id);
asn_enc_rval_t enc_rval;
LTE_PCCH_Message_t pcch_msg;
@@ -4289,7 +4386,8 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin
ASN_SEQUENCE_ADD(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list, paging_record_p);
LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n",
Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count);
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_PCCH_Message, NULL, (void *)&pcch_msg, buffer, RRC_BUF_SIZE);
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_PCCH_Message, NULL, (void *)&pcch_msg,
buffer, buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -4378,7 +4476,161 @@ int do_HandoverCommand(char *ho_buf, int ho_size, char *rrc_buf, int rrc_size) {
return((enc_rval.encoded+7)/8);
}
OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
//-----------------------------------------------------------------------------
int
is_en_dc_supported(
LTE_UE_EUTRA_Capability_t *c
)
//-----------------------------------------------------------------------------
{
LOG_D(RRC, "Entered %s \n", __FUNCTION__);
/* to be refined - check that the bands supported by the UE include
* the band of the gNB
*/
#define NCE nonCriticalExtension
return c != NULL
&& c->NCE != NULL
&& c->NCE->NCE != NULL
&& c->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL
&& *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 ==
LTE_IRAT_ParametersNR_r15__en_DC_r15_supported;
#undef NCE
}
void allocate_en_DC_r15(LTE_UE_EUTRA_Capability_t *cap)
{
LOG_D(RRC, "Entered %s\n", __FUNCTION__);
if (!cap->nonCriticalExtension)
cap->nonCriticalExtension = CALLOC(1, sizeof(*cap->nonCriticalExtension));
typeof(cap->nonCriticalExtension) nce1 = cap->nonCriticalExtension;
if (!nce1->nonCriticalExtension)
nce1->nonCriticalExtension = CALLOC(1, sizeof(*nce1->nonCriticalExtension));
typeof(nce1->nonCriticalExtension) nce2 = nce1->nonCriticalExtension;
if (!nce2->nonCriticalExtension)
nce2->nonCriticalExtension = CALLOC(1, sizeof(*nce2->nonCriticalExtension));
typeof(nce2->nonCriticalExtension) nce3 = nce2->nonCriticalExtension;
if (!nce3->nonCriticalExtension)
nce3->nonCriticalExtension = CALLOC(1, sizeof(*nce3->nonCriticalExtension));
typeof(nce3->nonCriticalExtension) nce4 = nce3->nonCriticalExtension;
if (!nce4->nonCriticalExtension)
nce4->nonCriticalExtension = CALLOC(1, sizeof(*nce4->nonCriticalExtension));
typeof(nce4->nonCriticalExtension) nce5 = nce4->nonCriticalExtension;
if (!nce5->nonCriticalExtension)
nce5->nonCriticalExtension = CALLOC(1, sizeof(*nce5->nonCriticalExtension));
typeof(nce5->nonCriticalExtension) nce6 = nce5->nonCriticalExtension;
if (!nce6->nonCriticalExtension)
nce6->nonCriticalExtension = CALLOC(1, sizeof(*nce6->nonCriticalExtension));
typeof(nce6->nonCriticalExtension) nce7 = nce6->nonCriticalExtension;
if (!nce7->nonCriticalExtension)
nce7->nonCriticalExtension = CALLOC(1, sizeof(*nce7->nonCriticalExtension));
typeof(nce7->nonCriticalExtension) nce8 = nce7->nonCriticalExtension;
if (!nce8->nonCriticalExtension)
nce8->nonCriticalExtension = CALLOC(1, sizeof(*nce8->nonCriticalExtension));
typeof(nce8->nonCriticalExtension) nce9 = nce8->nonCriticalExtension;
if (!nce9->nonCriticalExtension)
nce9->nonCriticalExtension = CALLOC(1, sizeof(*nce9->nonCriticalExtension));
typeof(nce9->nonCriticalExtension) nce10 = nce9->nonCriticalExtension;
if (!nce10->nonCriticalExtension)
nce10->nonCriticalExtension = CALLOC(1, sizeof(*nce10->nonCriticalExtension));
typeof(nce10->nonCriticalExtension) nce11 = nce10->nonCriticalExtension;
if (!nce11->nonCriticalExtension)
nce11->nonCriticalExtension = CALLOC(1, sizeof(*nce11->nonCriticalExtension));
typeof(nce11->nonCriticalExtension) nce12 = nce11->nonCriticalExtension;
if (!nce12->nonCriticalExtension)
nce12->nonCriticalExtension = CALLOC(1, sizeof(*nce12->nonCriticalExtension));
typeof(nce12->nonCriticalExtension) nce13 = nce12->nonCriticalExtension;
if (!nce13->nonCriticalExtension)
nce13->nonCriticalExtension = CALLOC(1, sizeof(*nce13->nonCriticalExtension));
typeof(nce13->nonCriticalExtension) nce14 = nce13->nonCriticalExtension;
if (!nce14->nonCriticalExtension)
nce14->nonCriticalExtension = CALLOC(1, sizeof(*nce14->nonCriticalExtension));
typeof(nce14->nonCriticalExtension) nce15 = nce14->nonCriticalExtension;
if (!nce15->nonCriticalExtension)
nce15->nonCriticalExtension = CALLOC(1, sizeof(*nce15->nonCriticalExtension));
typeof(nce15->nonCriticalExtension) nce16 = nce15->nonCriticalExtension;
if (!nce16->nonCriticalExtension)
nce16->nonCriticalExtension = CALLOC(1, sizeof(*nce16->nonCriticalExtension));
typeof(nce16->nonCriticalExtension) nce17 = nce16->nonCriticalExtension;
if (!nce17->nonCriticalExtension)
nce17->nonCriticalExtension = CALLOC(1, sizeof(*nce17->nonCriticalExtension));
typeof(nce17->nonCriticalExtension) nce18 = nce17->nonCriticalExtension;
if (!nce18->nonCriticalExtension)
nce18->nonCriticalExtension = CALLOC(1, sizeof(*nce18->nonCriticalExtension));
typeof(nce18->nonCriticalExtension) nce19 = nce18->nonCriticalExtension;
if (!nce19->nonCriticalExtension)
nce19->nonCriticalExtension = CALLOC(1, sizeof(*nce19->nonCriticalExtension));
typeof(nce19->nonCriticalExtension) nce20 = nce19->nonCriticalExtension;
if (!nce20->nonCriticalExtension)
nce20->nonCriticalExtension = CALLOC(1, sizeof(*nce20->nonCriticalExtension));
typeof(nce20->nonCriticalExtension) nce21 = nce20->nonCriticalExtension;
if (!nce21->nonCriticalExtension)
nce21->nonCriticalExtension = CALLOC(1, sizeof(*nce21->nonCriticalExtension));
typeof(nce21->nonCriticalExtension) nce22 = nce21->nonCriticalExtension;
if (!nce22->nonCriticalExtension)
nce22->nonCriticalExtension = CALLOC(1, sizeof(*nce22->nonCriticalExtension));
typeof(nce22->nonCriticalExtension) nce23 = nce22->nonCriticalExtension;
if (!nce23->nonCriticalExtension)
nce23->nonCriticalExtension = CALLOC(1, sizeof(*nce23->nonCriticalExtension));
typeof(nce23->nonCriticalExtension) nce24 = nce23->nonCriticalExtension;
if (!nce24->irat_ParametersNR_r15)
nce24->irat_ParametersNR_r15 = CALLOC(1, sizeof(*nce24->irat_ParametersNR_r15));
typeof(nce24->irat_ParametersNR_r15) irat = nce24->irat_ParametersNR_r15;
if (!irat->en_DC_r15)
irat->en_DC_r15 = CALLOC(1, sizeof(*irat->en_DC_r15));
*irat->en_DC_r15 = LTE_IRAT_ParametersNR_r15__en_DC_r15_supported;
}
OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname, bool received_nr_msg) {
static OAI_UECapability_t UECapability; /* TODO declared static to allow returning this has an address should be allocated in a cleaner way. */
static LTE_SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
static LTE_InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
@@ -4476,7 +4728,13 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
UE_EUTRA_Capability->featureGroupIndicators = bit_string;
}
// UE_EUTRA_Capability->interRAT_Parameters // null
if (get_softmodem_params()->nsa && received_nr_msg)
{
allocate_en_DC_r15(UE_EUTRA_Capability);
if (!is_en_dc_supported(UE_EUTRA_Capability)){
LOG_E(RRC, "We did not properly allocate en_DC_r15 for UE_EUTRA_Capability\n");
}
}
} else {
FILE *f = fopen(UE_EUTRA_Capability_xer_fname, "r");
assert(f);
+40 -12
View File
@@ -41,6 +41,7 @@
#include "RRC/LTE/rrc_defs.h"
#include "LTE_SL-DestinationInfoList-r12.h"
#include "OctetString.h"
/*
* The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
@@ -52,6 +53,14 @@
*/
int xer_sprint(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
#define asn1cCallocOne(VaR, VaLue) \
VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue;
#define asn1cCalloc(VaR, lOcPtr) \
typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR));
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \
TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \
ASN_SEQUENCE_ADD(&VaR,lOcPtr);
uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index);
uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId);
@@ -129,7 +138,7 @@ routine only generates an mo-data establishment cause.
@param rv 5 byte random string or S-TMSI
@returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv);
/**
\brief Generate an SidelinkUEInformation UL-DCCH-Message (UE).
@@ -156,7 +165,9 @@ uint8_t
do_RRCConnectionReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
const uint8_t Transaction_id
size_t buffer_size,
const uint8_t Transaction_id,
OCTET_STRING_t *str
);
/**
@@ -204,6 +215,7 @@ uint16_t
do_RRCConnectionReconfiguration_BR(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
@@ -249,6 +261,7 @@ uint16_t
do_RRCConnectionReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
@@ -322,14 +335,8 @@ routine only generates an mo-data establishment cause.
@param transaction_id Transaction index
@returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionRelease(uint8_t Mod_id, uint8_t *buffer,int Transaction_id);
uint8_t do_RRCConnectionRelease(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, int Transaction_id);
/***
* \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data)
* @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU
* @returns Size of encoded bit stream in bytes
*/
uint8_t do_MCCHMessage(uint8_t *buffer);
/***
* \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data)
* @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU
@@ -338,14 +345,28 @@ uint8_t do_MCCHMessage(uint8_t *buffer);
uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
uint8_t sync_area,
uint8_t *buffer,
size_t buffer_size,
LTE_MCCH_Message_t *mcch_message,
LTE_MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration);
uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t);
ssize_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
int measid, int phy_id,
long rsrp_s, long rsrq_s,
long rsrp_t, long rsrq_t);
ssize_t do_nrMeasurementReport(uint8_t *buffer,
size_t bufsize,
LTE_MeasId_t measid,
LTE_PhysCellIdNR_r15_t phy_id,
long rsrp_s,
long rsrq_s,
long rsrp_tar,
long rsrq_tar);
uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer);
uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain);
uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain);
uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer);
@@ -353,12 +374,17 @@ int do_HandoverPreparation(char *ho_buf, int ho_size, LTE_UE_EUTRA_Capability_t
int do_HandoverCommand(char *ho_buf, int ho_size, char *rrc_buf, int rrc_size);
OAI_UECapability_t *fill_ue_capability(char *LTE_UE_EUTRA_Capability_xer);
OAI_UECapability_t *fill_ue_capability(char *LTE_UE_EUTRA_Capability_xer, bool received_nr_msg);
int is_en_dc_supported(LTE_UE_EUTRA_Capability_t *c);
void allocate_en_DC_r15(LTE_UE_EUTRA_Capability_t *cap);
uint8_t
do_UECapabilityEnquiry(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
int16_t eutra_band,
uint32_t nr_band);
@@ -367,6 +393,7 @@ uint8_t
do_NR_UECapabilityEnquiry(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
int16_t eutra_band,
uint32_t nr_band);
@@ -374,6 +401,7 @@ do_NR_UECapabilityEnquiry(
uint8_t do_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
const uint8_t cipheringAlgorithm,
const uint8_t integrityProtAlgorithm);
+7 -4
View File
@@ -834,6 +834,7 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
uint16_t do_RRCConnectionReconfiguration_NB_IoT(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1
LTE_DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default)
@@ -886,7 +887,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
NULL,
(void *)&dl_dcch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);
buffer_size);
if (enc_rval.encoded <= 0) {
LOG_E(RRC, "ASN1 message encoding failed %s, %li\n",
@@ -1020,7 +1021,8 @@ uint8_t do_DLInformationTransfer_NB_IoT(
/*do_RRCConnectionReestablishment_NB-->used to re-establish SRB1*/ //which parameter to use?
uint8_t do_RRCConnectionReestablishment_NB_IoT(
uint8_t Mod_id,
uint8_t *const buffer,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id,
const NB_IoT_DL_FRAME_PARMS *const frame_parms, //to be changed
LTE_SRB_ToAddModList_NB_r13_t *SRB_list_NB_IoT) { //should contain SRB1 already configured?
@@ -1046,7 +1048,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT(
NULL,
(void *)&dl_ccch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);
buffer_size);
if (enc_rval.encoded <= 0) {
LOG_E(RRC, "ASN1 message encoding failed (%s, %li)!\n",
@@ -1065,6 +1067,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT(
uint8_t do_RRCConnectionRelease_NB_IoT(
uint8_t Mod_id,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id) {
asn_enc_rval_t enc_rval;
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
@@ -1087,7 +1090,7 @@ uint8_t do_RRCConnectionRelease_NB_IoT(
NULL,
(void *)&dl_dcch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);//check
buffer_size);
return((enc_rval.encoded+7)/8);
}
+9 -5
View File
@@ -125,10 +125,12 @@ uint8_t do_RRCConnectionSetupComplete_NB_IoT(uint8_t Mod_id, uint8_t* buffer, co
@param Transaction_id
@returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionReconfigurationComplete_NB_IoT(
size_t do_RRCConnectionReconfigurationComplete_NB_IoT(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* buffer,
const uint8_t Transaction_id
size_t buffer_size,
const uint8_t Transaction_id,
OCTET_STRING_t *str
);
/**
@@ -178,6 +180,7 @@ uint16_t
do_RRCConnectionReconfiguration_NB_IoT(
const protocol_ctxt_t* const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
SRB_ToAddModList_NB_r13_t *SRB_list_NB_IoT,
DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT,
@@ -249,8 +252,8 @@ do_RRCConnectionReject_NB_IoT(
@param transaction_id Transaction index
@returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionRelease_NB_IoT(uint8_t Mod_id, uint8_t *buffer,int Transaction_id);
uint8_t do_RRCConnectionRelease_NB_IoT(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
int Transaction_id);
uint8_t do_DLInformationTransfer_NB_IoT(
uint8_t Mod_id,
@@ -273,7 +276,8 @@ uint8_t do_DLInformationTransfer_NB_IoT(
uint8_t do_RRCConnectionReestablishment_NB_IoT(
uint8_t Mod_id,
uint8_t* const buffer,
uint8_t* buffer,
size_t buffer_size,
const uint8_t Transaction_id,
const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed
SRB_ToAddModList_NB_r13_t** SRB_configList_NB_IoT
+1 -1
View File
@@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s {
//Measurement Report not supported in NB-IoT
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 8192
#define RRC_BUF_SIZE 512
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20
+903 -189
View File
File diff suppressed because it is too large Load Diff
-238
View File
@@ -1,238 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_UE_ral.c
* \brief rrc procedures for handling RAL messages
* \author Lionel GAUTHIER
* \date 2013
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#define RRC_UE
#define RRC_UE_RAL_C
//-----------------------------------------------------------------------------
#include "rrc_UE_ral.h"
#include "assertions.h"
#include "collection/hashtable/obj_hashtable.h"
#include "RRC/LTE/defs.h"
#include "RRC/LTE/extern.h"
//-----------------------------------------------------------------------------
int rrc_ue_ral_delete_all_thresholds_type(unsigned int mod_idP, ral_link_param_type_t *param_type_pP)
//-----------------------------------------------------------------------------
{
hashtable_rc_t rc;
rrc_ral_threshold_key_t *key;
rrc_ral_threshold_key_t *keys = NULL;
unsigned int num_keys = 0;
int return_code = 0;
rc = obj_hashtable_get_keys(UE_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&keys, &num_keys);
if (rc == HASH_TABLE_OK) {
key = keys;
while (num_keys > 0) {
if (memcmp(&key->link_param_type, param_type_pP, sizeof(ral_link_param_type_t)) == 0) {
rc = obj_hashtable_remove (UE_rrc_inst[mod_idP].ral_meas_thresholds, key, sizeof(rrc_ral_threshold_key_t));
if (rc != HASH_TABLE_OK) {
return_code = -1;
}
}
key = &key[1];
num_keys--;
}
} else {
return_code = -1;
}
if (keys != NULL) {
free(keys);
}
return return_code;
}
//-----------------------------------------------------------------------------
int rrc_ue_ral_delete_threshold(unsigned int mod_idP, ral_link_param_type_t *param_type_pP, ral_threshold_t *threshold_pP)
//-----------------------------------------------------------------------------
{
hashtable_rc_t rc;
rrc_ral_threshold_key_t ref_key;
memcpy(&ref_key.link_param_type, param_type_pP, sizeof(ral_link_param_type_t));
memcpy(&ref_key.threshold, threshold_pP, sizeof(ral_threshold_t));
rc = obj_hashtable_remove (UE_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&ref_key, sizeof(rrc_ral_threshold_key_t));
if (rc == HASH_TABLE_OK) {
return 0;
} else {
return -1;
}
}
//-----------------------------------------------------------------------------
int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageDef *msg_pP)
//-----------------------------------------------------------------------------
{
ral_transaction_id_t transaction_id = 0;
rrc_ral_configure_threshold_req_t *configure_threshold_req_p = NULL;
ral_link_cfg_param_t *link_cfg_param_p = NULL;
ral_threshold_t *threshold_p = NULL;
MessageDef *message_p = NULL;
unsigned int ix_param = 0;
unsigned int ix_thresholds = 0;
DevAssert(msg_pP != NULL);
LOG_I(RRC, "[UE %d] Received %s\n", mod_idP, ITTI_MSG_NAME (msg_pP));
configure_threshold_req_p = &RRC_RAL_CONFIGURE_THRESHOLD_REQ(msg_pP);
transaction_id = configure_threshold_req_p->transaction_id;
for (ix_param = 0; ix_param < configure_threshold_req_p->num_link_cfg_params; ix_param++) {
link_cfg_param_p = &configure_threshold_req_p->link_cfg_params[ix_param];
switch (link_cfg_param_p->th_action) {
case RAL_TH_ACTION_SET_NORMAL_THRESHOLD:
case RAL_TH_ACTION_SET_ONE_SHOT_THRESHOLD:
switch (link_cfg_param_p->link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
switch (link_cfg_param_p->link_param_type._union.link_param_gen) {
case RAL_LINK_PARAM_GEN_DATA_RATE:
case RAL_LINK_PARAM_GEN_SIGNAL_STRENGTH:
case RAL_LINK_PARAM_GEN_SINR:
case RAL_LINK_PARAM_GEN_THROUGHPUT:
case RAL_LINK_PARAM_GEN_PACKET_ERROR_RATE:
message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_gen %d\n", link_cfg_param_p->link_param_type._union.link_param_gen);
return -1;
}
break;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
switch (link_cfg_param_p->link_param_type._union.link_param_qos) {
case RAL_LINK_PARAM_QOS_MAX_NUM_DIF_COS_SUPPORTED:
case RAL_LINK_PARAM_QOS_MIN_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_AVG_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_MAX_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_STD_DEVIATION_PACKET_TRANSFER_DELAY:
case RAL_LINK_PARAM_QOS_PACKET_LOSS_RATE_ALL_COS_FRAME_RATIO:
message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_qos %d\n", link_cfg_param_p->link_param_type._union.link_param_qos);
return -1;
}
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
switch (link_cfg_param_p->link_param_type._union.link_param_lte) {
// group by dest task id
case RAL_LINK_PARAM_LTE_UE_RSRP:
case RAL_LINK_PARAM_LTE_UE_RSRQ:
case RAL_LINK_PARAM_LTE_UE_CQI:
message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
case RAL_LINK_PARAM_LTE_AVAILABLE_BW:
case RAL_LINK_PARAM_LTE_PACKET_LOSS_RATE:
case RAL_LINK_PARAM_LTE_L2_BUFFER_STATUS:
case RAL_LINK_PARAM_LTE_PACKET_DELAY:
message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES:
case RAL_LINK_PARAM_LTE_EMBMS_CAPABILITY:
case RAL_LINK_PARAM_LTE_JUMBO_FEASIBILITY:
case RAL_LINK_PARAM_LTE_JUMBO_SETUP_STATUS:
case RAL_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW:
#warning "TO DO MIH LTE LINK PARAMS IN RRC UE"
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_lte %d\n", link_cfg_param_p->link_param_type._union.link_param_lte);
return -1;
}
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_type choice %d\n", link_cfg_param_p->link_param_type.choice);
return -1;
}
for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) {
threshold_p = &link_cfg_param_p->thresholds[ix_thresholds];
}
break;
case RAL_TH_ACTION_CANCEL_THRESHOLD:
// IEEE Std 802.21-2008, Table F4, Data type name=LINK_CFG_PARAM (page 228):
// When “Cancel threshold” is selected and no thresholds are specified, then all
// currently configured thresholds for the given LINK_PARAM_TYPE are cancelled.
if (link_cfg_param_p->num_thresholds == 0) {
rrc_ue_ral_delete_all_thresholds_type(mod_idP, &link_cfg_param_p->link_param_type);
} else {
//
// When “Cancel threshold” is selected and thresholds are specified only those
// configured thresholds for the given LINK_PARAM_TYPE and whose threshold value match what was
// specified are cancelled.
for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) {
threshold_p = &link_cfg_param_p->thresholds[ix_thresholds];
rrc_ue_ral_delete_threshold(mod_idP, &link_cfg_param_p->link_param_type, threshold_p);
}
}
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ with RAL_TH_ACTION_CANCEL_THRESHOLD\n");
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown th_action %d\n", link_cfg_param_p->th_action);
return -1;
}
}
return 0;
}
+7 -5
View File
@@ -52,7 +52,7 @@
//for D2D
#define DEBUG_CTRL_SOCKET
#define BUFSIZE 1024
#define CONTROL_SOCKET_PORT_NO 8888
#define MAX_NUM_DEST 10
//netlink
@@ -311,12 +311,12 @@ typedef enum SL_TRIGGER_e {
#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n)
#define RRM_CALLOC2(t,s) (t *) malloc16( s )
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 8192
#define RRC_BUF_SIZE 512
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20
@@ -363,6 +363,7 @@ typedef struct UE_RRC_INFO_s {
uint32_t N310_cnt;
uint32_t N311_cnt;
rnti_t rnti;
struct LTE_DL_DCCH_Message *dl_dcch_msg;
} __attribute__ ((__packed__)) UE_RRC_INFO;
typedef struct UE_S_TMSI_s {
@@ -916,6 +917,7 @@ typedef struct UE_RRC_INST_s {
float rsrq_db[7];
float rsrp_db_filtered[7];
float rsrq_db_filtered[7];
int subframeCount;
/* KeNB as computed from parameters within USIM card */
uint8_t kenb[32];
uint8_t nh[32];
+74 -88
View File
@@ -90,6 +90,7 @@
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "intertask_interface.h"
#include "softmodem-common.h"
#if ENABLE_RAL
#include "rrc_eNB_ral.h"
@@ -100,7 +101,6 @@
#define ASN_MAX_ENCODE_SIZE 4096
#define NUMBEROF_DRBS_TOBE_ADDED 1
static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size);
static int is_en_dc_supported(LTE_UE_EUTRA_Capability_t *c);
extern RAN_CONTEXT_t RC;
@@ -152,7 +152,7 @@ init_SI(
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
if(configuration->radioresourceconfig[CC_id].mbms_dedicated_serving_cell == TRUE) {
LOG_I(RRC, "Configuring MIB FeMBMS (N_RB_DL %d)\n",
LOG_A(RRC, "Configuring MIB FeMBMS (N_RB_DL %d)\n",
(int)configuration->N_RB_DL[CC_id]);
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_FeMBMS = (uint8_t *) malloc16(4);
do_MIB_FeMBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
@@ -253,7 +253,7 @@ init_SI(
carrier->N_RB_DL = configuration->N_RB_DL[CC_id];
carrier->pbch_repetition = configuration->pbch_repetition[CC_id];
LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
LOG_A(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
(int)configuration->N_RB_DL[CC_id],
(int)configuration->radioresourceconfig[CC_id].phich_resource,
(int)configuration->radioresourceconfig[CC_id].phich_duration);
@@ -538,6 +538,7 @@ init_MCCH(
RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP,
sync_area,
(uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area],
32, /* TODO: what is the actual size of .MCCH_MESSAGE[sync_area]? */
&RC.rrc[enb_mod_idP]->carrier[CC_id].mcch,
&RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message);
LOG_I(RRC, "mcch message pointer %p for sync area %d \n",
@@ -1196,7 +1197,7 @@ rrc_eNB_process_RRCConnectionSetupComplete(
)
//-----------------------------------------------------------------------------
{
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n",
LOG_A(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.StatusRrc = RRC_CONNECTED;
@@ -1224,13 +1225,14 @@ rrc_eNB_generate_SecurityModeCommand(
)
//-----------------------------------------------------------------------------
{
uint8_t buffer[100];
uint8_t buffer[100]={0};
uint8_t size;
T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
size = do_SecurityModeCommand(
ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.integrity_algorithm);
@@ -1285,6 +1287,7 @@ rrc_eNB_generate_UECapabilityEnquiry(
size = do_UECapabilityEnquiry(
ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
eutra_band,
nr_band);
@@ -1335,10 +1338,11 @@ rrc_eNB_generate_NR_UECapabilityEnquiry(
size = do_NR_UECapabilityEnquiry(
ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
eutra_band,
nr_band);
LOG_I(RRC,
LOG_A(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate NR UECapabilityEnquiry (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size);
@@ -2001,9 +2005,10 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
// send LTE_RRCConnectionReconfiguration
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
next_xid, //Transaction_id,
(LTE_SRB_ToAddModList_t *)*SRB_configList2, // SRB_configList
(LTE_DRB_ToAddModList_t *)DRB_configList,
@@ -2196,10 +2201,9 @@ rrc_eNB_generate_RRCConnectionRelease(
)
//-----------------------------------------------------------------------------
{
uint8_t buffer[RRC_BUF_SIZE];
uint8_t buffer[RRC_BUF_SIZE]={0};
uint16_t size = 0;
int release_num;
memset(buffer, 0, RRC_BUF_SIZE);
T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
#if 0
@@ -2211,7 +2215,8 @@ rrc_eNB_generate_RRCConnectionRelease(
}
#endif
size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer, sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
@@ -2487,9 +2492,10 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *co
LOG_W(RRC,"dedlicated NAS list is empty\n");
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
xid,
(LTE_SRB_ToAddModList_t *)NULL,
(LTE_DRB_ToAddModList_t *)*DRB_configList2,
@@ -2734,9 +2740,9 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *cons
LOG_W(RRC,"dedlicated NAS list is empty\n");
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
buffer, sizeof(buffer),
xid,
(LTE_SRB_ToAddModList_t *)NULL,
(LTE_DRB_ToAddModList_t *)DRB_configList2,
@@ -2835,9 +2841,10 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_
LOG_W(RRC,"dedlicated NAS list is empty\n");
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
xid,
NULL,
NULL,
@@ -3465,6 +3472,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15->ss_rsrq = TRUE;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15->ss_sinr = TRUE;
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_NR);
LOG_A(RRC, "Generating RRCCConnectionReconfigurationRequest (NRUE Measurement Report Request).\n");
}
// LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
@@ -3545,9 +3553,10 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
xid, // Transaction_id,
(LTE_SRB_ToAddModList_t *) *SRB_configList2, // SRB_configList
(LTE_DRB_ToAddModList_t *) *DRB_configList,
@@ -4257,9 +4266,10 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
xid, // Transaction_id,
(LTE_SRB_ToAddModList_t *) *SRB_configList2, // SRB_configList
(LTE_DRB_ToAddModList_t *) *DRB_configList,
@@ -4357,6 +4367,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id,
(LTE_SRB_ToAddModList_t *)NULL,
(LTE_DRB_ToAddModList_t *)NULL,
@@ -4421,7 +4432,6 @@ static int encode_CG_ConfigInfo(
struct NR_CG_ConfigInfo *cg_configinfo = NULL;
struct NR_RadioBearerConfig *rb_config = NULL;
asn_enc_rval_t enc_rval;
int RRC_OK = 1;
char temp_buff[ASN_MAX_ENCODE_SIZE];
NR_UE_CapabilityRAT_ContainerList_t *ue_cap_rat_container_list = NULL;
NR_UE_CapabilityRAT_Container_t *ue_cap_rat_container_MRDC = NULL;
@@ -4441,7 +4451,6 @@ static int encode_CG_ConfigInfo(
= calloc(1,sizeof(struct NR_CG_ConfigInfo_IEs));
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo != NULL,
"failed to allocate memory for cg_configinfo_IEs");
if(ue_context_pP->ue_context.UE_Capability_MRDC) {
RAT_Container_count++;
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_MRDC_Capability,NULL,
@@ -4611,6 +4620,7 @@ rrc_eNB_process_MeasurementReport(
//= measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15;
= measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId;
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId = 0;
//For the moment we have a single E-RAB which will be the one to be added to the gNB
//Not sure how to select bearers to be added if there are multiple.
X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded = 1;
@@ -4624,7 +4634,7 @@ rrc_eNB_process_MeasurementReport(
sizeof(transport_layer_addr_t));
}
LOG_I(RRC,
LOG_A(RRC,
"[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n",
ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->subframe, ctxt_pP->rnti);
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
@@ -4668,6 +4678,10 @@ rrc_eNB_process_MeasurementReport(
if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) {
ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells));
}
if (!ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array) {
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array =
calloc(neighboring_cells, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array));
}
for (i=0; i < neighboring_cells; i++) {
if (i>=ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count) {
@@ -4677,6 +4691,11 @@ rrc_eNB_process_MeasurementReport(
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId =
measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId;
if (!ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult));
if (!ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult));
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult =
measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult;
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult =
@@ -4973,19 +4992,17 @@ void rrc_eNB_handover_ue_context_release(
struct rrc_eNB_ue_context_s *ue_context_p) {
int e_rab = 0;
//MessageDef *msg_release_p = NULL;
MessageDef *msg_delete_tunnels_p = NULL;
uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id;
//msg_release_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE);
//itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_release_p);
s1ap_ue_context_release(ctxt_pP->instance, ue_context_p->ue_context.eNB_ue_s1ap_id);
//MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id);
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0;
gtpv1u_enb_delete_tunnel_req_t delete_tunnels={0};
delete_tunnels.rnti = ue_context_p->ue_context.rnti;
delete_tunnels.from_gnb = 0;
for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] =
delete_tunnels.eps_bearer_id[delete_tunnels.num_erab++] =
ue_context_p->ue_context.enb_gtp_ebi[e_rab];
// erase data
ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0;
@@ -4993,7 +5010,7 @@ void rrc_eNB_handover_ue_context_release(
ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
}
itti_send_msg_to_task(TASK_VARIABLE, ctxt_pP->module_id, msg_delete_tunnels_p);
gtpv1u_delete_s1u_tunnel(ctxt_pP->module_id, &delete_tunnels);
struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL;
rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id);
@@ -5144,7 +5161,9 @@ check_handovers(
// Configure target
ue_context_p->ue_context.handover_info->state = HO_FORWARDING;
msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ_ACK);
rrc_eNB_generate_HO_RRCConnectionReconfiguration(ctxt_pP, ue_context_p, X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer,
rrc_eNB_generate_HO_RRCConnectionReconfiguration(ctxt_pP, ue_context_p,
X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer,
sizeof(X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer),
&X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer_size);
rrc_eNB_configure_rbs_handover(ue_context_p,ctxt_pP);
X2AP_HANDOVER_REQ_ACK(msg).rnti = ue_context_p->ue_context.rnti;
@@ -5306,6 +5325,7 @@ void
rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
uint8_t *buffer,
size_t buffer_size,
int *_size
//const uint8_t ho_state
)
@@ -6247,11 +6267,12 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, buffer_size);
char rrc_buf[1000 /* arbitrary, should be big enough, has to be less than size of return buf by a few bits/bytes */];
int rrc_size;
rrc_size = do_RRCConnectionReconfiguration(ctxt_pP,
(unsigned char *)rrc_buf,
sizeof(rrc_buf),
xid, //Transaction_id,
NULL, // SRB_configList
NULL,
@@ -6287,7 +6308,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
char *ho_buf = (char *)buffer;
int ho_size;
ho_size = do_HandoverCommand(
ho_buf, 1024 /* TODO: this is the value found in struct x2ap_handover_req_ack_s for array rrc_buffer */,
ho_buf, buffer_size,
rrc_buf,
rrc_size);
*_size = size = ho_size;
@@ -7791,47 +7812,6 @@ is_ul_256QAM_supported(
&& *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14==LTE_BandParameters_v1430__ul_256QAM_r14_supported;
}
static int
is_en_dc_supported(
LTE_UE_EUTRA_Capability_t *c
)
//-----------------------------------------------------------------------------
{
/* to be refined - check that the bands supported by the UE include
* the band of the gNB
*/
return c != NULL // R8
&& c->NCE != NULL // R92
&& c->NCE->NCE != NULL // R94
&& c->NCE->NCE->NCE != NULL // R102
&& c->NCE->NCE->NCE->NCE != NULL // R106
&& c->NCE->NCE->NCE->NCE->NCE != NULL // R109
&& c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //135
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //144
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //145
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //146
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //151
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL
&& c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL
&& *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 ==
LTE_IRAT_ParametersNR_r15__en_DC_r15_supported;
#undef NCE
}
int to_nr_rsrpq(long rsrpq_result,int nr_band) {
switch(nr_band) {
@@ -7886,7 +7866,6 @@ rrc_eNB_decode_dcch(
LTE_UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg;
int i;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
MessageDef *msg_delete_tunnels_p = NULL;
uint8_t xid;
int dedicated_DRB=0;
T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
@@ -7902,7 +7881,6 @@ rrc_eNB_decode_dcch(
Srb_id);
}
//memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
dec_rval = uper_decode(
@@ -7994,7 +7972,7 @@ rrc_eNB_decode_dcch(
/*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/
int flexran_agent_handover = 0;
if (EPC_MODE_ENABLED) {
if (EPC_MODE_ENABLED || get_softmodem_params()->emulate_l1) {
if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) {
dedicated_DRB = 1;
LOG_I(RRC,
@@ -8067,6 +8045,7 @@ rrc_eNB_decode_dcch(
rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p);
/* send reconfiguration complete to gNB */
rrc_eNB_process_reconfiguration_complete_endc(ctxt_pP, ue_context_p);
LOG_A(RRC, "Sent rrcReconfigurationComplete to gNB\n");
}
}
}
@@ -8124,21 +8103,19 @@ rrc_eNB_decode_dcch(
xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier;
ue_context_p->ue_context.e_rab_release_command_flag = 0;
//gtp tunnel delete
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0;
gtpv1u_enb_delete_tunnel_req_t delete_tunnels={0};
delete_tunnels.rnti = ue_context_p->ue_context.rnti;
delete_tunnels.from_gnb = 0;
for(i = 0; i < NB_RB_MAX; i++) {
if(xid == ue_context_p->ue_context.e_rab[i].xid) {
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
delete_tunnels.eps_bearer_id[delete_tunnels.num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
ue_context_p->ue_context.enb_gtp_teid[i] = 0;
memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i]));
ue_context_p->ue_context.enb_gtp_ebi[i] = 0;
}
}
itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p);
gtpv1u_delete_s1u_tunnel(ctxt_pP->instance, &delete_tunnels);
//S1AP_E_RAB_RELEASE_RESPONSE
rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP,
ue_context_p,
@@ -8430,12 +8407,13 @@ rrc_eNB_decode_dcch(
xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg);
}
LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
LOG_A(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
int eutra_index = -1;
for (i = 0; i < ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count; i++) {
if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type ==
LTE_RAT_Type_nr) {
LOG_A(RRC, "got nrUE capabilities for UE %x\n", ctxt_pP->rnti);
if(ue_context_p->ue_context.UE_Capability_nr) {
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
ue_context_p->ue_context.UE_Capability_nr = 0;
@@ -8541,7 +8519,13 @@ rrc_eNB_decode_dcch(
if (dec_rval.code == RC_OK) {
/* do NR only if at least one gNB connected */
if (RC.rrc[ctxt_pP->module_id]->num_gnb_cells != 0)
{
allocate_en_DC_r15(ue_context_p->ue_context.UE_Capability);
if (!is_en_dc_supported(ue_context_p->ue_context.UE_Capability)){
LOG_E(RRC, "We did not properly allocate en_DC_r15 for UE_EUTRA_Capability\n");
}
ue_context_p->ue_context.does_nr = is_en_dc_supported(ue_context_p->ue_context.UE_Capability);
}
else
ue_context_p->ue_context.does_nr = 0;
}
@@ -8767,9 +8751,9 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
for (int j=0; j<RC.nb_inst; j++) {
eNB_RRC_INST *rrc = RC.rrc[j];
if (rrc->configuration.mcc[0] == f1_setup_req->mcc[i] &&
rrc->configuration.mnc[0] == f1_setup_req->mnc[i] &&
rrc->nr_cellid == f1_setup_req->nr_cellid[i]) {
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) {
// check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i];
@@ -8809,7 +8793,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
AssertFatal(bcch_message->message.choice.c1.present == LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
"bcch_message->message.choice.c1.present != LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i];
rrc->carrier[0].physCellId = f1_setup_req->cell[i].nr_pci;
// prepare F1_SETUP_RESPONSE
if (msg_p == NULL) {
@@ -8821,7 +8805,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0];
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0];
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i];
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci;
int num_SI= 0;
if (rrc->carrier[0].SIB23) {
F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].SI_container[2+num_SI] = rrc->carrier[0].SIB23;
@@ -8842,7 +8826,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n",
j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],rrc->configuration.mnc[0], f1_setup_req->mnc[i]);
j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc,rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc);
}
}// for (int j=0;j<RC.nb_inst;j++)
@@ -10053,7 +10037,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
{
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size = 0;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
// allocate dedicated pools for UE -sl-CommConfig/sl-DiscConfig (sl-V2X-ConfigDedicated)
//populate dedicated resources for SL communication (sl-CommConfig)
@@ -10066,6 +10050,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
sl_CommConfig[0] = rrc_eNB_get_sidelink_commTXPool(ctxt_pP, ue_context_pP, destinationInfoList);
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id
(LTE_SRB_ToAddModList_t *)NULL,
(LTE_DRB_ToAddModList_t *)NULL,
@@ -10088,6 +10073,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
sl_DiscConfig[0] = rrc_eNB_get_sidelink_discTXPool(ctxt_pP, ue_context_pP, n_discoveryMessages );
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
sizeof(buffer),
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id
(LTE_SRB_ToAddModList_t *)NULL,
(LTE_DRB_ToAddModList_t *)NULL,
+16 -6
View File
@@ -261,23 +261,33 @@ boolean_t gtpv_data_req_new (
void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
module_id_t enb_mod_idP,
const rrc_eNB_ue_context_t* const ue_context_pP
rrc_eNB_ue_context_t* ue_context_pP
)
{
if (!ue_context_pP) {
LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__);
return;
}
eNB_RRC_UE_t *ue = &ue_context_pP->ue_context;
gtpv1u_enb_delete_tunnel_req_t tmp={0};
tmp.rnti = ue_context_pP->ue_context.rnti;
tmp.rnti = ue->rnti;
tmp.from_gnb = 0;
tmp.num_erab = ue_context_pP->ue_context.nb_of_e_rabs;
for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) {
const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab];
tmp.num_erab = ue->nb_of_e_rabs;
for (int e_rab = 0; e_rab < ue->nb_of_e_rabs; e_rab++) {
const rb_id_t gtp_ebi = ue->enb_gtp_ebi[e_rab];
tmp.eps_bearer_id[e_rab] = gtp_ebi;
}
gtpv1u_delete_s1u_tunnel(enb_mod_idP,&tmp);
gtpv1u_delete_s1u_tunnel(enb_mod_idP,&tmp);
if ( ue->ue_release_timer_rrc > 0
&& (ue->handover_info == NULL ||
(ue->handover_info->state != HO_RELEASE &&
ue->handover_info->state != HO_CANCEL
)
)
)
ue->ue_release_timer_rrc = ue->ue_release_timer_thres_rrc;
}
+1 -1
View File
@@ -57,7 +57,7 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
*/
void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(
module_id_t enb_mod_idP,
const rrc_eNB_ue_context_t* const ue_context_pP
rrc_eNB_ue_context_t* ue_context_pP
);
boolean_t
+61 -67
View File
@@ -62,11 +62,6 @@
#include "executables/softmodem-common.h"
extern RAN_CONTEXT_t RC;
extern int
gtpv1u_delete_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
/* Value to indicate an invalid UE initial id */
static const uint16_t UE_INITIAL_ID_INVALID = 0;
@@ -169,7 +164,6 @@ rrc_eNB_S1AP_get_ue_ids(
instance_t instance = 0;
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
rrc_eNB_ue_context_t *ue_context_p = NULL;
/*****************************/
hashtable_rc_t h_rc;
@@ -257,29 +251,7 @@ rrc_eNB_S1AP_get_ue_ids(
LOG_E(RRC, "Removing UE context eNB_ue_s1ap_id %u: did not find context\n",ue_desc_p->eNB_ue_s1ap_id);
}
return NULL; //skip the operation below to avoid loop
result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id);
if (ue_desc_p->ue_initial_id != UE_INITIAL_ID_INVALID) {
result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id);
if (result != NULL) {
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instance)], result->ue_rnti);
if ((ue_context_p != NULL) && (ue_context_p->ue_context.eNB_ue_s1ap_id == 0)) {
ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id;
} else {
LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n",
rrc_instance_pP - RC.rrc[0],
(ue_context_p==NULL)?99999:ue_context_p->ue_context.eNB_ue_s1ap_id,
eNB_ue_s1ap_id,
result->ue_rnti);
}
}
} else {
LOG_E(S1AP, "[eNB %ld] S1AP context found but ue_initial_id is invalid (0)\n", rrc_instance_pP - RC.rrc[0]);
return NULL;
}
return NULL;
} else {
LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32", because ue_initial_id is invalid in S1AP context\n",
rrc_instance_pP - RC.rrc[0],
@@ -593,14 +565,20 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) {
if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE || ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_TOMODIFY) {
e_rabs_done++;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
// TODO add other information from S1-U when it will be integrated
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab];
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab];
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length = 4;
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
}
} else {
e_rabs_failed++;
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
@@ -619,9 +597,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
ue_context_pP->ue_id_rnti,
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id,
e_rabs_done, e_rabs_failed);
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
}
//------------------------------------------------------------------------------
@@ -1078,29 +1053,43 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
}
/*
if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){
message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
*/
return (0);
if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){
struct eNB_RRC_INST_s *rrc= RC.rrc[0];
MessageDef *message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p);
req->gNB_CU_ue_id = 0;
req->gNB_DU_ue_id = 0;
req->rnti = ue_context_p->ue_context.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;
req->srbs_to_be_setup = malloc(sizeof(f1ap_srb_to_be_setup_t));
req->srbs_to_be_setup_length = 1;
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
SRBs[0].srb_id=CCCH;
req->drbs_to_be_setup_length = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs;
req->drbs_to_be_setup = malloc(req->drbs_to_be_setup_length * sizeof(f1ap_drb_to_be_setup_t));
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
for (int i = 0; i < req->drbs_to_be_setup_length ; i++) {
DRBs[i].drb_id=S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].e_rab_id;
DRBs[i].rlc_mode = RLC_MODE_AM;
DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd;
DRBs[i].up_ul_tnl_length = 1;
DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr);
DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd;
DRBs[i].up_dl_tnl_length = 1;
}
LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
itti_send_msg_to_task (TASK_CU_F1, 0, message_p);
}
}
return (0);
}
/*------------------------------------------------------------------------------*/
@@ -1706,7 +1695,6 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms
uint8_t b_existed,is_existed;
uint8_t xid;
uint8_t e_rab_release_drb;
MessageDef *msg_delete_tunnels_p = NULL;
e_rab_release_drb = 0;
memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB);
eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id;
@@ -1774,21 +1762,19 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms
rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer);
} else {
//gtp tunnel delete
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0;
gtpv1u_enb_delete_tunnel_req_t delete_tunnels={0};
delete_tunnels.rnti = ue_context_p->ue_context.rnti;
delete_tunnels.from_gnb = 0;
for(i = 0; i < NB_RB_MAX; i++) {
if(xid == ue_context_p->ue_context.e_rab[i].xid) {
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
delete_tunnels.eps_bearer_id[delete_tunnels.num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
ue_context_p->ue_context.enb_gtp_teid[i] = 0;
memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i]));
ue_context_p->ue_context.enb_gtp_ebi[i] = 0;
}
}
itti_send_msg_to_task(TASK_VARIABLE, instance, msg_delete_tunnels_p);
gtpv1u_delete_s1u_tunnel(instance,&delete_tunnels);
//S1AP_E_RAB_RELEASE_RESPONSE
rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
}
@@ -1967,7 +1953,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, RRC_PCCH_DATA_REQ);
/* Create message for PDCP (DLInformationTransfer_t) */
length = do_Paging (instance,
buffer,
buffer, sizeof(buffer),
S1AP_PAGING_IND(msg_p).ue_paging_identity,
S1AP_PAGING_IND(msg_p).cn_domain);
@@ -2253,8 +2239,16 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p,
&delete_tunnel_req);
/* TBD: release the DRB not admitted */
//rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0);
}
if ( ue_context_p->ue_context.ue_release_timer_rrc > 0 &&
(ue_context_p->ue_context.handover_info == NULL ||
(ue_context_p->ue_context.handover_info->state != HO_RELEASE &&
ue_context_p->ue_context.handover_info->state != HO_CANCEL
)
)
)
ue_context_p->ue_context.ue_release_timer_rrc = ue_context_p->ue_context.ue_release_timer_thres_rrc;
}
/* Security key */
ue_context_p->ue_context.next_hop_chain_count=S1AP_PATH_SWITCH_REQ_ACK (msg_p).next_hop_chain_count;
memcpy ( ue_context_p->ue_context.next_security_key,
+8 -3
View File
@@ -171,8 +171,10 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
OCTET_STRING_t dummy_scg_conf;
unsigned char scg_conf_buf[4] = { 0, 0, 0, 0 };
if (scg_group_config!=NULL)
if (scg_group_config!=NULL) {
nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = scg_group_config; //&scg_conf;
LOG_E(RRC, "setting scg_group_config\n");
}
else{
nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = &dummy_scg_conf;
dummy_scg_conf.buf = scg_conf_buf;
@@ -197,8 +199,10 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
OCTET_STRING_t dummy_nr1_conf;
unsigned char nr1_buf[4] = { 0, 0, 0, 0 };
if(scg_RB_config!=NULL)
if(scg_RB_config!=NULL) {
cr_1510.nr_RadioBearerConfig1_r15 = scg_RB_config;
LOG_E(RRC, "setting scg_RB_config\n");
}
else{
cr_1510.nr_RadioBearerConfig1_r15 = &dummy_nr1_conf;
dummy_nr1_conf.buf = nr1_buf;
@@ -230,7 +234,8 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
(void *)&dl_dcch_msg,
buffer,
buffer_size);
AssertFatal (enc_rval.encoded > 0, "asn_DEF_LTE_DL_DCCH_Message message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
{
int len = (enc_rval.encoded + 7) / 8;
int i;
-236
View File
@@ -1,236 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_eNB_ral.c
* \brief rrc procedures for handling RAL messages
* \author Lionel GAUTHIER
* \date 2013
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#define RRC_ENB
#define RRC_ENB_RAL_C
//-----------------------------------------------------------------------------
#include "rrc_eNB_ral.h"
#include "assertions.h"
#include "collection/hashtable/obj_hashtable.h"
#include "RRC/LTE/defs.h"
#include "RRC/LTE/extern.h"
//-----------------------------------------------------------------------------
int rrc_enb_ral_delete_all_thresholds_type(unsigned int mod_idP, ral_link_param_type_t *param_type_pP)
//-----------------------------------------------------------------------------
{
hashtable_rc_t rc;
rrc_ral_threshold_key_t *key;
rrc_ral_threshold_key_t *keys = NULL;
unsigned int num_keys = 0;
int return_code = 0;
rc = obj_hashtable_get_keys(eNB_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&keys, &num_keys);
if (rc == HASH_TABLE_OK) {
key = keys;
while (num_keys > 0) {
if (memcmp(&key->link_param_type, param_type_pP, sizeof(ral_link_param_type_t)) == 0) {
rc = obj_hashtable_remove (eNB_rrc_inst[mod_idP].ral_meas_thresholds, key, sizeof(rrc_ral_threshold_key_t));
if (rc != HASH_TABLE_OK) {
return_code = -1;
}
}
key = &key[1];
num_keys--;
}
} else {
return_code = -1;
}
if (keys != NULL) {
free(keys);
}
return return_code;
}
//-----------------------------------------------------------------------------
int rrc_enb_ral_delete_threshold(unsigned int mod_idP, ral_link_param_type_t *param_type_pP, ral_threshold_t *threshold_pP)
//-----------------------------------------------------------------------------
{
hashtable_rc_t rc;
rrc_ral_threshold_key_t ref_key;
memcpy(&ref_key.link_param_type, param_type_pP, sizeof(ral_link_param_type_t));
memcpy(&ref_key.threshold, threshold_pP, sizeof(ral_threshold_t));
rc = obj_hashtable_remove (eNB_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&ref_key, sizeof(rrc_ral_threshold_key_t));
if (rc == HASH_TABLE_OK) {
return 0;
} else {
return -1;
}
}
//-----------------------------------------------------------------------------
int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageDef *msg_pP)
//-----------------------------------------------------------------------------
{
ral_transaction_id_t transaction_id = 0;
rrc_ral_configure_threshold_req_t *configure_threshold_req_p = NULL;
ral_link_cfg_param_t *link_cfg_param_p = NULL;
ral_threshold_t *threshold_p = NULL;
MessageDef *message_p = NULL;
unsigned int ix_param = 0;
unsigned int ix_thresholds = 0;
DevAssert(msg_pP != NULL);
LOG_I(RRC, "[eNB %d] Received %s\n", mod_idP, ITTI_MSG_NAME (msg_pP));
configure_threshold_req_p = &RRC_RAL_CONFIGURE_THRESHOLD_REQ(msg_pP);
transaction_id = configure_threshold_req_p->transaction_id;
for (ix_param = 0; ix_param < configure_threshold_req_p->num_link_cfg_params; ix_param++) {
link_cfg_param_p = &configure_threshold_req_p->link_cfg_params[ix_param];
switch (link_cfg_param_p->th_action) {
case RAL_TH_ACTION_SET_NORMAL_THRESHOLD:
case RAL_TH_ACTION_SET_ONE_SHOT_THRESHOLD:
switch (link_cfg_param_p->link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
switch (link_cfg_param_p->link_param_type._union.link_param_gen) {
case RAL_LINK_PARAM_GEN_DATA_RATE:
case RAL_LINK_PARAM_GEN_SIGNAL_STRENGTH:
case RAL_LINK_PARAM_GEN_SINR:
case RAL_LINK_PARAM_GEN_THROUGHPUT:
case RAL_LINK_PARAM_GEN_PACKET_ERROR_RATE:
message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_gen %d\n", link_cfg_param_p->link_param_type._union.link_param_gen);
return -1;
}
break;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
switch (link_cfg_param_p->link_param_type._union.link_param_qos) {
case RAL_LINK_PARAM_QOS_MAX_NUM_DIF_COS_SUPPORTED:
case RAL_LINK_PARAM_QOS_MIN_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_AVG_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_MAX_PACKET_TRANSFER_DELAY_ALL_COS:
case RAL_LINK_PARAM_QOS_STD_DEVIATION_PACKET_TRANSFER_DELAY:
case RAL_LINK_PARAM_QOS_PACKET_LOSS_RATE_ALL_COS_FRAME_RATIO:
message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_qos %d\n", link_cfg_param_p->link_param_type._union.link_param_qos);
return -1;
}
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
switch (link_cfg_param_p->link_param_type._union.link_param_lte) {
// group by dest task id
case RAL_LINK_PARAM_LTE_UE_RSRP:
case RAL_LINK_PARAM_LTE_UE_RSRQ:
case RAL_LINK_PARAM_LTE_UE_CQI:
message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
case RAL_LINK_PARAM_LTE_AVAILABLE_BW:
case RAL_LINK_PARAM_LTE_PACKET_LOSS_RATE:
case RAL_LINK_PARAM_LTE_L2_BUFFER_STATUS:
case RAL_LINK_PARAM_LTE_PACKET_DELAY:
message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ);
PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id;
memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t));
itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p);
break;
case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES:
case RAL_LINK_PARAM_LTE_EMBMS_CAPABILITY:
case RAL_LINK_PARAM_LTE_JUMBO_FEASIBILITY:
case RAL_LINK_PARAM_LTE_JUMBO_SETUP_STATUS:
case RAL_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW:
#warning "TO DO MIH LTE LINK PARAMS IN RRC ENB"
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_lte %d\n", link_cfg_param_p->link_param_type._union.link_param_lte);
return -1;
}
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_type choice %d\n", link_cfg_param_p->link_param_type.choice);
return -1;
}
for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) {
threshold_p = &link_cfg_param_p->thresholds[ix_thresholds];
}
break;
case RAL_TH_ACTION_CANCEL_THRESHOLD:
// IEEE Std 802.21-2008, Table F4, Data type name=LINK_CFG_PARAM (page 228):
// When “Cancel threshold” is selected and no thresholds are specified, then all
// currently configured thresholds for the given LINK_PARAM_TYPE are cancelled.
if (link_cfg_param_p->num_thresholds == 0) {
rrc_enb_ral_delete_all_thresholds_type(mod_idP, &link_cfg_param_p->link_param_type);
} else {
//
// When “Cancel threshold” is selected and thresholds are specified only those
// configured thresholds for the given LINK_PARAM_TYPE and whose threshold value match what was
// specified are cancelled.
for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) {
threshold_p = &link_cfg_param_p->thresholds[ix_thresholds];
rrc_enb_ral_delete_threshold(mod_idP, &link_cfg_param_p->link_param_type, threshold_p);
}
}
break;
default:
LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown th_action %d\n", link_cfg_param_p->th_action);
return -1;
}
}
return 0;
}
+10
View File
@@ -31,6 +31,8 @@
* @{
*/
#pragma once
#include "RRC/LTE/rrc_defs.h"
#include "x2ap_messages_types.h"
#include "flexran_agent_extern.h"
@@ -103,6 +105,7 @@ rrc_ue_decode_dcch(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const uint8_t *const Buffer,
const uint32_t Buffer_size,
const uint8_t eNB_indexP
);
@@ -310,6 +313,7 @@ void
rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
uint8_t *buffer,
size_t buffer_size,
int *_size
//const uint8_t ho_state
);
@@ -354,6 +358,12 @@ void *rrc_enb_task(void *args_p);
\param void *args_p Pointer on arguments to start the task. */
void *rrc_ue_task(void *args_p);
/**\brief RRC NSA UE task.
\param void *args_p Pointer on arguments to start the task. */
void *recv_msgs_from_nr_ue(void *args_p);
void init_connections_with_nr_ue(void);
void rrc_eNB_process_x2_setup_request(int mod_id, x2ap_setup_req_t *m);
void rrc_eNB_process_x2_setup_response(int mod_id, x2ap_setup_resp_t *m);
+14
View File
@@ -61,4 +61,18 @@ typedef enum Rrc_Sub_State_e {
RRC_SUB_STATE_CONNECTED_LAST = RRC_SUB_STATE_CONNECTED,
} Rrc_Sub_State_t;
typedef enum Rrc_Msg_Type_e {
UE_CAPABILITY_DUMMY = 0xa0,
UE_CAPABILITY_ENQUIRY,
NRUE_CAPABILITY_ENQUIRY,
UE_CAPABILITY_INFO,
NRUE_CAPABILITY_INFO,
RRC_MEASUREMENT_PROCEDURE,
NR_UE_RRC_MEASUREMENT,
RRC_CONFIG_COMPLETE_REQ,
NR_RRC_CONFIG_COMPLETE_REQ,
OAI_TUN_IFACE_NSA
} Rrc_Msg_Type_t;
#endif /* RRC_TYPES_H_ */
+2
View File
@@ -42,6 +42,8 @@ UE_RRC_INST *UE_rrc_inst = NULL;
#include "LAYER2/MAC/mac_extern.h"
#define MAX_U32 0xFFFFFFFF
extern uint16_t ue_id_g;
uint8_t DRB2LCHAN[8];
long logicalChannelGroup0 = 0;
+35 -15
View File
@@ -323,31 +323,37 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
// 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,&RC.nrrrc[module_idP]->carrier);
fill_initial_cellGroupConfig(rntiP,-1,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier);
MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP);
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)&cellGroupConfig,
sdu2,
100);
msg->du2cu_rrc_container,
1024); //sizeof(msg->du2cu_rrc_container));
int sdu2_len = (enc_rval.encoded+7)/8;
if (enc_rval.encoded == -1) {
LOG_E(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,
CC_id,
UE_id,
rntiP,
sduP,
sdu_lenP,
(const int8_t*)sdu2,
sdu2_len
);
msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8;
msg->crnti=rntiP;
msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized()
memcpy(msg->rrc_container, sduP, sdu_lenP);
msg->rrc_container_length=sdu_lenP;
itti_send_msg_to_task(TASK_DU_F1, 0, tmp);
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
return(0);
}
@@ -383,3 +389,17 @@ void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP,
LOG_D(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
void nr_mac_gNB_rrc_ul_failure_reset(const module_id_t Mod_instP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_instP], rntiP);
if (ue_context_p != NULL) {
LOG_W(RRC,"Frame %d, Subframe %d: UE %x UL failure reset, deactivating timer\n",frameP,subframeP,rntiP);
ue_context_p->ue_context.ul_failure_timer=0;
} else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure reset: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
+220 -139
View File
@@ -39,6 +39,7 @@
#include <asn_application.h>
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
#include <per_encoder.h>
#include <nr/nr_common.h>
#include "asn1_msg.h"
#include "../nr_rrc_proto.h"
@@ -297,15 +298,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
) {
asn_enc_rval_t enc_rval;
// TODO : Add support for more than one PLMN
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn);
NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);;
memset(nr_plmn,0,sizeof(struct NR_PLMN_Identity) * num_plmn);
memset(nr_mcc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
memset(nr_mnc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
carrier->siblock1 = sib1_message;
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
@@ -317,51 +309,52 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
// cellSelectionInfo
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
// Fixme: should be in config file
//The IE Q-RxLevMin is used to indicate for cell selection/ re-selection the required minimum received RSRP level in the (NR) cell.
//Corresponds to parameter Qrxlevmin in TS38.304.
//Actual value Qrxlevmin = field value * 2 [dBm].
sib1->cellSelectionInfo->q_RxLevMin = -65;
// cellAccessRelatedInfo
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
// TODO : Add support for more than one PLMN
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info);
for (int i = 0; i < num_plmn; ++i) {
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
asn_set_empty(&nr_plmn[i].mcc->list);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
if(configuration->mnc_digit_length[i] == 3) nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
nr_plmn[i].mnc.list.size=0;
nr_plmn[i].mnc.list.count=0;
if(configuration->mnc_digit_length[i] == 3) ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn);
asn1cCalloc(nr_plmn->mcc, mcc);
int confMcc=configuration->mcc[i];
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0);
*mcc0=(confMcc/100)%10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc1);
*mcc1=(confMcc/10)%10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc2);
*mcc2=confMcc%10;
int mnc=configuration->mnc[i];
if(configuration->mnc_digit_length[i] == 3) {
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0);
*mnc0=(configuration->mnc[i]/100)%10;
mnc/=10;
}
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1);
*mnc1=(mnc/10)%10;
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc2);
*mnc2=(mnc)%10;
}//end plmn loop
nr_plmn_info->cellIdentity.buf = CALLOC(1,5);
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 28) & 0xff;
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 20) & 0xff;
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 12) & 0xff;
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity >> 4) & 0xff;
nr_plmn_info->cellIdentity.buf[4]= (configuration->cell_identity << 4) & 0xff;
nr_plmn_info->cellIdentity.size= 5;
nr_plmn_info->cellIdentity.bits_unused= 4;
uint64_t tmp=htobe64(configuration->cell_identity)<<4;
memcpy(nr_plmn_info->cellIdentity.buf, ((char*)&tmp)+3, 5);
nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
nr_plmn_info->trackingAreaCode = CALLOC(1,sizeof(NR_TrackingAreaCode_t));
uint32_t tmp2=htobe32(configuration->tac);
nr_plmn_info->trackingAreaCode->buf = CALLOC(1,3);
nr_plmn_info->trackingAreaCode->buf[0] = ( ((uint32_t)configuration->tac) >> 16) & 0xff;
nr_plmn_info->trackingAreaCode->buf[1] = ( ((uint32_t)configuration->tac) >> 8) & 0xff;
nr_plmn_info->trackingAreaCode->buf[2] = ( ((uint32_t)configuration->tac) >> 0) & 0xff;
memcpy(nr_plmn_info->trackingAreaCode->buf, ((char*) &tmp2)+1, 3);
nr_plmn_info->trackingAreaCode->size = 3;
nr_plmn_info->trackingAreaCode->bits_unused = 0;
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
// connEstFailureControl
// TODO: add connEstFailureControl
@@ -397,19 +390,19 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
// servingCellConfigCommon
sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB));
asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom);
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP;
initialDownlinkBWP->genericParameters=
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list);
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list);
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.cyclicPrefix = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix;
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) {
struct NR_NR_MultiBandInfo *nrMultiBandInfo = CALLOC(1,sizeof(struct NR_NR_MultiBandInfo));
asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,
struct NR_NR_MultiBandInfo, nrMultiBandInfo);
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo);
}
int scs_scaling0 = 1<<(configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing);
int scs_scaling = scs_scaling0;
int scs_scaling2 = scs_scaling0;
@@ -432,17 +425,19 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
absolute_diff,scs_scaling2,scs_scaling,(int)sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA);
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
ASN_SEQUENCE_ADD(&ServCellCom->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,
configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
}
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list);
initialDownlinkBWP->pdcch_ConfigCommon =
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList =
CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
NR_SearchSpace_t *ss1 = calloc(1,sizeof(*ss1));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss1);
ss1->searchSpaceId = 1;
ss1->controlResourceSetId=calloc(1,sizeof(*ss1->controlResourceSetId));
*ss1->controlResourceSetId=0;
asn1cCallocOne(ss1->controlResourceSetId, 0);
ss1->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss1->monitoringSlotPeriodicityAndOffset));
ss1->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
ss1->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss1->monitoringSymbolsWithinSlot));
@@ -462,9 +457,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss1->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss1->searchSpaceType->choice.common=calloc(1,sizeof(*ss1->searchSpaceType->choice.common));
ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss1);
NR_SearchSpace_t *ss5 = calloc(1,sizeof(*ss5));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss5);
ss5->searchSpaceId = 5;
ss5->controlResourceSetId=calloc(1,sizeof(*ss5->controlResourceSetId));
*ss5->controlResourceSetId=0;
@@ -490,9 +485,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss5->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss5->searchSpaceType->choice.common=calloc(1,sizeof(*ss5->searchSpaceType->choice.common));
ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss5);
NR_SearchSpace_t *ss7 = calloc(1,sizeof(*ss7));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss7);
ss7->searchSpaceId = 7;
ss7->controlResourceSetId=calloc(1,sizeof(*ss7->controlResourceSetId));
*ss7->controlResourceSetId=0;
@@ -515,63 +510,59 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss7->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss7->searchSpaceType->choice.common=calloc(1,sizeof(*ss7->searchSpaceType->choice.common));
ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss7);
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = 7;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = 5;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = 1;
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1, 0);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5);
asn1cCallocOne( initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1);
initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256;
ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT;
ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1;
ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one;
asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO,
P0);
P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO = calloc(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT,
Z8);
asn1cSequenceAdd(Z8->list,
long,
ZoneEight);
asn1cCallocOne(ZoneEight, 0);
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = CALLOC(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT));
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list);
long *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = calloc(1,sizeof(long));
*sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = 0;
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list,sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT);
sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB));
asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list);
asn1cCalloc(ServCellCom->uplinkConfigCommon, UL)
asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list);
for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list,
configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
}
sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = CALLOC(1,sizeof(NR_P_Max_t));
*sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = 23;
asn1cCallocOne(UL->frequencyInfoUL.p_Max, 23);
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
UL->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
UL->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
UL->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null;
UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
UL->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity;
sib1->servingCellConfigCommon->uplinkConfigCommon->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity;
ServCellCom->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset;
sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t));
ServCellCom->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t));
uint8_t bitmap8,temp_bitmap=0;
switch (configuration->scc->ssb_PositionsInBurst->present) {
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap;
ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap;
break;
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap;
ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap;
break;
/*
groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1.
@@ -582,14 +573,13 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
(i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted.
*/
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.size = 1;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.bits_unused = 0;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t));
memset(sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence, 0, sizeof(BIT_STRING_t));
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->size = 1;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->bits_unused = 0;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t));
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] = 0;
ServCellCom->ssb_PositionsInBurst.inOneGroup.size = 1;
ServCellCom->ssb_PositionsInBurst.inOneGroup.bits_unused = 0;
ServCellCom->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t));
ServCellCom->ssb_PositionsInBurst.groupPresence->size = 1;
ServCellCom->ssb_PositionsInBurst.groupPresence->bits_unused = 0;
ServCellCom->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t));
ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] = 0;
for (int i=0; i<8; i++){
bitmap8 = configuration->scc->ssb_PositionsInBurst->choice.longBitmap.buf[i];
if (bitmap8!=0){
@@ -598,8 +588,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
else
AssertFatal(temp_bitmap==bitmap8,"For longBitmap the groups of 8 SSBs containing at least 1 transmitted SSB should be all the same\n");
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i);
ServCellCom->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8;
ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i);
}
}
break;
@@ -608,12 +598,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
break;
}
sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon));
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2;
sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower;
ServCellCom->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell;
ServCellCom->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon));
ServCellCom->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2;
ServCellCom->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower;
// ims-EmergencySupport
// TODO: add ims-EmergencySupport
@@ -987,10 +977,42 @@ uint8_t do_RRCReject(uint8_t Mod_id,
return((enc_rval.encoded+7)/8);
}
// TODO: Implement to b_SRS = 1 and b_SRS = 2
long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) {
if(b_SRS>0) {
LOG_E(NR_RRC,"rrc_get_max_nr_csrs(): Not implemented yet for b_SRS>0\n");
return 0; // This c_srs is always valid
}
const uint16_t m_SRS[64] = { 4, 8, 12, 16, 16, 20, 24, 24, 28, 32, 36, 40, 48, 48, 52, 56, 60, 64, 72, 72, 76, 80, 88,
96, 96, 104, 112, 120, 120, 120, 128, 128, 128, 132, 136, 144, 144, 144, 144, 152, 160,
160, 160, 168, 176, 184, 192, 192, 192, 192, 208, 216, 224, 240, 240, 240, 240, 256, 256,
256, 264, 272, 272, 272 };
long c_srs = 0;
uint16_t m = 4;
for(int c = 1; c<64; c++) {
if(m_SRS[c]>m && m_SRS[c]<max_rbs) {
c_srs = c;
m = m_SRS[c];
}
}
return c_srs;
}
void fill_initial_SpCellConfig(rnti_t rnti,
int uid,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier) {
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n");
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
SpCellConfig->servCellIndex = NULL;
SpCellConfig->reconfigurationWithSync = NULL;
@@ -1069,7 +1091,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList));
NR_PUSCH_PathlossReferenceRS_t *plrefRS = calloc(1,sizeof(*plrefRS));
plrefRS->pusch_PathlossReferenceRS_Id=0;
plrefRS->referenceSignal.present = NR_PathlossReferenceRS_Config_PR_ssb_Index;
plrefRS->referenceSignal.present = NR_PUSCH_PathlossReferenceRS__referenceSignal_PR_ssb_Index;
plrefRS->referenceSignal.choice.ssb_Index = 0;
ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,plrefRS);
pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL;
@@ -1116,13 +1138,21 @@ void fill_initial_SpCellConfig(rnti_t rnti,
*srs_resset0_id=0;
ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id);
srs_Config->srs_ResourceToReleaseList=NULL;
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
if(carrier->do_SRS) {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic;
srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic));
srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL;
} else {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
}
srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook;
srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha));
*srs_resset0->alpha = NR_Alpha_alpha1;
@@ -1141,17 +1171,28 @@ void fill_initial_SpCellConfig(rnti_t rnti,
srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
srs_res0->transmissionComb.choice.n2->combOffset_n2=0;
srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0;
srs_res0->resourceMapping.startPosition=2;
srs_res0->resourceMapping.startPosition = 2 + uid%2;
srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1;
srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
srs_res0->freqDomainPosition=0;
srs_res0->freqDomainShift=0;
srs_res0->freqHopping.c_SRS = 0;
srs_res0->freqHopping.b_SRS=0;
srs_res0->freqHopping.b_hop=0;
srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs(
NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275),
srs_res0->freqHopping.b_SRS);
srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
if(carrier->do_SRS) {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic;
srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic));
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160;
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots
} else {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
}
srs_res0->sequenceId=40;
srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo));
srs_res0->spatialRelationInfo->servingCellId=NULL;
@@ -1185,9 +1226,9 @@ void fill_initial_SpCellConfig(rnti_t rnti,
long *delay[8];
for (int i=0;i<8;i++) {
delay[i] = calloc(1,sizeof(*delay[i]));
AssertFatal(carrier->minRXTXTIMEpdsch >=2 && carrier->minRXTXTIMEpdsch <7,
"check minRXTXTIMEpdsch %d\n",carrier->minRXTXTIMEpdsch);
*delay[i] = (i+carrier->minRXTXTIMEpdsch);
AssertFatal(carrier->minRXTXTIME >=2 && carrier->minRXTXTIME <7,
"check minRXTXTIME %d\n",carrier->minRXTXTIME);
*delay[i] = (i+carrier->minRXTXTIME);
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
}
@@ -1401,6 +1442,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
}
void fill_initial_cellGroupConfig(rnti_t rnti,
int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier) {
@@ -1494,7 +1536,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig));
fill_initial_SpCellConfig(rnti,cellGroupConfig->spCellConfig,scc,carrier);
fill_initial_SpCellConfig(rnti,uid,cellGroupConfig->spCellConfig,scc,carrier);
cellGroupConfig->sCellToAddModList = NULL;
cellGroupConfig->sCellToReleaseList = NULL;
@@ -1573,7 +1615,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
}
else {
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc,carrier);
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,ue_context_pP->local_uid,cellGroupConfig,scc,carrier);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
@@ -1771,6 +1813,7 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t do_NR_RRCRelease(uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id) {
asn_enc_rval_t enc_rval;
NR_DL_DCCH_Message_t dl_dcch_msg;
@@ -1796,7 +1839,7 @@ uint8_t do_NR_RRCRelease(uint8_t *buffer,
NULL,
(void *)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
@@ -1809,6 +1852,7 @@ uint8_t do_NR_RRCRelease(uint8_t *buffer,
int16_t do_RRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
NR_SRB_ToAddModList_t *SRB_configList,
NR_DRB_ToAddModList_t *DRB_configList,
@@ -1904,7 +1948,7 @@ int16_t do_RRCReconfiguration(
NULL,
(void *)&dl_dcch_msg,
buffer,
1000);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -1929,7 +1973,7 @@ int16_t do_RRCReconfiguration(
}
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv) {
asn_enc_rval_t enc_rval;
uint8_t buf[5],buf2=0;
NR_UL_CCCH_Message_t ul_ccch_msg;
@@ -1973,16 +2017,51 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
NULL,
(void *)&ul_ccch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
//------------------------------------------------------------------------------
uint8_t
do_NR_RRCReconfigurationComplete_for_nsa(
uint8_t *buffer,
size_t buffer_size,
NR_RRC_TransactionIdentifier_t Transaction_id
)
//------------------------------------------------------------------------------
{
NR_RRCReconfigurationComplete_t rrc_complete_msg;
memset(&rrc_complete_msg, 0, sizeof(rrc_complete_msg));
rrc_complete_msg.rrc_TransactionIdentifier = Transaction_id;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete =
CALLOC(1, sizeof(*rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete));
rrc_complete_msg.criticalExtensions.present =
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->lateNonCriticalExtension = NULL;
if (0) {
xer_fprint(stdout, &asn_DEF_NR_RRCReconfigurationComplete, (void *)&rrc_complete_msg);
}
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RRCReconfigurationComplete,
NULL,
(void *)&rrc_complete_msg,
buffer,
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
LOG_A(NR_RRC, "rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
//------------------------------------------------------------------------------
uint8_t
do_NR_RRCReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id
)
//------------------------------------------------------------------------------
@@ -2010,14 +2089,15 @@ do_NR_RRCReconfigurationComplete(
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
LOG_I(NR_RRC,"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, uint8_t sel_plmn_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS){
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
const uint8_t Transaction_id, uint8_t sel_plmn_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS){
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
@@ -2060,7 +2140,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal(enc_rval.encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name,enc_rval.encoded);
LOG_D(NR_RRC,"RRCSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
@@ -2175,6 +2255,7 @@ const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t *const buffer,
size_t buffer_size,
//const uint8_t transmission_mode,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList
@@ -2297,7 +2378,7 @@ NR_SRB_ToAddModList_t **SRB_configList
}
uint8_t
do_RRCReestablishmentComplete(uint8_t *buffer, int64_t rrc_TransactionIdentifier) {
do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier) {
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
NR_RRCReestablishmentComplete_t *rrcReestablishmentComplete;
@@ -2323,7 +2404,7 @@ do_RRCReestablishmentComplete(uint8_t *buffer, int64_t rrc_TransactionIdentifier
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCReestablishmentComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
+32 -13
View File
@@ -28,6 +28,8 @@
* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr, kroempa@gmail.com
*/
#pragma once
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h> /* for atoi(3) */
@@ -53,6 +55,15 @@
*/
int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
#define asn1cCallocOne(VaR, VaLue) \
VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue;
#define asn1cCalloc(VaR, lOcPtr) \
typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR));
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \
TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \
ASN_SEQUENCE_ADD(&VaR,lOcPtr);
uint8_t do_MIB_NR(gNB_RRC_INST *rrc,
uint32_t frame);
@@ -90,13 +101,15 @@ uint8_t do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer);
void fill_initial_SpCellConfig(rnti_t rnti,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
int uid,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier);
void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier);
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb);
@@ -119,12 +132,13 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
const uint8_t Transaction_id);
uint8_t do_NR_RRCRelease(uint8_t *buffer,
uint8_t do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size,
uint8_t Transaction_id);
int16_t do_RRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
NR_SRB_ToAddModList_t *SRB_configList,
NR_DRB_ToAddModList_t *DRB_configList,
@@ -135,19 +149,23 @@ int16_t do_RRCReconfiguration(
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig);
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer,
const uint8_t Transaction_id,
uint8_t sel_plmn_id,
const int dedicatedInfoNASLength,
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id,
uint8_t sel_plmn_id,
const int dedicatedInfoNASLength,
const char *dedicatedInfoNAS);
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv);
uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_size, NR_RRC_TransactionIdentifier_t Transaction_id);
uint8_t do_NR_RRCReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id
);
@@ -172,6 +190,7 @@ do_RRCReestablishment(
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t *const buffer,
size_t buffer_size,
//const uint8_t transmission_mode,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList
@@ -179,6 +198,6 @@ do_RRCReestablishment(
uint8_t
do_RRCReestablishmentComplete(
uint8_t *buffer,
uint8_t *buffer, size_t buffer_size,
int64_t rrc_TransactionIdentifier);
+71 -88
View File
@@ -29,96 +29,79 @@
*/
#include "nr_rrc_config.h"
#include "common/utils/nr/nr_common.h"
void rrc_config_rlc_bearer(uint8_t Mod_id,
int CC_id,
rlc_bearer_config_t *rlc_config
){
rlc_config->LogicalChannelIdentity[CC_id] = 0;
rlc_config->servedRadioBearer_present[CC_id] = 0;
rlc_config->srb_Identity[CC_id] = 0;
rlc_config->drb_Identity[CC_id] = 0;
rlc_config->reestablishRLC[CC_id] = 0;
rlc_config->rlc_Config_present[CC_id] = 0;
rlc_config->ul_AM_sn_FieldLength[CC_id] = 0;
rlc_config->t_PollRetransmit[CC_id] = 0;
rlc_config->pollPDU[CC_id] = 0;
rlc_config->pollByte[CC_id] = 0;
rlc_config->maxRetxThreshold[CC_id] = 0;
rlc_config->dl_AM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_AM_t_Reassembly[CC_id] = 0;
rlc_config->t_StatusProhibit[CC_id] = 0;
rlc_config->ul_UM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_UM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_UM_t_Reassembly[CC_id] = 0;
rlc_config->priority[CC_id] = 0;
rlc_config->prioritisedBitRate[CC_id] = 0;
rlc_config->bucketSizeDuration[CC_id] = 0;
rlc_config->allowedServingCells[CC_id] = 0;
rlc_config->subcarrierspacing[CC_id] = 0;
rlc_config->maxPUSCH_Duration[CC_id] = 0;
rlc_config->configuredGrantType1Allowed[CC_id] = 0;
rlc_config->logicalChannelGroup[CC_id] = 0;
rlc_config->schedulingRequestID[CC_id] = 0;
rlc_config->logicalChannelSR_Mask[CC_id] = 0;
rlc_config->logicalChannelSR_DelayTimerApplied[CC_id] = 0;
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
// setting default TDA for DL with
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,13); // basic slot configuration starting in symbol 1 til the end of the slot
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
if(frame_type==TDD) {
// TDD
if(scc->tdd_UL_DL_ConfigurationCommon) {
int dl_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols;
if(dl_symb > 1) {
timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,dl_symb-1); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
}
}
}
}
void rrc_config_mac_cellgroup(uint8_t Mod_id,
int CC_id,
mac_cellgroup_t *mac_cellgroup_config
){
mac_cellgroup_config->DRX_Config_PR[CC_id] = 0;
mac_cellgroup_config->drx_onDurationTimer_PR[CC_id] = 0;
mac_cellgroup_config->subMilliSeconds[CC_id] = 0;
mac_cellgroup_config->milliSeconds[CC_id] = 0;
mac_cellgroup_config->drx_InactivityTimer[CC_id] = 0;
mac_cellgroup_config->drx_HARQ_RTT_TimerDL[CC_id] = 0;
mac_cellgroup_config->drx_HARQ_RTT_TimerUL[CC_id] = 0;
mac_cellgroup_config->drx_RetransmissionTimerDL[CC_id] = 0;
mac_cellgroup_config->drx_RetransmissionTimerUL[CC_id] = 0;
mac_cellgroup_config->drx_LongCycleStartOffset_PR[CC_id] = 0;
mac_cellgroup_config->drx_LongCycleStartOffset[CC_id] = 0;
mac_cellgroup_config->drx_ShortCycle[CC_id] = 0;
mac_cellgroup_config->drx_ShortCycleTimer[CC_id] = 0;
mac_cellgroup_config->drx_SlotOffset[CC_id] = 0;
mac_cellgroup_config->schedulingRequestId[CC_id] = 0;
mac_cellgroup_config->sr_ProhibitTimer[CC_id] = 0;
mac_cellgroup_config->sr_TransMax[CC_id] = 0;
mac_cellgroup_config->periodicBSR_Timer[CC_id] = 0;
mac_cellgroup_config->retxBSR_Timer[CC_id] = 0;
mac_cellgroup_config->logicalChannelSR_DelayTimer[CC_id] = 0;
mac_cellgroup_config->tag_Id[CC_id] = 0;
mac_cellgroup_config->timeAlignmentTimer[CC_id] = 0;
mac_cellgroup_config->PHR_Config_PR[CC_id] = 0;
mac_cellgroup_config->phr_PeriodicTimer[CC_id] = 0;
mac_cellgroup_config->phr_ProhibitTimer[CC_id] = 0;
mac_cellgroup_config->phr_Tx_PowerFactorChange[CC_id] = 0;
mac_cellgroup_config->multiplePHR[CC_id] = 0;
mac_cellgroup_config->phr_Type2SpCell[CC_id] = 0;
mac_cellgroup_config->phr_Type2OtherCell[CC_id] = 0;
mac_cellgroup_config->phr_ModeOtherCG[CC_id] = 0;
mac_cellgroup_config->skipUplinkTxDynamic[CC_id] = 0;
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){
//TODO change to accomodate for SRS
int temp_min_delay = 6; // k2 = 2 or 3 won'r work as well as higher values
int k2 = (min_fb_delay<temp_min_delay)?temp_min_delay:min_fb_delay;
uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3
int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation->k2 = k2;
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(0,13); // basic slot configuration starting in symbol 0 til the last but one symbol
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
if(frame_type==TDD) {
// TDD
if(scc->tdd_UL_DL_ConfigurationCommon) {
int ul_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation->k2 = k2;
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
// for msg3 in the mixed slot
int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
int nb_slots_per_period = ((1<<mu) * 10)/nb_periods_per_frame;
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation_msg3 = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation_msg3->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation_msg3->k2 = nb_slots_per_period - DELTA[mu];
if(*pusch_timedomainresourceallocation_msg3->k2 < min_fb_delay)
*pusch_timedomainresourceallocation_msg3->k2 += nb_slots_per_period;
AssertFatal(*pusch_timedomainresourceallocation_msg3->k2<33,"Computed k2 for msg3 %ld is larger than the range allowed by RRC (0..32)\n",
*pusch_timedomainresourceallocation_msg3->k2);
pusch_timedomainresourceallocation_msg3->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation_msg3->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation_msg3);
}
}
}
void rrc_config_physicalcellgroup(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
){
physicalcellgroup_config->harq_ACK_SpatialBundlingPUCCH[CC_id] = 0;
physicalcellgroup_config->harq_ACK_SpatialBundlingPUSCH[CC_id] = 0;
physicalcellgroup_config->p_NR[CC_id] = 0;
physicalcellgroup_config->pdsch_HARQ_ACK_Codebook[CC_id] = 0;
physicalcellgroup_config->tpc_SRS_RNTI[CC_id] = 0;
physicalcellgroup_config->tpc_PUCCH_RNTI[CC_id] = 0;
physicalcellgroup_config->tpc_PUSCH_RNTI[CC_id] = 0;
physicalcellgroup_config->sp_CSI_RNTI[CC_id] = 0;
physicalcellgroup_config->RNTI_Value[CC_id] = 0;
}
void rrc_config_rachdedicated(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
){
}
+2 -23
View File
@@ -111,29 +111,8 @@ typedef struct physicalcellgroup_s{
long RNTI_Value[MAX_NUM_CCs];
}physicalcellgroup_t;
typedef struct rach_dedicated_s{
}rach_dedicated_t;
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc);
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay);
void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
int CC_id,
gNB_RrcConfigurationReq *common_configuration
);
void rrc_config_rlc_bearer(uint8_t Mod_id,
int CC_id,
rlc_bearer_config_t *rlc_config
);
void rrc_config_mac_cellgroup(uint8_t Mod_id,
int CC_id,
mac_cellgroup_t *mac_cellgroup_config
);
void rrc_config_physicalcellgroup(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
);
#endif
+10 -5
View File
@@ -123,12 +123,12 @@ typedef enum UE_STATE_NR_e {
#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n)
#define RRM_CALLOC2(t,s) (t *) malloc16( s )
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 8192
#define RRC_BUF_SIZE 512
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20
@@ -367,6 +367,8 @@ typedef struct gNB_RRC_UE_s {
transport_layer_addr_t gnb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t gnb_gtp_ebi[S1AP_MAX_E_RAB];
rb_id_t gnb_gtp_psi[S1AP_MAX_E_RAB];
//GTPV1 F1-U TUNNELS
uint32_t incoming_teid[S1AP_MAX_E_RAB];
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
@@ -447,8 +449,9 @@ typedef struct {
int sib1_tda;
int pdsch_AntennaPorts;
int pusch_AntennaPorts;
int minRXTXTIMEpdsch;
int minRXTXTIME;
int do_CSIRS;
int do_SRS;
NR_BCCH_DL_SCH_Message_t *siblock1;
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1;
@@ -521,6 +524,8 @@ typedef struct gNB_RRC_INST_s {
int cell_info_configured;
pthread_mutex_t cell_info_mutex;
char *uecap_file;
// security configuration (preferred algorithms)
nr_security_configuration_t security;
} gNB_RRC_INST;
+4
View File
@@ -79,7 +79,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
int scg_id,
int servCellIndex,
int dl_antenna_ports,
int minRXTXTIMEpdsch,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid);
@@ -90,7 +92,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
int dl_antenna_ports,
int minRXTXTIMEpdsch,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid);
+580 -201
View File
@@ -47,6 +47,12 @@
#include "NR_BCCH-BCH-Message.h"
#include "NR_UL-DCCH-Message.h"
#include "NR_DL-DCCH-Message.h"
#include "NR_DL-CCCH-Message.h"
#include "NR_UL-CCCH-Message.h"
#include "NR_RRCReject.h"
#include "NR_RejectWaitTime.h"
#include "NR_RRCSetup.h"
#include "NR_CellGroupConfig.h"
#include "NR_MeasResults.h"
#include "LTE_UECapabilityInformation.h"
@@ -88,6 +94,7 @@
#include "executables/softmodem-common.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair2/X2AP/x2ap_eNB.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "BIT_STRING.h"
#include "assertions.h"
@@ -125,6 +132,23 @@ uint8_t first_rrcreconfiguration = 0;
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP,
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP,
const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id) {
// The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue
mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__);
memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP);
du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu);
return true;
}
void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1);
@@ -136,80 +160,6 @@ void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
void rrc_gNB_process_SgNBAdditionRequest(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP
) {
rrc_gNB_generate_SgNBAdditionRequestAcknowledge(ctxt_pP,ue_context_pP);
}
void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP) {
//uint8_t size;
//uint8_t buffer[100];
//int CC_id = ue_context_pP->ue_context.primaryCC_id;
//OCTET_STRING_t *secondaryCellGroup;
NR_CellGroupConfig_t *cellGroupconfig;
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList;
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig;
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig;
struct NR_SpCellConfig *spCellConfig;
//struct NR_CellGroupConfig__sCellToAddModList *sCellToAddModList;
cellGroupconfig = CALLOC(1,sizeof(NR_CellGroupConfig_t));
cellGroupconfig->rlc_BearerToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
cellGroupconfig->mac_CellGroupConfig = CALLOC(1,sizeof(struct NR_MAC_CellGroupConfig));
cellGroupconfig->physicalCellGroupConfig = CALLOC(1,sizeof(struct NR_PhysicalCellGroupConfig));
cellGroupconfig->spCellConfig = CALLOC(1,sizeof(struct NR_SpCellConfig));
//cellGroupconfig->sCellToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__sCellToAddModList));
rlc_BearerToAddModList = cellGroupconfig->rlc_BearerToAddModList;
mac_CellGroupConfig = cellGroupconfig->mac_CellGroupConfig;
physicalCellGroupConfig = cellGroupconfig->physicalCellGroupConfig;
spCellConfig = cellGroupconfig->spCellConfig;
//sCellToAddModList = cellGroupconfig->sCellToAddModList;
rlc_bearer_config_t *rlc_config;
rlc_config = CALLOC(1,sizeof(rlc_bearer_config_t));
//Fill rlc_bearer config value
rrc_config_rlc_bearer(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
rlc_config
);
//Fill rlc_bearer config to structure
do_RLC_BEARER(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
rlc_BearerToAddModList,
rlc_config);
mac_cellgroup_t *mac_cellgroup_config;
mac_cellgroup_config = CALLOC(1,sizeof(mac_cellgroup_t));
//Fill mac_cellgroup_config config value
rrc_config_mac_cellgroup(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
mac_cellgroup_config
);
//Fill mac_cellgroup config to structure
do_MAC_CELLGROUP(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
mac_CellGroupConfig,
mac_cellgroup_config);
physicalcellgroup_t *physicalcellgroup_config;
physicalcellgroup_config = CALLOC(1,sizeof(physicalcellgroup_t));
//Fill physicalcellgroup_config config value
rrc_config_physicalcellgroup(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
physicalcellgroup_config
);
//Fill physicalcellgroup config to structure
do_PHYSICALCELLGROUP(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
physicalCellGroupConfig,
physicalcellgroup_config);
do_SpCellConfig(RC.nrrrc[ctxt_pP->module_id],
spCellConfig);
}
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) {
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
@@ -252,56 +202,12 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
pthread_mutex_unlock(&rrc->cell_info_mutex);
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
fd = fopen("uecap.raw","r");
if (fd != NULL) {
char buffer[4096];
int msg_len=fread(buffer,1,4096,fd);
LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len);
LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_UL_DCCH_Message,
(void **)&LTE_UL_DCCH_Message,
(uint8_t *)buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 );
return;
}
fclose(fd);
xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message);
// recreate enough of X2 EN-DC Container
AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation,
"ueCapabilityInformation not present\n");
NR_CG_ConfigInfo_t *CG_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo));
CG_ConfigInfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1;
CG_ConfigInfo->criticalExtensions.choice.c1 = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1));
CG_ConfigInfo->criticalExtensions.choice.c1->present = NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo;
CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo));
NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo;
cg_ConfigInfo->ue_CapabilityInfo = calloc(1,sizeof(*cg_ConfigInfo->ue_CapabilityInfo));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,
(void *)&LTE_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,buffer,4096);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
OCTET_STRING_fromBuf(cg_ConfigInfo->ue_CapabilityInfo,
(const char *)buffer,
(enc_rval.encoded+7)>>3);
parse_CG_ConfigInfo(rrc,CG_ConfigInfo,NULL);
} else {
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
}
}
@@ -330,9 +236,11 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset;
rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts;
rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts;
rrc->carrier.minRXTXTIMEpdsch = configuration->minRXTXTIMEpdsch;
rrc->carrier.minRXTXTIME = configuration->minRXTXTIME;
rrc->carrier.sib1_tda = configuration->sib1_tda;
rrc->carrier.do_CSIRS = configuration->do_CSIRS;
rrc->carrier.do_SRS = configuration->do_SRS;
nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME);
/// System Information INIT
pthread_mutex_init(&rrc->cell_info_mutex,NULL);
rrc->cell_info_configured = 0;
@@ -365,6 +273,8 @@ void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo,
"ueCapabilityInformation not present\n");
parse_CG_ConfigInfo(rrc,cg_configinfo,m);
LOG_A(NR_RRC, "Successfully parsed CG_ConfigInfo of size %zu bits. (%zu bytes)\n",
dec_rval.consumed, (dec_rval.consumed +7/8));
}
@@ -398,7 +308,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
nr_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_pP->ue_context.SRB_configList,
NULL,
ue_context_pP->ue_context.DRB_configList,
NULL,
NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
@@ -708,7 +618,7 @@ rrc_gNB_process_RRCSetupComplete(
)
//-----------------------------------------------------------------------------
{
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
LOG_A(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1;
@@ -839,8 +749,8 @@ rrc_gNB_generate_defaultRRCReconfiguration(
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer,
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
NULL, //*SRB_configList2,
NULL, //*DRB_configList,
@@ -1107,11 +1017,11 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup,
rrc->um_on_default_drb);
size = do_RRCReconfiguration(ctxt_pP, buffer,
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
*SRB_configList2,
*DRB_configList,
@@ -1219,8 +1129,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
LOG_W(NR_RRC,"dedlicated NAS list is empty\n");
}
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer, xid,
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer), xid,
NULL,
NULL,
*DRB_Release_configList2,
@@ -1299,7 +1209,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
NR_DRB_Identity_t *drb_id_p = NULL;
// uint8_t nr_DRB2LCHAN[8];
// uint8_t nr_DRB2LCHAN[8];
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
@@ -1363,6 +1273,49 @@ rrc_gNB_process_RRCReconfigurationComplete(
NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
}
else if(SRB_configList!=NULL || DRB_configList!=NULL){
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);
req->gNB_CU_ue_id = 0;
req->gNB_DU_ue_id = 0;
req->rnti = ue_context_pP->ue_context.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;
if(SRB_configList!=NULL){
req->srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t));
req->srbs_to_be_setup_length = SRB_configList->list.count;
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
for (int i = 0; i < SRB_configList->list.count; i++){
if(SRB_configList->list.array[i]->srb_Identity > 1){
SRBs[i].srb_id = SRB_configList->list.array[i]->srb_Identity;
SRBs[i].lcid = SRB_configList->list.array[i]->srb_Identity;
}
}
}
if(DRB_configList!=NULL){
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t));
req->drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
req->drbs_to_be_setup_length = DRB_configList->list.count;
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, req->drbs_to_be_setup_length);
for (int i = 0; i < DRB_configList->list.count; i++){
DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
DRBs[i].rlc_mode = RLC_MODE_AM;
DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd;
DRBs[i].up_ul_tnl_length = 1;
DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr);
DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd;
DRBs[i].up_dl_tnl_length = 1;
}
LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
}
#endif
/* Set the SRB active in UE context */
@@ -1396,7 +1349,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
for (int i = 0; i < DRB_configList->list.count; i++) {
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n",
LOG_A(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rnti,
@@ -1487,6 +1440,7 @@ rrc_gNB_generate_RRCReestablishment(
ue_context_pP,
CC_id,
(uint8_t *) ue_context->Srb0.Tx_buffer.Payload,
sizeof(ue_context->Srb0.Tx_buffer.Payload),
//(uint8_t) carrier->p_gNB, // at this point we do not have the UE capability information, so it can only be TM1 or TM2
rrc_gNB_get_next_transaction_identifier(module_id),
SRB_configList
@@ -1672,11 +1626,11 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
if (ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_ESTABLISHED || ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_DONE) {
create_tunnel_req.pdusession_id[j] = ue_context_pP->ue_context.pduSession[i].param.pdusession_id;
create_tunnel_req.incoming_rb_id[j] = i+1;
create_tunnel_req.upf_NGu_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid;
memcpy(create_tunnel_req.upf_addr[j].buffer,
create_tunnel_req.outgoing_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid;
memcpy(create_tunnel_req.dst_addr[j].buffer,
ue_context_pP->ue_context.pduSession[i].param.upf_addr.buffer,
sizeof(uint8_t)*20);
create_tunnel_req.upf_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length;
create_tunnel_req.dst_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length;
j++;
}
}
@@ -1742,9 +1696,9 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
i, ue_context_pP->ue_context.pduSession[i].status, "PDU_SESSION_STATUS_DONE");
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer,
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
*SRB_configList2,
DRB_configList,
@@ -2737,16 +2691,19 @@ rrc_gNB_decode_dcch(
void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name);
int cu_cell_ind = 0;
MessageDef *msg_p = NULL,*msg_p2=NULL;
MessageDef *msg_p =itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
MessageDef *msg_p2=itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
for (int i = 0; i < f1_setup_req->num_cells_available; i++) {
int found_cell=0;
for (int j=0; j<RC.nb_nr_inst; j++) {
gNB_RRC_INST *rrc = RC.nrrrc[j];
if (rrc->configuration.mcc[0] == f1_setup_req->mcc[i] &&
rrc->configuration.mnc[0] == f1_setup_req->mnc[i] &&
rrc->nr_cellid == f1_setup_req->nr_cellid[i]) {
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) {
//fixme: multi instance is not consistent here
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
// check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i];
@@ -2759,7 +2716,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
f1_setup_req->mib[i],
f1_setup_req->mib_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
"[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
NR_BCCH_BCH_Message_t *mib = &rrc->carrier.mib;
@@ -2789,27 +2746,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
AssertFatal(bcch_message->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
"bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
rrc->carrier.physCellId = f1_setup_req->nr_pci[i];
if (cu_cell_ind == 0) {
// prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE
if (msg_p == NULL) {
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
}
if (msg_p2 == NULL) {
msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
}
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
}
rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci;
int num_SI= 0;
if (rrc->carrier.SIB23) {
@@ -2820,22 +2764,20 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI;
cu_cell_ind++;
found_cell=1;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind;
// send
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n",
j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],
rrc->configuration.mnc[0], f1_setup_req->mnc[i],
rrc->nr_cellid, f1_setup_req->nr_cellid[i]);
j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc,
rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc,
rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid);
}
}// for (int j=0;j<RC.nb_inst;j++)
if (found_cell == 0) {
if (cu_cell_ind == 0) {
AssertFatal(1 == 0, "No cell found\n");
}
else {
} else {
// send ITTI message to F1AP-CU task
itti_send_msg_to_task (TASK_CU_F1, 0, msg_p);
@@ -2859,6 +2801,421 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC
rrc_remove_nsa_user(rrc, m->rnti);
}
static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_t instance) {
NRDuDlReq_t * req=&NRDuDlReq(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = req->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
if (req->srb_id == 0) {
NR_DL_CCCH_Message_t *dl_ccch_msg=NULL;
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message,
(void **)&dl_ccch_msg,
req->buf->data,
req->buf->size,0,0);
AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n");
switch (dl_ccch_msg->message.choice.c1->present) {
case NR_DL_CCCH_MessageType__c1_PR_NOTHING:
LOG_I(F1AP,"Received PR_NOTHING on DL-CCCH-Message\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
LOG_I(F1AP,"Logical Channel DL-CCCH (SRB0), Received RRCReject\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: {
LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCSetup RNTI %x\n",
req->rnti);
// Get configuration
NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup;
AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n");
NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup;
ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n");
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&ue_context_p->ue_context.masterCellGroup,
rrcSetup_ies->masterCellGroup.buf,
rrcSetup_ies->masterCellGroup.size,0,0);
AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n");
apply_macrlc_config(rrc,ue_context_p,&ctxt);
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n");
memcpy((void *)ue_p->Srb0.Tx_buffer.Payload,
(void *)req->buf->data,
req->buf->size); // ie->value.choice.RRCContainer.size
ue_p->Srb0.Tx_buffer.payload_size = req->buf->size;
break;
} // case
case NR_DL_CCCH_MessageType__c1_PR_spare2:
LOG_I(F1AP,
"Logical Channel DL-CCCH (SRB0), Received spare2\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_spare1:
LOG_I(F1AP,
"Logical Channel DL-CCCH (SRB0), Received spare1\n");
break;
default:
AssertFatal(1==0,
"Unknown message\n");
break;
}// switch case
return(0);
} else if (req->srb_id == 1) {
NR_DL_DCCH_Message_t *dl_dcch_msg=NULL;
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void **)&dl_dcch_msg,
&req->buf->data[2], // buf[0] includes the pdcp header
req->buf->size-6,0,0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed);
else
LOG_D(F1AP, "Received message: present %d and c1 present %d\n",
dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present);
if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
switch (dl_dcch_msg->message.choice.c1->present) {
case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n");
return 0;
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
// handle RRCReconfiguration
LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration RNTI %x\n",
req->rnti);
NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration;
if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
NR_RRCReconfiguration_IEs_t *rrcReconfiguration_ies =
rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
if (rrcReconfiguration_ies->measConfig != NULL) {
LOG_I(F1AP, "Measurement Configuration is present\n");
}
if (rrcReconfiguration_ies->radioBearerConfig) {
LOG_I(F1AP, "Radio Resource Configuration is present\n");
long drb_id;
int i;
NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList;
NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList;
// NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList;
// rrc_rlc_config_asn1_req
if (SRB_configList != NULL) {
for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
if (SRB_configList->list.array[i]->srb_Identity == 1 ) {
ue_context_p->ue_context.Srb1.Active=1;
} else if (SRB_configList->list.array[i]->srb_Identity == 2 ) {
ue_context_p->ue_context.Srb2.Active=1;
ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2;
LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id);
} else {
LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
SRB_configList->list.array[i]->srb_Identity);
}
}
}
if (DRB_configList != NULL) {
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(F1AP,
"[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n",
ctxt.module_id,
ctxt.rnti,
(int)DRB_configList->list.array[i]->drb_Identity);
// (int)*DRB_configList->list.array[i]->logicalChannelIdentity);
if (ue_context_p->ue_context.DRB_active[drb_id] == 0) {
ue_context_p->ue_context.DRB_active[drb_id] = 1;
// logicalChannelIdentity
// rrc_mac_config_req_eNB
}
} else { // remove LCHAN from MAC/PHY
AssertFatal(1==0,"Can't handle this yet in DU\n");
}
}
}
}
}
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
LOG_I(F1AP,"Received rrcResume\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
LOG_I(F1AP,"Received rrcRelease\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
LOG_I(F1AP,"Received rrcReestablishment\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(F1AP,"Received securityModeCommand\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
LOG_I(F1AP, "Received dlInformationTransfer\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(F1AP, "Received ueCapabilityEnquiry\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
LOG_I(F1AP, "Received counterCheck\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
break;
}
}
} else if (req->srb_id == 2) {
// TODO
//abort();
}
LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", req->srb_id);
// rlc_op_status_t rlc_status;
// boolean_t ret = TRUE;
//LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size);
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
// printf("%02x ", ie->value.choice.RRCContainer.buf[i]);
//printf (", PDCP PDU size %d:", rrc_dl_sdu_len);
//for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]);
//printf("\n");
du_rlc_data_req(&ctxt, 1, 0, req->srb_id , 1, 0, req->buf->size, req->buf);
// rlc_status = rlc_data_req(&ctxt
// , 1
// , MBMS_FLAG_NO
// , srb_id
// , 0
// , 0
// , rrc_dl_sdu_len
// , pdcp_pdu_p
// ,NULL
// ,NULL
// );
// switch (rlc_status) {
// case RLC_OP_STATUS_OK:
// //LOG_I(F1AP, "Data sending request over RLC succeeded!\n");
// ret=TRUE;
// break;
// case RLC_OP_STATUS_BAD_PARAMETER:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_INTERNAL_ERROR:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_OUT_OF_RESSOURCES:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
// ret= FALSE;
// break;
// default:
// LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
// ret= FALSE;
// break;
// } // switch case
// return ret;
return 0;
}
static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const char *msg_name, instance_t instance){
f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = req->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p);
uint32_t incoming_teid = 0;
NR_CellGroupConfig_t *cellGroupConfig;
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup);
/* Configure SRB2 */
NR_SRB_ToAddMod_t *SRB2_config = NULL;
NR_SRB_ToAddModList_t *SRB_configList = NULL;
uint8_t SRBs_before_new_addition = 0;
if(req->srbs_to_be_setup_length>0){
if(ue_context_p->ue_context.SRB_configList == NULL){
LOG_W(NR_RRC, "The SRB list of the UE context is empty before the addition of new SRB at the DU \n");
ue_context_p->ue_context.SRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.SRB_configList));
}
SRB_configList = ue_context_p->ue_context.SRB_configList;
SRBs_before_new_addition = SRB_configList->list.count;
for (int i=0; i<req->srbs_to_be_setup_length; i++){
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id;
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
}
}
/* Configure DRB */
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_DRB_ToAddModList_t *DRB_configList = NULL;
if(req->drbs_to_be_setup_length>0){
if(ue_context_p->ue_context.DRB_configList == NULL){
ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList));
}
DRB_configList = ue_context_p->ue_context.DRB_configList;
for (int i=0; i<req->drbs_to_be_setup_length; i++){
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i];
transport_layer_addr_t addr;
memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address));
addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8;
extern instance_t DUuniqInstance;
incoming_teid=newGtpuCreateTunnel(DUuniqInstance,
req->rnti,
drb_p.drb_id,
drb_p.drb_id,
drb_p.up_ul_tnl[0].teid,
addr,
drb_p.up_ul_tnl[0].port,
DURecvCb);
}
}
apply_macrlc_config(rrc, ue_context_p, &ctxt);
/* Fill the UE context setup response ITTI message to send to F1AP */
resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
resp->rnti = ctxt.rnti;
if(DRB_configList){
if(DRB_configList->list.count > 0){
resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
resp->drbs_to_be_setup_length = DRB_configList->list.count;
for (int i=0; i<DRB_configList->list.count; i++){
resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM;
resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid;
resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr);
resp->drbs_to_be_setup[i].up_dl_tnl_length = 1;
}
}
else{
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context setup request with a DRB to setup list\n");
}
}
if(SRB_configList){
if(SRB_configList->list.count >0 && SRBs_before_new_addition < SRB_configList->list.count){
resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t));
resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length;
for (int i=SRBs_before_new_addition; i<SRB_configList->list.count; i++){
resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity;
}
}
else{
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
}
}
else{
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
}
resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)cellGroupConfig,
resp->du_to_cu_rrc_information,
1024);
resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3;
free(cellGroupConfig);
itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p);
}
static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = resp->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti);
NR_CellGroupConfig_t *cellGroupConfig = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&cellGroupConfig,
(uint8_t *)resp->du_to_cu_rrc_information,
(int) resp->du_to_cu_rrc_information_length);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"Cell group config decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 );
return;
}
//xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig);
if(ue_context_p->ue_context.masterCellGroup == NULL){
ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t));
}
if(cellGroupConfig->rlc_BearerToAddModList!=NULL){
if(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList != NULL){
LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n");
free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList);
}
ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
sizeof(*cellGroupConfig->rlc_BearerToAddModList));
}
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup);
free(cellGroupConfig->rlc_BearerToAddModList);
free(cellGroupConfig);
}
unsigned int mask_flip(unsigned int x) {
return((((x>>8) + (x<<8))&0xffff)>>6);
}
@@ -3171,7 +3528,6 @@ void *rrc_gnb_task(void *args_p) {
.frame=-1,
.subframe=-1,
.eNB_index=0,
.configured=true,
.brOption=false
};
itti_mark_task_ready(TASK_RRC_GNB);
@@ -3203,36 +3559,46 @@ void *rrc_gnb_task(void *args_p) {
/* Messages from MAC */
case NR_RRC_MAC_CCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index,
GNB_FLAG_YES,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
ctxt.rnti,
instance,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
break;
}
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).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);
}
{
instance_t i;
for (i=0; i<RC.nb_nr_inst; i++) {
// first get RRC instance (note, no the ITTI instance)
gNB_RRC_INST *rrc = RC.nrrrc[i];
if (rrc->nr_cellid == NR_RRC_MAC_CCCH_DATA_IND(msg_p).nr_cellid)
break;
}
AssertFatal(i!=RC.nb_nr_inst, "Cell_id not found\n");
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
i,
GNB_FLAG_YES,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
ctxt.rnti,
i,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
break;
}
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).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 */
@@ -3288,6 +3654,18 @@ void *rrc_gnb_task(void *args_p) {
LOG_I(NR_RRC,"[gNB %ld] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p));
rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p));
break;
case NR_DU_RRC_DL_INDICATION:
rrc_process_DU_DL(msg_p, msg_name_p, instance);
break;
case F1AP_UE_CONTEXT_SETUP_REQ:
rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance);
break;
case F1AP_UE_CONTEXT_SETUP_RESP:
rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance);
break;
/* Messages from X2AP */
case X2AP_ENDC_SGNB_ADDITION_REQ:
@@ -3296,7 +3674,7 @@ void *rrc_gnb_task(void *args_p) {
break;
case X2AP_ENDC_SGNB_RECONF_COMPLETE:
LOG_I(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n");
LOG_A(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n");
break;
case NGAP_INITIAL_CONTEXT_SETUP_REQ:
@@ -3523,9 +3901,10 @@ rrc_gNB_generate_RRCRelease(
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size = 0;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_NR_RRCRelease(buffer,rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id));
size = do_NR_RRCRelease(buffer, sizeof(buffer),
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id));
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ul_failure_timer = 0;
+13 -11
View File
@@ -306,7 +306,9 @@ nr_rrc_pdcp_config_security(
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
uint8_t *kUPenc = NULL;
static int print_keys= 1;
//uint8_t *k_kdf = NULL;
static int print_keys= 1;
/* Derive the keys from kgnb */
if (SRB_configList != NULL) {
@@ -481,7 +483,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
uint16_t ue_initial_id;
uint32_t gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = NULL;
protocol_ctxt_t ctxt;
protocol_ctxt_t ctxt={0};
uint8_t pdu_sessions_done = 0;
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp;
@@ -520,14 +522,14 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
ue_context_p->ue_context.pduSession[i].param = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done];
create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].pdusession_id;
create_tunnel_req.incoming_rb_id[pdu_sessions_done] = i+1;
create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid;
create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length;
memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer,
create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid;
create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length;
memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer,
NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.buffer,
sizeof(uint8_t)*20);
LOG_I(NR_RRC, "PDUSESSION SETUP: local index %d teid %u, pdusession id %d \n",
i,
create_tunnel_req.upf_NGu_teid[pdu_sessions_done],
create_tunnel_req.outgoing_teid[pdu_sessions_done],
create_tunnel_req.pdusession_id[pdu_sessions_done]);
inde_list[pdu_sessions_done] = i;
pdu_sessions_done++;
@@ -1053,7 +1055,7 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
uint8_t nb_pdusessions_tosetup = NGAP_PDUSESSION_SETUP_REQ(msg_p).nb_pdusessions_tosetup;
pdu_sessions_done = 0;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0, 0);
for (int i = 0; i < NR_NB_RB_MAX - 3; i++) {
if(ue_context_p->ue_context.pduSession[i].status >= PDU_SESSION_STATUS_DONE)
continue;
@@ -1061,14 +1063,14 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
ue_context_p->ue_context.pduSession[i].param = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done];
create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].pdusession_id;
create_tunnel_req.incoming_rb_id[pdu_sessions_done]= i+1;
create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid;
memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer,
create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid;
memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer,
NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.buffer,
sizeof(uint8_t)*20);
create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length;
create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length;
LOG_I(NR_RRC,"NGAP PDUSESSION SETUP REQ: local index %d teid %u, pdusession id %d \n",
i,
create_tunnel_req.upf_NGu_teid[pdu_sessions_done],
create_tunnel_req.outgoing_teid[pdu_sessions_done],
create_tunnel_req.pdusession_id[pdu_sessions_done]);
inde_list[pdu_sessions_done] = i;
pdu_sessions_done++;
+57 -23
View File
@@ -38,6 +38,7 @@
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
#include "executables/softmodem-common.h"
#include "executables/nr-softmodem.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "UTIL/OSA/osa_defs.h"
@@ -123,6 +124,7 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerL
if ( LOG_DEBUGFLAG(DEBUG_ASN1) && ueCapabilityRAT_Container_MRDC != NULL ) {
xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC);
}
LOG_A(NR_RRC, "Successfully decoded UE NR capabilities (NR and MRDC)\n");
rrc_add_nsa_user(rrc,ue_context_p, m);
}
@@ -142,6 +144,30 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
unsigned char *kUPenc = NULL;
unsigned char *kUPint = NULL;
int i;
// In case of phy-test and do-ra mode, read UE capabilities directly from file
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) {
NR_UE_NR_Capability_t* UE_Capability_nr = NULL;
char UE_NR_Capability_xer[65536];
FILE *f = NULL;
if (uecap_file)
f = fopen(uecap_file, "r");
if(f){
size_t size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f);
if (size == 0 || size == sizeof UE_NR_Capability_xer)
LOG_E(NR_RRC,"UE Capabilities XER file %s is too large (%ld)\n", uecap_file, size);
else {
UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
asn_dec_rval_t dec_rval = xer_decode(0, &asn_DEF_NR_UE_NR_Capability, (void *)&UE_Capability_nr, UE_NR_Capability_xer, size);
assert(dec_rval.code == RC_OK);
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,(void *)UE_Capability_nr);
}
}
else
LOG_E(NR_RRC,"Could not open UE Capabilities input file. Not handling OAI UE Capabilities.\n");
ue_context_p->ue_context.UE_Capability_nr = UE_Capability_nr;
}
// NR RRCReconfiguration
AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n");
ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t));
@@ -237,22 +263,26 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
}
if (ue_context_p->ue_context.spCellConfig) {
fill_default_reconfig(carrier->servingcellconfigcommon,
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->do_CSIRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
carrier->do_SRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
} else {
fill_default_reconfig(carrier->servingcellconfigcommon,
NULL,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->do_CSIRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
NULL,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
carrier->do_SRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
}
ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
@@ -290,14 +320,18 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
gtpv1u_create_s1u_tunnel(
ctxt.instance,
&create_tunnel_req,
&create_tunnel_resp);
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
&inde_list[0]);
memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp));
if (!IS_SOFTMODEM_NOS1) {
LOG_D(RRC, "Calling gtpv1u_create_s1u_tunnel()\n");
gtpv1u_create_s1u_tunnel(
ctxt.instance,
&create_tunnel_req,
&create_tunnel_resp);
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
&inde_list[0]);
}
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id;
@@ -335,7 +369,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NULL,
(void *)CG_Config,
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer,
1024);
sizeof(X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer));
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3;
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding
} else if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
+46 -16
View File
@@ -55,12 +55,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
int scg_id,
int servCellIndex,
int dl_antenna_ports,
int minRXTXTIME,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid) {
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n");
uint64_t bitmap=0;
switch (servingcellconfigcommon->ssb_PositionsInBurst->present) {
case 1 :
@@ -482,10 +489,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
NR_PDSCH_TimeDomainResourceAllocation_t *pdschi;
for (int i=0;i<servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
pdschi= calloc(1,sizeof(*pdschi));
AssertFatal(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0!=NULL,"element %d is null\n",i);
pdschi->k0 = calloc(1,sizeof(*pdschi->k0));
*pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
if(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0){
pdschi->k0 = calloc(1,sizeof(*pdschi->k0));
*pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
}
pdschi->mappingType = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
pdschi->startSymbolAndLength = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi);
@@ -796,13 +803,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
*srs_resset0_id=0;
ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id);
srs_Config->srs_ResourceToReleaseList=NULL;
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
if(do_srs) {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic;
srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic));
srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL;
} else {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
}
srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook;
srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha));
*srs_resset0->alpha = NR_Alpha_alpha1;
@@ -821,17 +836,28 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
srs_res0->transmissionComb.choice.n2->combOffset_n2=0;
srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0;
srs_res0->resourceMapping.startPosition=2;
srs_res0->resourceMapping.startPosition = 2 + uid%2;
srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1;
srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
srs_res0->freqDomainPosition=0;
srs_res0->freqDomainShift=0;
srs_res0->freqHopping.c_SRS = 0;
srs_res0->freqHopping.b_SRS=0;
srs_res0->freqHopping.b_hop=0;
srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs(
NRRIV2BW(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275),
srs_res0->freqHopping.b_SRS);
srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
if(do_srs) {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic;
srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic));
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160;
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots
} else {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
}
srs_res0->sequenceId=40;
srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo));
srs_res0->spatialRelationInfo->servingCellId=NULL;
@@ -945,7 +971,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
long *delay[8];
for (int i=0;i<8;i++) {
delay[i] = calloc(1,sizeof(*delay[i]));
*delay[i] = (i<6) ? (i+2) : 0;
*delay[i] = i+minRXTXTIME;
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
}
pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
@@ -1348,7 +1374,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
int dl_antenna_ports,
int minRXTXTIME,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid) {
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
@@ -1363,7 +1391,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
1,
1,
dl_antenna_ports,
minRXTXTIME,
do_csirs,
do_srs,
initial_csi_index,
uid);
+1 -1
View File
@@ -149,7 +149,7 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
}
uint8_t
rrc_data_req_ue(
rrc_data_req_nr_ue(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
+2 -2
View File
@@ -34,8 +34,8 @@
#include "rrc_proto.h"
#include "common/utils/LOG/log.h"
NR_UE_RRC_INST_t* nr_l3_init_ue(char* rrc_config_path){
NR_UE_RRC_INST_t* nr_l3_init_ue(char* uecap, char* rrc_config_path){
//LOG_I(RRC, "[MAIN] NR UE MAC initialization...\n");
return openair_rrc_top_init_ue_nr(rrc_config_path);
return openair_rrc_top_init_ue_nr(uecap,rrc_config_path);
}
+331 -97
View File
@@ -49,10 +49,12 @@
#include "rrc_defs.h"
#include "rrc_proto.h"
#include "rrc_vars.h"
#include "rrc_extern.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h"
#include "intertask_interface.h"
#include "nr-uesoftmodem.h"
#include "executables/softmodem-common.h"
#include "plmn_data.h"
#include "pdcp.h"
@@ -105,7 +107,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
);
void
nr_sa_rrc_ue_process_radioBearerConfig(
nr_rrc_ue_process_RadioBearerConfig(
const protocol_ctxt_t *const ctxt_pP,
const uint8_t gNB_index,
NR_RadioBearerConfig_t *const radioBearerConfig
@@ -114,11 +116,10 @@ nr_sa_rrc_ue_process_radioBearerConfig(
uint8_t do_NR_RRCReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id
);
void rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index );
void
nr_rrc_ue_generate_rrcReestablishmentComplete(
const protocol_ctxt_t *const ctxt_pP,
@@ -233,16 +234,6 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
return 0;
}
int8_t nr_rrc_ue_process_RadioBearerConfig(NR_RadioBearerConfig_t *RadioBearerConfig){
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig);
}
// Configure PDCP
return 0;
}
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded)
// RRCReconfiguration
int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCReconfiguration_t *rrcReconfiguration){
@@ -253,12 +244,15 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){
NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig;
}else{
nr_rrc_ue_process_RadioBearerConfig(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
struct NR_RadioBearerConfig *RadioBearerConfig = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig;
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig);
}
}
}
if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup != NULL){
if(get_softmodem_params()->sa) {
if(get_softmodem_params()->sa || get_softmodem_params()->nsa) {
NR_CellGroupConfig_t *cellGroupConfig = NULL;
uper_decode(NULL,
@@ -336,6 +330,10 @@ int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupCon
}else{
// maintain list
if(cell_group_config->spCellConfig != NULL){
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_ue(0, 0, 0, NULL, NULL, cell_group_config, NULL);
LOG_D(NR_RRC, "Filled scc now \n");
}
if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){
// process element of list to be add by RRC message
if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){
@@ -375,7 +373,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RRC,"NR_RRCReconfiguration decode error\n");
LOG_E(NR_RRC, "NR_RRCReconfiguration decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_RRCReconfiguration, RRCReconfiguration, 1 );
return;
@@ -394,12 +392,26 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RRC,"NR_RadioBearerConfig decode error\n");
LOG_E(NR_RRC, "NR_RadioBearerConfig decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 );
return;
}
nr_rrc_ue_process_RadioBearerConfig(RadioBearerConfig);
if (get_softmodem_params()->nsa) {
protocol_ctxt_t ctxt;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0);
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig);
LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n",
__LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity,
RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity,
RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm,
*RadioBearerConfig->securityConfig->keyToUse);
nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig);
}
else if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig);
}
}
break;
@@ -410,11 +422,10 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
}
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_path){
int nr_ue;
if(NB_NR_UE_INST > 0){
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
memset(NR_UE_rrc_inst, 0, NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t));
for(nr_ue=0;nr_ue<NB_NR_UE_INST;nr_ue++){
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
NR_UE_rrc_inst[nr_ue].selected_plmn_identity = 1;
@@ -485,6 +496,8 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations);
}
NR_UE_rrc_inst->uecap_file = uecap_file;
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) {
// read in files for RRCReconfiguration and RBconfig
FILE *fd;
@@ -494,7 +507,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
else
sprintf(filename,"reconfig.raw");
fd = fopen(filename,"r");
char buffer[1024];
char buffer[1024];
AssertFatal(fd,
"cannot read file %s: errno %d, %s\n",
filename,
@@ -517,6 +530,10 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
fclose(fd);
process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, buffer,msg_len);
}
else if (get_softmodem_params()->nsa)
{
LOG_D(NR_RRC, "In NSA mode \n");
}
}
else{
NR_UE_rrc_inst = NULL;
@@ -562,7 +579,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
if (NR_UE_rrc_inst[module_id].mib != NULL)
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
else LOG_I(NR_RRC,"Configuring MAC for first MIB reception\n");
else
LOG_A(NR_RRC, "Configuring MAC for first MIB reception\n");
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message,
@@ -590,13 +608,6 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
return 0;
}
const char siWindowLength[10][5] = {"5s", "10s", "20s", "40s", "80s", "160s", "320s", "640s", "1280s","ERR"};// {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","80ms","ERR"};
const short siWindowLength_int[9] = {5,10,20,40,80,160,320,640,1280};//{1,2,5,10,15,20,40,80};
const char SIBType[12][6] = {"SIB3","SIB4","SIB5","SIB6","SIB7","SIB8","SIB9","SIB10","SIB11","SIB12","SIB13","Spare"};
const char SIBPeriod[8][6] = {"rf8","rf16","rf32","rf64","rf128","rf256","rf512","ERR"};
int siPeriod_int[7] = {80,160,320,640,1280,2560,5120};
const char *nr_SIBreserved( long value ) {
if (value < 0 || value > 1)
return "ERR";
@@ -1026,7 +1037,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index
// if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->schedulingInfoList.list.count)
// rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE );
// LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n",
// LOG_I(NR_RRC, "SIStatus %x, SIcnt %d/%d\n",
// NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus,
// NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt,
// sib1->schedulingInfoList.list.count);
@@ -1036,7 +1047,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index
return 0;
}
int8_t check_requested_SI_List(module_id_t module_id, BIT_STRING_t requested_SI_List, NR_SIB1_t sib1) {
static int8_t check_requested_SI_List(module_id_t module_id, BIT_STRING_t requested_SI_List, NR_SIB1_t sib1) {
if(sib1.si_SchedulingInfo) {
@@ -1186,7 +1197,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
if( g_log->log_component[NR_RRC].level >= OAILOG_DEBUG ) {
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) NR_UE_rrc_inst[module_id].sib1[gNB_index]);
}
LOG_I(NR_RRC, "SIB1 decoded\n");
LOG_A(NR_RRC, "SIB1 decoded\n");
/// dump_SIB1();
// FIXME: improve condition for the RA trigger
@@ -1194,8 +1205,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
check_requested_SI_List(module_id, NR_UE_rrc_inst[module_id].requested_SI_List, *sib1);
if( nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR ) {
NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
LOG_D(PHY,"Setting state to NR_RRC_SI_RECEIVED\n");
nr_rrc_set_state (module_id, NR_RRC_SI_RECEIVED);
LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n");
nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR);
}
// take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
@@ -1281,7 +1292,8 @@ nr_rrc_ue_process_masterCellGroup(
if( cellGroupConfig->rlc_BearerToAddModList != NULL){
//TODO (perform the RLC bearer addition/modification as specified in 5.3.5.5.4)
if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList != NULL){
free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
// Laurent: there are cases where the not NULL value is also not coming from a previous malloc
// so it is better to let the potential memory leak than corrupting the heap //free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
}
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList,
@@ -1293,7 +1305,9 @@ nr_rrc_ue_process_masterCellGroup(
LOG_I(RRC, "Received mac_CellGroupConfig from gNB\n");
if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig != NULL){
LOG_E(RRC, "UE RRC instance already contains mac CellGroupConfig which will be overwritten\n");
free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig);
// Laurent: there are cases where the not NULL value is also not coming from a previous malloc
// so it is better to let the potential memory leak than corrupting the heap
//free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig);
}
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig));
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig,
@@ -1373,7 +1387,8 @@ static void rrc_ue_generate_RRCSetupComplete(
nas_msg = nr_nas_attach_req_imsi;
nas_msg_length = sizeof(nr_nas_attach_req_imsi);
}
size = do_RRCSetupComplete(ctxt_pP->module_id,buffer,Transaction_id,sel_plmn_id,nas_msg_length,nas_msg);
size = do_RRCSetupComplete(ctxt_pP->module_id, buffer, sizeof(buffer),
Transaction_id, sel_plmn_id, nas_msg_length, nas_msg);
LOG_I(NR_RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d, gNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index);
LOG_D(NR_RRC,
@@ -1384,7 +1399,7 @@ static void rrc_ue_generate_RRCSetupComplete(
//printf("\n");
// ctxt_pP_local.rnti = ctxt_pP->rnti;
rrc_data_req_ue(ctxt_pP,
rrc_data_req_nr_ue(ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
@@ -1462,10 +1477,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
ctxt_pP,
gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup);
nr_sa_rrc_ue_process_radioBearerConfig(
ctxt_pP,
gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP,
gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED);
nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED);
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti;
@@ -1735,7 +1749,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue (ctxt_pP,
rrc_data_req_nr_ue (ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
@@ -1773,6 +1787,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
do_RRCSetupRequest(
module_id,
(uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload,
sizeof(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload),
rv);
LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n",
module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
@@ -2013,7 +2028,7 @@ nr_rrc_ue_establish_srb2(
//-----------------------------------------------------------------------------
void
nr_sa_rrc_ue_process_radioBearerConfig(
nr_rrc_ue_process_RadioBearerConfig(
const protocol_ctxt_t *const ctxt_pP,
const uint8_t gNB_index,
NR_RadioBearerConfig_t *const radioBearerConfig
@@ -2165,7 +2180,8 @@ nr_rrc_ue_establish_srb2(
NULL,
radioBearerConfig->drb_ToAddModList,
NULL,
0,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm
| (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
NULL,
NULL,
kUPenc,
@@ -2204,7 +2220,7 @@ nr_rrc_ue_establish_srb2(
}
//-----------------------------------------------------------------------------
void
static void
rrc_ue_process_rrcReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
NR_RRCReconfiguration_t *rrcReconfiguration,
@@ -2234,7 +2250,7 @@ nr_rrc_ue_establish_srb2(
if (ie->radioBearerConfig != NULL) {
LOG_I(NR_RRC, "radio Bearer Configuration is present\n");
nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig);
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig);
}
/* Check if there is dedicated NAS information to forward to NAS */
@@ -2262,7 +2278,7 @@ nr_rrc_ue_establish_srb2(
//-----------------------------------------------------------------------------
void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) {
uint8_t buffer[32], size;
size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id);
size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, sizeof(buffer), Transaction_id);
LOG_I(NR_RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index);
LOG_D(RLC,
@@ -2287,7 +2303,7 @@ nr_rrc_ue_establish_srb2(
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue (
rrc_data_req_nr_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
@@ -2306,6 +2322,7 @@ nr_rrc_ue_establish_srb2(
const protocol_ctxt_t *const ctxt_pP,
const srb_id_t Srb_id,
const uint8_t *const Buffer,
size_t Buffer_size,
const uint8_t gNB_indexP
)
//-----------------------------------------------------------------------------
@@ -2326,7 +2343,7 @@ nr_rrc_ue_establish_srb2(
&asn_DEF_NR_DL_DCCH_Message,
(void **)&dl_dcch_msg,
Buffer,
RRC_BUF_SIZE,
Buffer_size,
0,
0);
@@ -2508,6 +2525,7 @@ nr_rrc_ue_establish_srb2(
&ctxt,
NR_RRC_DCCH_DATA_IND (msg_p).dcch_index,
NR_RRC_DCCH_DATA_IND (msg_p).sdu_p,
NR_RRC_DCCH_DATA_IND (msg_p).sdu_size,
NR_RRC_DCCH_DATA_IND (msg_p).gNB_index);
break;
@@ -2559,14 +2577,14 @@ nr_rrc_ue_establish_srb2(
#else
// check if SRB2 is created, if yes request data_req on DCCH1 (SRB2)
if(NR_UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) {
rrc_data_req_ue (&ctxt,
rrc_data_req_nr_ue (&ctxt,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
length, buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
} else {
rrc_data_req_ue (&ctxt,
rrc_data_req_nr_ue (&ctxt,
DCCH1,
nr_rrc_mui++,
SDU_CONFIRM_NO,
@@ -2619,14 +2637,18 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
//-----------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
asn_dec_rval_t dec_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
NR_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container;
char UE_NR_Capability_xer[65536];
size_t size;
uint8_t buffer[200];
int i;
LOG_I(NR_RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing UECapabilityEnquiry (gNB %d)\n",
ctxt_pP->module_id,
ctxt_pP->frame,
gNB_index);
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
memset((void *)&ue_CapabilityRAT_Container,0,sizeof(NR_UE_CapabilityRAT_Container_t));
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
@@ -2635,20 +2657,35 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
ul_dcch_msg.message.choice.c1->choice.ueCapabilityInformation = CALLOC(1, sizeof(struct NR_UECapabilityInformation));
ul_dcch_msg.message.choice.c1->choice.ueCapabilityInformation->rrc_TransactionIdentifier = UECapabilityEnquiry->rrc_TransactionIdentifier;
ue_CapabilityRAT_Container.rat_Type = NR_RAT_Type_nr;
NR_UE_NR_Capability_t* UE_Capability_nr;
UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
NR_BandNR_t *nr_bandnr;
nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t));
nr_bandnr->bandNR = 1;
ASN_SEQUENCE_ADD(
&UE_Capability_nr->rf_Parameters.supportedBandListNR.list,
nr_bandnr);
NR_UE_NR_Capability_t* UE_Capability_nr = NULL;
char *file_path = NR_UE_rrc_inst[ctxt_pP->module_id].uecap_file;
FILE *f = NULL;
if (file_path)
f = fopen(file_path, "r");
if(f){
size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f);
if (size == 0 || size == sizeof UE_NR_Capability_xer) {
LOG_E(NR_RRC,"UE Capabilities XER file %s is too large (%ld)\n", file_path,size);
free(UE_Capability_nr);
return;
}
dec_rval = xer_decode(0, &asn_DEF_NR_UE_NR_Capability, (void *)&UE_Capability_nr, UE_NR_Capability_xer, size);
assert(dec_rval.code == RC_OK);
}
else {
UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
NR_BandNR_t *nr_bandnr;
nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t));
nr_bandnr->bandNR = 1;
ASN_SEQUENCE_ADD(&UE_Capability_nr->rf_Parameters.supportedBandListNR.list,
nr_bandnr);
}
OAI_NR_UECapability_t *UECap;
UECap = CALLOC(1,sizeof(OAI_NR_UECapability_t));
UECap->UE_NR_Capability = UE_Capability_nr;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,(void *)UE_Capability_nr);
}
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,(void *)UE_Capability_nr);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_NR_Capability,
NULL,
@@ -2667,6 +2704,11 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ue_CapabilityRAT_Container,
(const char *)NR_UE_rrc_inst[ctxt_pP->module_id].UECapability,
NR_UE_rrc_inst[ctxt_pP->module_id].UECapability_size);
if (get_softmodem_params()->nsa == 1) {
OCTET_STRING_t * requestedFreqBandsNR = UECapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityEnquiryExt;
nsa_sendmsg_to_lte_ue(requestedFreqBandsNR->buf, requestedFreqBandsNR->size, UE_CAPABILITY_INFO);
}
// ue_CapabilityRAT_Container.ueCapabilityRAT_Container.buf = UE_rrc_inst[ue_mod_idP].UECapability;
// ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size;
AssertFatal(UECapabilityEnquiry->criticalExtensions.present == NR_UECapabilityEnquiry__criticalExtensions_PR_ueCapabilityEnquiry,
@@ -2692,7 +2734,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
}
LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
LOG_I(NR_RRC, "UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
@@ -2706,7 +2748,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue (
rrc_data_req_nr_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
@@ -2719,36 +2761,6 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
}
}
//-----------------------------------------------------------------------------
void rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index )
{
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size =
do_RRCReestablishmentRequest(
ctxt_pP->module_id,
(uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, 1);
LOG_I(NR_RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCReestablishmentRequest (bytes %d, gNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
for (int i=0; i<NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) {
LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload[i]);
}
LOG_T(NR_RRC,"\n");
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND);
UE_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer;
UE_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#endif
}
void
nr_rrc_ue_generate_rrcReestablishmentComplete(
const protocol_ctxt_t *const ctxt_pP,
@@ -2759,7 +2771,8 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
{
uint32_t length;
uint8_t buffer[100];
length = do_RRCReestablishmentComplete(buffer, rrcReestablishment->rrc_TransactionIdentifier);
length = do_RRCReestablishmentComplete(buffer, sizeof(buffer),
rrcReestablishment->rrc_TransactionIdentifier);
LOG_I(NR_RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCReestablishmentComplete (bytes%d, gNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, length, gNB_index);
#ifdef ITTI_SIM
@@ -2776,3 +2789,224 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
#endif
}
void *recv_msgs_from_lte_ue(void *args_p)
{
itti_mark_task_ready (TASK_RRC_NSA_NRUE);
int from_lte_ue_fd = get_from_lte_ue_fd();
for (;;)
{
nsa_msg_t msg;
int recvLen = recvfrom(from_lte_ue_fd, &msg, sizeof(msg),
MSG_WAITALL | MSG_TRUNC, NULL, NULL);
if (recvLen == -1)
{
LOG_E(NR_RRC, "%s: recvfrom: %s\n", __func__, strerror(errno));
continue;
}
if (recvLen > sizeof(msg))
{
LOG_E(NR_RRC, "%s: Received truncated message %d\n", __func__, recvLen);
continue;
}
process_lte_nsa_msg(&msg, recvLen);
}
return NULL;
}
void start_oai_nrue_threads()
{
init_queue(&nr_rach_ind_queue);
init_queue(&nr_rx_ind_queue);
init_queue(&nr_crc_ind_queue);
init_queue(&nr_uci_ind_queue);
init_queue(&nr_sfn_slot_queue);
init_queue(&nr_chan_param_queue);
init_queue(&nr_dl_tti_req_queue);
init_queue(&nr_tx_req_queue);
init_queue(&nr_ul_dci_req_queue);
init_queue(&nr_ul_tti_req_queue);
init_queue(&nr_wait_ul_tti_req_queue);
if (sem_init(&sfn_slot_semaphore, 0, 0) != 0)
{
LOG_E(MAC, "sem_init() error\n");
abort();
}
init_nrUE_standalone_thread(ue_id_g);
}
static void nsa_rrc_ue_process_ueCapabilityEnquiry(void)
{
NR_UE_NR_Capability_t *UE_Capability_nr = CALLOC(1, sizeof(NR_UE_NR_Capability_t));
NR_BandNR_t *nr_bandnr = CALLOC(1, sizeof(NR_BandNR_t));
nr_bandnr->bandNR = 78;
ASN_SEQUENCE_ADD(&UE_Capability_nr->rf_Parameters.supportedBandListNR.list, nr_bandnr);
OAI_NR_UECapability_t *UECap = CALLOC(1, sizeof(OAI_NR_UECapability_t));
UECap->UE_NR_Capability = UE_Capability_nr;
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_NR_Capability,
NULL,
(void *)UE_Capability_nr,
&UECap->sdu[0],
MAX_UE_NR_CAPABILITY_SIZE);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
UECap->sdu_size = (enc_rval.encoded + 7) / 8;
LOG_A(NR_RRC, "[NR_RRC] NRUE Capability encoded, %d bytes (%zd bits)\n",
UECap->sdu_size, enc_rval.encoded + 7);
NR_UE_rrc_inst[0].UECap = UECap;
NR_UE_rrc_inst[0].UECapability = UECap->sdu;
NR_UE_rrc_inst[0].UECapability_size = UECap->sdu_size;
NR_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container;
memset(&ue_CapabilityRAT_Container, 0, sizeof(NR_UE_CapabilityRAT_Container_t));
ue_CapabilityRAT_Container.rat_Type = NR_RAT_Type_nr;
OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ue_CapabilityRAT_Container,
(const char *)NR_UE_rrc_inst[0].UECapability,
NR_UE_rrc_inst[0].UECapability_size);
nsa_sendmsg_to_lte_ue(ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.buf,
ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.size,
NRUE_CAPABILITY_INFO);
}
void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len)
{
if (msg_len < sizeof(msg->msg_type))
{
LOG_E(RRC, "Msg_len = %d\n", msg_len);
return;
}
LOG_D(NR_RRC, "Processing an NSA message\n");
Rrc_Msg_Type_t msg_type = msg->msg_type;
uint8_t *const msg_buffer = msg->msg_buffer;
msg_len -= sizeof(msg->msg_type);
switch (msg_type)
{
case UE_CAPABILITY_ENQUIRY:
{
LOG_D(NR_RRC, "We are processing a %d message \n", msg_type);
NR_FreqBandList_t *nr_freq_band_list = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_FreqBandList,
(void **)&nr_freq_band_list,
msg_buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
{
SEQUENCE_free(&asn_DEF_NR_FreqBandList, nr_freq_band_list, ASFM_FREE_EVERYTHING);
LOG_E(RRC, "Failed to decode UECapabilityInfo (%zu bits)\n", dec_rval.consumed);
break;
}
for (int i = 0; i < nr_freq_band_list->list.count; i++)
{
LOG_D(NR_RRC, "Received NR band information: %ld.\n",
nr_freq_band_list->list.array[i]->choice.bandInformationNR->bandNR);
}
MessageDef *dummy_msg = itti_alloc_new_message(TASK_RRC_NSA_UE, 0, UE_CAPABILITY_DUMMY);
LOG_D(NR_RRC, "We are calling nsa_sendmsg_to_lte_ue to send a UE_CAPABILITY_DUMMY\n");
nsa_sendmsg_to_lte_ue(dummy_msg, sizeof(dummy_msg), UE_CAPABILITY_DUMMY);
LOG_A(NR_RRC, "Sent initial NRUE Capability response to LTE UE\n");
break;
}
case NRUE_CAPABILITY_ENQUIRY:
{
LOG_I(NR_RRC, "We are processing a %d message \n", msg_type);
NR_FreqBandList_t *nr_freq_band_list = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_FreqBandList,
(void **)&nr_freq_band_list,
msg_buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
{
SEQUENCE_free(&asn_DEF_NR_FreqBandList, nr_freq_band_list, ASFM_FREE_EVERYTHING);
LOG_E(NR_RRC, "Failed to decode UECapabilityInfo (%zu bits)\n", dec_rval.consumed);
break;
}
LOG_I(NR_RRC, "Calling nsa_rrc_ue_process_ueCapabilityEnquiry\n");
nsa_rrc_ue_process_ueCapabilityEnquiry();
break;
}
case RRC_MEASUREMENT_PROCEDURE:
{
LOG_I(NR_RRC, "We are processing a %d message \n", msg_type);
LTE_MeasObjectToAddMod_t *nr_meas_obj = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_LTE_MeasObjectToAddMod,
(void **)&nr_meas_obj,
msg_buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
{
SEQUENCE_free(&asn_DEF_LTE_MeasObjectToAddMod, nr_meas_obj, ASFM_FREE_EVERYTHING);
LOG_E(RRC, "Failed to decode measurement object (%zu bits) %d\n", dec_rval.consumed, dec_rval.code);
break;
}
LOG_D(NR_RRC, "NR carrierFreq_r15 (ssb): %ld and sub carrier spacing:%ld\n",
nr_meas_obj->measObject.choice.measObjectNR_r15.carrierFreq_r15,
nr_meas_obj->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15);
start_oai_nrue_threads();
break;
}
case RRC_CONFIG_COMPLETE_REQ:
{
struct msg {
uint32_t RadioBearer_size;
uint32_t SecondaryCellGroup_size;
uint8_t trans_id;
uint8_t padding[3];
uint8_t buffer[];
} hdr;
AssertFatal(msg_len >= sizeof(hdr), "Bad received msg\n");
memcpy(&hdr, msg_buffer, sizeof(hdr));
LOG_I(NR_RRC, "We got an RRC_CONFIG_COMPLETE_REQ\n");
uint32_t nr_RadioBearer_size = hdr.RadioBearer_size;
uint32_t nr_SecondaryCellGroup_size = hdr.SecondaryCellGroup_size;
AssertFatal(sizeof(hdr) + nr_RadioBearer_size + nr_SecondaryCellGroup_size <= msg_len,
"nr_RadioBearerConfig1_r15 size %d nr_SecondaryCellGroupConfig_r15 size %d sizeof(hdr) %zu, msg_len = %d\n",
nr_RadioBearer_size,
nr_SecondaryCellGroup_size,
sizeof(hdr), msg_len);
NR_RRC_TransactionIdentifier_t t_id = hdr.trans_id;
LOG_I(NR_RRC, "nr_RadioBearerConfig1_r15 size %d nr_SecondaryCellGroupConfig_r15 size %d t_id %ld\n",
nr_RadioBearer_size,
nr_SecondaryCellGroup_size,
t_id);
uint8_t *nr_RadioBearer_buffer = msg_buffer + offsetof(struct msg, buffer);
uint8_t *nr_SecondaryCellGroup_buffer = nr_RadioBearer_buffer + nr_RadioBearer_size;
process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, nr_SecondaryCellGroup_buffer,
nr_SecondaryCellGroup_size);
process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, nr_RadioBearer_buffer, nr_RadioBearer_size);
LOG_I(NR_RRC, "Calling do_NR_RRCReconfigurationComplete. t_id %ld \n", t_id);
uint8_t buffer[RRC_BUF_SIZE];
size_t size = do_NR_RRCReconfigurationComplete_for_nsa(buffer, sizeof(buffer), t_id);
nsa_sendmsg_to_lte_ue(buffer, size, NR_RRC_CONFIG_COMPLETE_REQ);
break;
}
case OAI_TUN_IFACE_NSA:
{
LOG_I(NR_RRC, "We got an OAI_TUN_IFACE_NSA!!\n");
char cmd_line[RRC_BUF_SIZE];
memcpy(cmd_line, msg_buffer, sizeof(cmd_line));
LOG_D(NR_RRC, "Command line: %s\n", cmd_line);
if (background_system(cmd_line) != 0)
{
LOG_E(NR_RRC, "ESM-PROC - failed command '%s'", cmd_line);
}
break;
}
default:
LOG_E(NR_RRC, "No NSA Message Found\n");
}
}
+8 -6
View File
@@ -59,9 +59,9 @@
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
typedef uint32_t channel_t;
@@ -70,7 +70,7 @@ typedef enum {
nr_RadioBearerConfigX_r15=1
} nsa_message_t;
#define MAX_UE_NR_CAPABILITY_SIZE 255
#define MAX_UE_NR_CAPABILITY_SIZE 2048
typedef struct OAI_NR_UECapability_s {
uint8_t sdu[MAX_UE_NR_CAPABILITY_SIZE];
uint8_t sdu_size;
@@ -120,13 +120,15 @@ typedef struct NR_UE_RRC_INST_s {
NR_DRB_ToAddMod_t *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB
NR_SRB_INFO Srb0[NB_SIG_CNX_UE];
char *uecap_file;
NR_SRB_INFO Srb0[NB_SIG_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
uint8_t MBMS_flag;
OAI_NR_UECapability_t *UECap;
uint8_t *UECapability;
uint8_t *UECapability;
uint8_t UECapability_size;
RA_trigger_t ra_trigger;
+85
View File
@@ -0,0 +1,85 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "common/utils/LOG/log.h"
#include "openair2/RRC/NR_UE/rrc_proto.h"
static const char nsa_ipaddr[] = "127.0.0.1";
static int from_lte_ue_fd = -1;
static int to_lte_ue_fd = -1;
uint16_t ue_id_g;
int get_from_lte_ue_fd()
{
return from_lte_ue_fd;
}
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type)
{
LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__);
nsa_msg_t n_msg;
if (msg_len > sizeof(n_msg.msg_buffer))
{
LOG_E(NR_RRC, "%s: message too big: %zu\n", __func__, msg_len);
abort();
}
n_msg.msg_type = msg_type;
memcpy(n_msg.msg_buffer, message, msg_len);
size_t to_send = sizeof(n_msg.msg_type) + msg_len;
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6007 + ue_id_g * 2),
};
int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0,
(struct sockaddr *)&sa, sizeof(sa));
if (sent == -1)
{
LOG_E(NR_RRC, "%s: sendto: %s\n", __func__, strerror(errno));
return;
}
if (sent != to_send)
{
LOG_E(NR_RRC, "%s: Short send %d != %zu\n", __func__, sent, to_send);
return;
}
LOG_D(NR_RRC, "Sent a %d message to the LTE UE (%d bytes) \n", msg_type, sent);
}
void init_connections_with_lte_ue(void)
{
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6008 + ue_id_g * 2),
};
AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd %d was assigned already", from_lte_ue_fd);
from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (from_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, from_lte_ue_fd, errno, strerror(errno));
abort();
}
if (inet_aton(nsa_ipaddr, &sa.sin_addr) == 0)
{
LOG_E(NR_RRC, "Bad nsa_ipaddr '%s'\n", nsa_ipaddr);
abort();
}
if (bind(from_lte_ue_fd, (struct sockaddr *) &sa, sizeof(sa)) == -1)
{
LOG_E(NR_RRC,"%s: Failed to bind the socket\n", __FUNCTION__);
abort();
}
AssertFatal(to_lte_ue_fd == -1, "to_lte_ue_fd was assigned already");
to_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (to_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, to_lte_ue_fd, errno, strerror(errno));
abort();
}
LOG_I(NR_RRC, "Started LTE-NR link in the nr-UE\n");
}
+40 -2
View File
@@ -39,18 +39,31 @@
#include "NR_MeasConfig.h"
#include "NR_CellGroupConfig.h"
#include "NR_RadioBearerConfig.h"
#include "openair2/PHY_INTERFACE/queue_t.h"
extern queue_t nr_rach_ind_queue;
extern queue_t nr_rx_ind_queue;
extern queue_t nr_crc_ind_queue;
extern queue_t nr_uci_ind_queue;
extern queue_t nr_sfn_slot_queue;
extern queue_t nr_chan_param_queue;
extern queue_t nr_dl_tti_req_queue;
extern queue_t nr_tx_req_queue;
extern queue_t nr_ul_dci_req_queue;
extern queue_t nr_ul_tti_req_queue;
extern queue_t nr_wait_ul_tti_req_queue;
//
// main_rrc.c
//
/**\brief Layer 3 initialization*/
NR_UE_RRC_INST_t* nr_l3_init_ue(char*);
NR_UE_RRC_INST_t* nr_l3_init_ue(char*,char*);
//
// UE_rrc.c
//
/**\brief Initial the top level RRC structure instance*/
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char*);
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char*,char*);
@@ -133,15 +146,40 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
const rb_id_t Srb_id,
uint8_t *buffer_pP);
uint8_t
rrc_data_req_nr_ue(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t *const buffer_pP,
const pdcp_transmission_mode_t modeP
);
/**\brief RRC UE task.
\param void *args_p Pointer on arguments to start the task. */
void *rrc_nrue_task(void *args_p);
/**\brief RRC NSA UE task.
\param void *args_p Pointer on arguments to start the task. */
void *recv_msgs_from_lte_ue(void *args_p);
void init_connections_with_lte_ue(void);
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type);
void start_oai_nrue_threads(void);
/**\brief RRC UE generate RRCSetupRequest message.
\param module_id module id
\param gNB_index gNB index */
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index);
void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len);
int get_from_lte_ue_fd();
/** @}*/
#endif
+1
View File
@@ -37,5 +37,6 @@
#include "rrc_defs.h"
extern NR_UE_RRC_INST_t *NR_UE_rrc_inst;
extern uint16_t ue_id_g;
#endif