Merge remote-tracking branch 'develop'
Conflicts: openair1/PHY/NR_TRANSPORT/nr_dlsch.c openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c openair1/SCHED_NR_UE/phy_procedures_nr_ue.c openair2/RRC/NR/nr_rrc_proto.h
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 itti_sim_messages_def.h
|
||||
* \brief itti message for itti simulator
|
||||
* \author Yoshio INOUE, Masayuki HARADA
|
||||
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
|
||||
|
||||
MESSAGE_DEF(GNB_RRC_BCCH_DATA_IND, MESSAGE_PRIORITY_MED, itti_sim_rrc_ch_t, GNBBCCHind)
|
||||
MESSAGE_DEF(GNB_RRC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED, itti_sim_rrc_ch_t, GNBCCCHind)
|
||||
MESSAGE_DEF(GNB_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED, itti_sim_rrc_ch_t, GNBDCCHind)
|
||||
MESSAGE_DEF(UE_RRC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED, itti_sim_rrc_ch_t, UECCCHind)
|
||||
MESSAGE_DEF(UE_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED, itti_sim_rrc_ch_t, UEDCCHind)
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 itti_sim_messages_types.h
|
||||
* \brief itti message for itti simulator
|
||||
* \author Yoshio INOUE, Masayuki HARADA
|
||||
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef ITTI_SIM_MESSAGES_TYPES_H_
|
||||
#define ITTI_SIM_MESSAGES_TYPES_H_
|
||||
|
||||
#include "LTE_asn_constant.h"
|
||||
|
||||
|
||||
|
||||
#define GNB_RRC_BCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.GNBBCCHind
|
||||
#define GNB_RRC_CCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.GNBCCCHind
|
||||
#define GNB_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.GNBDCCHind
|
||||
#define UE_RRC_CCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.UECCCHind
|
||||
#define UE_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.UEDCCHind
|
||||
|
||||
|
||||
|
||||
typedef struct itti_sim_rrc_ch_s {
|
||||
rb_id_t rbid;
|
||||
uint8_t *sdu;
|
||||
int size;
|
||||
} itti_sim_rrc_ch_t;
|
||||
|
||||
#endif /* ITTI_SIM_MESSAGES_TYPES_H_ */
|
||||
@@ -41,10 +41,16 @@ MESSAGE_DEF(RRC_MAC_CCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDat
|
||||
MESSAGE_DEF(RRC_MAC_CCCH_DATA_CNF, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDataCnf, rrc_mac_ccch_data_cnf)
|
||||
MESSAGE_DEF(RRC_MAC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDataInd, rrc_mac_ccch_data_ind)
|
||||
|
||||
|
||||
MESSAGE_DEF(RRC_MAC_MCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataReq, rrc_mac_mcch_data_req)
|
||||
MESSAGE_DEF(RRC_MAC_MCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataInd, rrc_mac_mcch_data_ind)
|
||||
|
||||
MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDataReq, rrc_mac_pcch_data_req)
|
||||
|
||||
/* RRC configures DRX context (MAC timers) of a UE */
|
||||
MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req)
|
||||
MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req)
|
||||
|
||||
// gNB
|
||||
MESSAGE_DEF(NR_RRC_MAC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacCcchDataInd, nr_rrc_mac_ccch_data_ind)
|
||||
MESSAGE_DEF(NR_RRC_MAC_BCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacBcchDataInd, nr_rrc_mac_bcch_data_ind)
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#define RRC_MAC_BCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_bcch_data_req
|
||||
#define RRC_MAC_BCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_bcch_data_ind
|
||||
#define NR_RRC_MAC_BCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_bcch_data_ind
|
||||
|
||||
#define RRC_MAC_BCCH_MBMS_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_bcch_mbms_data_req
|
||||
#define RRC_MAC_BCCH_MBMS_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_bcch_mbms_data_ind
|
||||
@@ -45,6 +46,7 @@
|
||||
#define RRC_MAC_CCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_ccch_data_req
|
||||
#define RRC_MAC_CCCH_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_ccch_data_cnf
|
||||
#define RRC_MAC_CCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_ccch_data_ind
|
||||
#define NR_RRC_MAC_CCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_ccch_data_ind
|
||||
|
||||
#define RRC_MAC_MCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_req
|
||||
#define RRC_MAC_MCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_ind
|
||||
@@ -86,6 +88,15 @@ typedef struct RrcMacBcchDataInd_s {
|
||||
uint8_t rsrp;
|
||||
} RrcMacBcchDataInd;
|
||||
|
||||
typedef struct NRRrcMacBcchDataInd_s {
|
||||
uint32_t frame;
|
||||
uint8_t sub_frame;
|
||||
uint32_t sdu_size;
|
||||
uint8_t sdu[BCCH_SDU_SIZE];
|
||||
uint8_t gnb_index;
|
||||
uint8_t rsrq;
|
||||
uint8_t rsrp;
|
||||
} NRRrcMacBcchDataInd;
|
||||
|
||||
typedef struct RrcMacBcchMbmsDataReq_s {
|
||||
uint32_t frame;
|
||||
@@ -126,6 +137,16 @@ typedef struct RrcMacCcchDataInd_s {
|
||||
int CC_id;
|
||||
} RrcMacCcchDataInd;
|
||||
|
||||
typedef struct NRRrcMacCcchDataInd_s {
|
||||
uint32_t frame;
|
||||
uint8_t sub_frame;
|
||||
uint16_t rnti;
|
||||
uint32_t sdu_size;
|
||||
uint8_t sdu[CCCH_SDU_SIZE];
|
||||
uint8_t gnb_index;
|
||||
int CC_id;
|
||||
} NRRrcMacCcchDataInd;
|
||||
|
||||
typedef struct RrcMacMcchDataReq_s {
|
||||
uint32_t frame;
|
||||
uint32_t sdu_size;
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* ngap_messages_def.h
|
||||
*
|
||||
* Created on: 2020
|
||||
* Author: Yoshio INOUE, Masayuki HARADA
|
||||
* Email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
|
||||
*/
|
||||
|
||||
/* Messages for NGAP logging */
|
||||
MESSAGE_DEF(NGAP_UPLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_uplink_nas_log)
|
||||
MESSAGE_DEF(NGAP_UE_CAPABILITY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_capability_ind_log)
|
||||
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_initial_context_setup_log)
|
||||
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_nas_non_delivery_ind_log)
|
||||
MESSAGE_DEF(NGAP_DOWNLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_downlink_nas_log)
|
||||
MESSAGE_DEF(NGAP_S1_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_s1_setup_log)
|
||||
MESSAGE_DEF(NGAP_INITIAL_UE_MESSAGE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_initial_ue_message_log)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_req_log)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_command_log)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_complete_log)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_request_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_response_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_request_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_response_log)
|
||||
MESSAGE_DEF(NGAP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_paging_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_request_log)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_response_log)
|
||||
MESSAGE_DEF(NGAP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_error_indication_log)
|
||||
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_log)
|
||||
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_ack_log)
|
||||
|
||||
/* gNB application layer -> NGAP messages */
|
||||
MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t , ngap_register_gnb_req)
|
||||
|
||||
/* NGAP -> gNB application layer messages */
|
||||
MESSAGE_DEF(NGAP_REGISTER_GNB_CNF , MESSAGE_PRIORITY_MED, ngap_register_gnb_cnf_t , ngap_register_gnb_cnf)
|
||||
MESSAGE_DEF(NGAP_DEREGISTERED_GNB_IND , MESSAGE_PRIORITY_MED, ngap_deregistered_gnb_ind_t , ngap_deregistered_gnb_ind)
|
||||
|
||||
/* RRC -> NGAP messages */
|
||||
MESSAGE_DEF(NGAP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, ngap_nas_first_req_t , ngap_nas_first_req)
|
||||
MESSAGE_DEF(NGAP_UPLINK_NAS , MESSAGE_PRIORITY_MED, ngap_uplink_nas_t , ngap_uplink_nas)
|
||||
MESSAGE_DEF(NGAP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, ngap_ue_cap_info_ind_t , ngap_ue_cap_info_ind)
|
||||
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_resp_t, ngap_initial_context_setup_resp)
|
||||
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_fail_t, ngap_initial_context_setup_fail)
|
||||
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, ngap_nas_non_delivery_ind_t , ngap_nas_non_delivery_ind)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_release_resp_t , ngap_ue_release_resp)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete)
|
||||
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp)
|
||||
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t , ngap_pdusession_setup_resp)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_fail_t , ngap_pdusession_setup_request_fail)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t , ngap_pdusession_modify_resp)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_pdusession_release_resp_t , ngap_pdusession_release_resp)
|
||||
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ , MESSAGE_PRIORITY_MED, ngap_path_switch_req_t , ngap_path_switch_req)
|
||||
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK , MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t , ngap_path_switch_req_ack)
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_pdusession_modification_ind_t , ngap_pdusession_modification_ind)
|
||||
|
||||
/* NGAP -> RRC messages */
|
||||
MESSAGE_DEF(NGAP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, ngap_downlink_nas_t , ngap_downlink_nas )
|
||||
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_initial_context_setup_req_t , ngap_initial_context_setup_req )
|
||||
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_req_t , ngap_ue_ctxt_modification_req)
|
||||
MESSAGE_DEF(NGAP_PAGING_IND , MESSAGE_PRIORITY_MED, ngap_paging_ind_t , ngap_paging_ind )
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t , ngap_pdusession_setup_req )
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t , ngap_pdusession_modify_req )
|
||||
MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, ngap_pdusession_release_command_t , ngap_pdusession_release_command)
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, ngap_ue_release_command_t , ngap_ue_release_command)
|
||||
|
||||
/* NGAP <-> RRC messages (can be initiated either by MME or gNB) */
|
||||
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, ngap_ue_release_req_t , ngap_ue_release_req)
|
||||
@@ -0,0 +1,821 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* ngap_messages_types.h
|
||||
*
|
||||
* Created on: 2020
|
||||
* Author: Yoshio INOUE, Masayuki HARADA
|
||||
* Email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
|
||||
*/
|
||||
|
||||
#ifndef NGAP_MESSAGES_TYPES_H_
|
||||
#define NGAP_MESSAGES_TYPES_H_
|
||||
|
||||
#include "LTE_asn_constant.h"
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// Defines to access message fields.
|
||||
|
||||
#define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_req
|
||||
|
||||
#define NGAP_REGISTER_GNB_CNF(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_cnf
|
||||
#define NGAP_DEREGISTERED_GNB_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_deregistered_gnb_ind
|
||||
|
||||
#define NGAP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_first_req
|
||||
#define NGAP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_nas
|
||||
#define NGAP_UE_CAPABILITIES_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_cap_info_ind
|
||||
#define NGAP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_resp
|
||||
#define NGAP_INITIAL_CONTEXT_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_fail
|
||||
#define NGAP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_resp
|
||||
#define NGAP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_non_delivery_ind
|
||||
#define NGAP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_resp
|
||||
#define NGAP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_fail
|
||||
#define NGAP_PDUSESSION_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_resp
|
||||
#define NGAP_PDUSESSION_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req_fail
|
||||
#define NGAP_PDUSESSION_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_resp
|
||||
#define NGAP_PATH_SWITCH_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req
|
||||
#define NGAP_PATH_SWITCH_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req_ack
|
||||
#define NGAP_PDUSESSION_MODIFICATION_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modification_ind
|
||||
|
||||
#define NGAP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_nas
|
||||
#define NGAP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_req
|
||||
#define NGAP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_req
|
||||
#define NGAP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_command
|
||||
#define NGAP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_complete
|
||||
#define NGAP_PDUSESSION_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req
|
||||
#define NGAP_PDUSESSION_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_req
|
||||
#define NGAP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_paging_ind
|
||||
|
||||
#define NGAP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_req
|
||||
#define NGAP_PDUSESSION_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_command
|
||||
#define NGAP_PDUSESSION_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_resp
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
/* Maximum number of e-rabs to be setup/deleted in a single message.
|
||||
* Even if only one bearer will be modified by message.
|
||||
*/
|
||||
#define NGAP_MAX_PDUSESSION (LTE_maxDRB + 3)
|
||||
|
||||
/* Length of the transport layer address string
|
||||
* 160 bits / 8 bits by char.
|
||||
*/
|
||||
#define NGAP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8)
|
||||
|
||||
#define NGAP_MAX_NB_AMF_IP_ADDRESS 10
|
||||
#define NGAP_IMSI_LENGTH 16
|
||||
|
||||
#define QOSFLOW_MAX_VALUE 64
|
||||
|
||||
/* Security key length used within gNB
|
||||
* Even if only 16 bytes will be effectively used,
|
||||
* the key length is 32 bytes (256 bits)
|
||||
*/
|
||||
#define SECURITY_KEY_LENGTH 32
|
||||
|
||||
typedef enum ngap_paging_drx_e {
|
||||
NGAP_PAGING_DRX_32 = 0x0,
|
||||
NGAP_PAGING_DRX_64 = 0x1,
|
||||
NGAP_PAGING_DRX_128 = 0x2,
|
||||
NGAP_PAGING_DRX_256 = 0x3
|
||||
} ngap_paging_drx_t;
|
||||
|
||||
/* Lower value codepoint
|
||||
* indicates higher priority.
|
||||
*/
|
||||
typedef enum ngap_paging_priority_s {
|
||||
NGAP_PAGING_PRIO_LEVEL1 = 0,
|
||||
NGAP_PAGING_PRIO_LEVEL2 = 1,
|
||||
NGAP_PAGING_PRIO_LEVEL3 = 2,
|
||||
NGAP_PAGING_PRIO_LEVEL4 = 3,
|
||||
NGAP_PAGING_PRIO_LEVEL5 = 4,
|
||||
NGAP_PAGING_PRIO_LEVEL6 = 5,
|
||||
NGAP_PAGING_PRIO_LEVEL7 = 6,
|
||||
NGAP_PAGING_PRIO_LEVEL8 = 7
|
||||
} ngap_paging_priority_t;
|
||||
|
||||
typedef enum ngap_cn_domain_s {
|
||||
NGAP_CN_DOMAIN_PS = 1,
|
||||
NGAP_CN_DOMAIN_CS = 2
|
||||
} ngap_cn_domain_t;
|
||||
|
||||
typedef struct ngap_net_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
char ipv4_address[16];
|
||||
char ipv6_address[46];
|
||||
} ngap_net_ip_address_t;
|
||||
|
||||
typedef uint64_t bitrate_t;
|
||||
|
||||
typedef struct ngap_ambr_s {
|
||||
bitrate_t br_ul;
|
||||
bitrate_t br_dl;
|
||||
} ngap_ambr_t;
|
||||
|
||||
typedef enum ngap_priority_level_s {
|
||||
NGAP_PRIORITY_LEVEL_SPARE = 0,
|
||||
NGAP_PRIORITY_LEVEL_HIGHEST = 1,
|
||||
NGAP_PRIORITY_LEVEL_LOWEST = 14,
|
||||
NGAP_PRIORITY_LEVEL_NO_PRIORITY = 15
|
||||
} ngap_priority_level_t;
|
||||
|
||||
typedef enum ngap_pre_emp_capability_e {
|
||||
NGAP_PRE_EMPTION_CAPABILITY_ENABLED = 0,
|
||||
NGAP_PRE_EMPTION_CAPABILITY_DISABLED = 1,
|
||||
NGAP_PRE_EMPTION_CAPABILITY_MAX,
|
||||
} ngap_pre_emp_capability_t;
|
||||
|
||||
typedef enum ngap_pre_emp_vulnerability_e {
|
||||
NGAP_PRE_EMPTION_VULNERABILITY_ENABLED = 0,
|
||||
NGAP_PRE_EMPTION_VULNERABILITY_DISABLED = 1,
|
||||
NGAP_PRE_EMPTION_VULNERABILITY_MAX,
|
||||
} ngap_pre_emp_vulnerability_t;
|
||||
|
||||
typedef struct ngap_allocation_retention_priority_s {
|
||||
ngap_priority_level_t priority_level;
|
||||
ngap_pre_emp_capability_t pre_emp_capability;
|
||||
ngap_pre_emp_vulnerability_t pre_emp_vulnerability;
|
||||
} ngap_allocation_retention_priority_t;
|
||||
|
||||
typedef struct ngap_security_capabilities_s {
|
||||
uint16_t nRencryption_algorithms;
|
||||
uint16_t nRintegrity_algorithms;
|
||||
uint16_t eUTRAencryption_algorithms;
|
||||
uint16_t eUTRAintegrity_algorithms;
|
||||
} ngap_security_capabilities_t;
|
||||
|
||||
/* Provides the establishment cause for the RRC connection request as provided
|
||||
* by the upper layers. W.r.t. the cause value names: highPriorityAccess
|
||||
* concerns AC11..AC15, ‘mt Estands for ‘Mobile Terminating Eand ‘mo Efor
|
||||
* 'Mobile Originating'. Defined in TS 36.331.
|
||||
*/
|
||||
typedef enum ngap_rrc_establishment_cause_e {
|
||||
NGAP_RRC_CAUSE_EMERGENCY = 0x0,
|
||||
NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1,
|
||||
NGAP_RRC_CAUSE_MT_ACCESS = 0x2,
|
||||
NGAP_RRC_CAUSE_MO_SIGNALLING = 0x3,
|
||||
NGAP_RRC_CAUSE_MO_DATA = 0x4,
|
||||
NGAP_RRC_CAUSE_MO_VOICECALL = 0x5,
|
||||
NGAP_RRC_CAUSE_MO_VIDEOCALL = 0x6,
|
||||
NGAP_RRC_CAUSE_MO_SMS = 0x7,
|
||||
NGAP_RRC_CAUSE_MPS_PRIORITY_ACCESS = 0x8,
|
||||
NGAP_RRC_CAUSE_MCS_PRIORITY_ACCESS = 0x9,
|
||||
NGAP_RRC_CAUSE_NOTAVAILABLE = 0x10,
|
||||
NGAP_RRC_CAUSE_LAST
|
||||
} ngap_rrc_establishment_cause_t;
|
||||
|
||||
typedef struct ngap_guami_s {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_len;
|
||||
uint8_t amf_region_id;
|
||||
uint16_t amf_set_id;
|
||||
uint8_t amf_pointer;
|
||||
} ngap_guami_t;
|
||||
|
||||
typedef struct ngap_allowed_NSSAI_s{
|
||||
uint8_t sST;
|
||||
uint8_t sD_flag;
|
||||
uint8_t sD[3];
|
||||
}ngap_allowed_NSSAI_t;
|
||||
|
||||
typedef struct fiveg_s_tmsi_s {
|
||||
uint16_t amf_set_id;
|
||||
uint8_t amf_pointer;
|
||||
uint32_t m_tmsi;
|
||||
} fiveg_s_tmsi_t;
|
||||
|
||||
typedef struct ngap_tai_plmn_identity_s {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
} ngap_plmn_identity_t;
|
||||
|
||||
typedef struct ngap_ue_paging_identity_s {
|
||||
fiveg_s_tmsi_t s_tmsi;
|
||||
} ngap_ue_paging_identity_t;
|
||||
|
||||
typedef enum ngap_ue_identities_presenceMask_e {
|
||||
NGAP_UE_IDENTITIES_NONE = 0,
|
||||
NGAP_UE_IDENTITIES_FiveG_s_tmsi = 1 << 1,
|
||||
NGAP_UE_IDENTITIES_guami = 1 << 2,
|
||||
} ngap_ue_identities_presenceMask_t;
|
||||
|
||||
typedef struct ngap_ue_identity_s {
|
||||
ngap_ue_identities_presenceMask_t presenceMask;
|
||||
fiveg_s_tmsi_t s_tmsi;
|
||||
ngap_guami_t guami;
|
||||
} ngap_ue_identity_t;
|
||||
|
||||
typedef struct ngap_nas_pdu_s {
|
||||
/* Octet string data */
|
||||
uint8_t *buffer;
|
||||
/* Length of the octet string */
|
||||
uint32_t length;
|
||||
} ngap_nas_pdu_t, ngap_ue_radio_cap_t;
|
||||
|
||||
typedef struct ngap_mobility_restriction_s{
|
||||
ngap_plmn_identity_t serving_plmn;
|
||||
}ngap_mobility_restriction_t;
|
||||
|
||||
typedef enum pdu_session_type_e {
|
||||
PDUSessionType_ipv4 = 0,
|
||||
PDUSessionType_ipv6 = 1,
|
||||
PDUSessionType_ipv4v6 = 2,
|
||||
PDUSessionType_ethernet = 3,
|
||||
PDUSessionType_unstructured = 4
|
||||
}pdu_session_type_t;
|
||||
|
||||
typedef struct ngap_transport_layer_addr_s {
|
||||
/* Length of the transport layer address buffer in bits. NGAP layer received a
|
||||
* bit string<1..160> containing one of the following addresses: ipv4,
|
||||
* ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but
|
||||
* silently forward it to NG-U.
|
||||
*/
|
||||
uint8_t pdu_session_type;
|
||||
uint8_t length;
|
||||
uint8_t buffer[20]; // in network byte order
|
||||
} ngap_transport_layer_addr_t;
|
||||
|
||||
#define TRANSPORT_LAYER_ADDR_COPY(dEST,sOURCE) \
|
||||
do { \
|
||||
AssertFatal(sOURCE.len <= 20); \
|
||||
memcpy(dEST.buffer, sOURCE.buffer, sOURCE.len); \
|
||||
dEST.length = sOURCE.length; \
|
||||
} while (0)
|
||||
|
||||
typedef struct pdusession_level_qos_parameter_s {
|
||||
uint8_t qci;
|
||||
|
||||
ngap_allocation_retention_priority_t allocation_retention_priority;
|
||||
} pdusession_level_qos_parameter_t;
|
||||
|
||||
typedef struct pdusession_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
|
||||
uint8_t nb_qos;
|
||||
/* Quality of service for this pdusession */
|
||||
pdusession_level_qos_parameter_t qos[QOSFLOW_MAX_VALUE];
|
||||
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
} pdusession_t;
|
||||
|
||||
|
||||
typedef enum pdusession_qosflow_mapping_ind_e{
|
||||
QOSFLOW_MAPPING_INDICATION_UL = 0,
|
||||
QOSFLOW_MAPPING_INDICATION_DL = 1,
|
||||
QOSFLOW_MAPPING_INDICATION_NON = 0xFF
|
||||
}pdusession_qosflow_mapping_ind_t;
|
||||
|
||||
typedef struct pdusession_associate_qosflow_s{
|
||||
uint8_t qci;
|
||||
pdusession_qosflow_mapping_ind_t qos_flow_mapping_ind;
|
||||
}pdusession_associate_qosflow_t;
|
||||
|
||||
typedef struct pdusession_setup_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t gNB_addr;
|
||||
|
||||
/* UPF Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
|
||||
/* qos flow list number */
|
||||
uint8_t nb_of_qos_flow;
|
||||
|
||||
/* qos flow list(1 ~ 64) */
|
||||
pdusession_associate_qosflow_t associated_qos_flows[QOSFLOW_MAX_VALUE];
|
||||
} pdusession_setup_t;
|
||||
|
||||
typedef struct pdusession_tobe_added_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* Unique drb_ID for the UE. */
|
||||
uint8_t drb_ID;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
} pdusession_tobe_added_t;
|
||||
|
||||
typedef struct pdusession_admitted_tobe_added_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* Unique drb_ID for the UE. */
|
||||
uint8_t drb_ID;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t gnb_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
} pdusession_admitted_tobe_added_t;
|
||||
|
||||
|
||||
|
||||
typedef struct pdusession_tobeswitched_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
} pdusession_tobeswitched_t;
|
||||
|
||||
typedef struct pdusession_modify_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
} pdusession_modify_t;
|
||||
|
||||
typedef enum ngap_Cause_e {
|
||||
NGAP_CAUSE_NOTHING, /* No components present */
|
||||
NGAP_CAUSE_RADIO_NETWORK,
|
||||
NGAP_CAUSE_TRANSPORT,
|
||||
NGAP_CAUSE_NAS,
|
||||
NGAP_CAUSE_PROTOCOL,
|
||||
NGAP_CAUSE_MISC,
|
||||
/* Extensions may appear below */
|
||||
|
||||
} ngap_Cause_t;
|
||||
|
||||
typedef struct pdusession_failed_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
/* Cause of the failure */
|
||||
// cause_t cause;
|
||||
ngap_Cause_t cause;
|
||||
uint8_t cause_value;
|
||||
} pdusession_failed_t;
|
||||
|
||||
typedef enum ngap_ue_ctxt_modification_present_s {
|
||||
NGAP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0),
|
||||
NGAP_UE_CONTEXT_MODIFICATION_UE_AMBR = (1 << 1),
|
||||
NGAP_UE_CONTEXT_MODIFICATION_UE_SECU_CAP = (1 << 2),
|
||||
} ngap_ue_ctxt_modification_present_t;
|
||||
|
||||
typedef enum ngap_paging_ind_present_s {
|
||||
NGAP_PAGING_IND_PAGING_DRX = (1 << 0),
|
||||
NGAP_PAGING_IND_PAGING_PRIORITY = (1 << 1),
|
||||
} ngap_paging_ind_present_t;
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// gNB application layer -> NGAP messages
|
||||
typedef struct ngap_register_gnb_req_s {
|
||||
/* Unique gNB_id to identify the gNB within EPC.
|
||||
* For macro gNB ids this field should be 20 bits long.
|
||||
* For home gNB ids this field should be 28 bits long.
|
||||
*/
|
||||
uint32_t gNB_id;
|
||||
/* The type of the cell */
|
||||
enum cell_type_e cell_type;
|
||||
|
||||
/* Optional name for the cell
|
||||
* NOTE: the name can be NULL (i.e no name) and will be cropped to 150
|
||||
* characters.
|
||||
*/
|
||||
char *gNB_name;
|
||||
|
||||
/* Tracking area code */
|
||||
uint32_t tac;
|
||||
|
||||
#define PLMN_LIST_MAX_SIZE 6
|
||||
/* Mobile Country Code
|
||||
* Mobile Network Code
|
||||
*/
|
||||
uint16_t mcc[PLMN_LIST_MAX_SIZE];
|
||||
uint16_t mnc[PLMN_LIST_MAX_SIZE];
|
||||
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
|
||||
uint8_t num_plmn;
|
||||
|
||||
uint16_t num_nssai[PLMN_LIST_MAX_SIZE];
|
||||
ngap_allowed_NSSAI_t s_nssai[PLMN_LIST_MAX_SIZE][8];
|
||||
|
||||
/* Default Paging DRX of the gNB as defined in TS 38.304 */
|
||||
ngap_paging_drx_t default_drx;
|
||||
|
||||
/* The gNB IP address to bind */
|
||||
net_ip_address_t gnb_ip_address;
|
||||
|
||||
/* Nb of AMF to connect to */
|
||||
uint8_t nb_amf;
|
||||
/* List of AMF to connect to */
|
||||
net_ip_address_t amf_ip_address[NGAP_MAX_NB_AMF_IP_ADDRESS];
|
||||
uint8_t broadcast_plmn_num[NGAP_MAX_NB_AMF_IP_ADDRESS];
|
||||
uint8_t broadcast_plmn_index[NGAP_MAX_NB_AMF_IP_ADDRESS][PLMN_LIST_MAX_SIZE];
|
||||
|
||||
/* Number of SCTP streams used for a amf association */
|
||||
uint16_t sctp_in_streams;
|
||||
uint16_t sctp_out_streams;
|
||||
} ngap_register_gnb_req_t;
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// NGAP -> gNB application layer messages
|
||||
typedef struct ngap_register_gnb_cnf_s {
|
||||
/* Nb of AMF connected */
|
||||
uint8_t nb_amf;
|
||||
} ngap_register_gnb_cnf_t;
|
||||
|
||||
typedef struct ngap_deregistered_gnb_ind_s {
|
||||
/* Nb of AMF connected */
|
||||
uint8_t nb_amf;
|
||||
} ngap_deregistered_gnb_ind_t;
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// RRC -> NGAP messages
|
||||
|
||||
/* The NAS First Req is the first message exchanged between RRC and NGAP
|
||||
* for an UE.
|
||||
* The rnti uniquely identifies an UE within a cell. Later the gnb_ue_ngap_id
|
||||
* will be the unique identifier used between RRC and NGAP.
|
||||
*/
|
||||
typedef struct ngap_nas_first_req_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* the chosen PLMN identity as index, see TS 36.331 6.2.2 RRC Connection
|
||||
* Setup Complete. This index here is zero-based, unlike the standard! */
|
||||
int selected_plmn_identity;
|
||||
|
||||
/* Establishment cause as sent by UE */
|
||||
ngap_rrc_establishment_cause_t establishment_cause;
|
||||
|
||||
/* NAS PDU */
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
|
||||
/* If this flag is set NGAP layer is expecting the GUAMI. If = 0,
|
||||
* the temporary s-tmsi is used.
|
||||
*/
|
||||
ngap_ue_identity_t ue_identity;
|
||||
} ngap_nas_first_req_t;
|
||||
|
||||
typedef struct ngap_uplink_nas_s {
|
||||
/* Unique UE identifier within an gNB */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* NAS pdu */
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
} ngap_uplink_nas_t;
|
||||
|
||||
typedef struct ngap_ue_cap_info_ind_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
ngap_ue_radio_cap_t ue_radio_cap;
|
||||
} ngap_ue_cap_info_ind_t;
|
||||
|
||||
typedef struct ngap_initial_context_setup_resp_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_of_pdusessions;
|
||||
/* list of pdusession setup-ed by RRC layers */
|
||||
pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusession failed to be setup in list */
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
/* list of pdusessions that failed to be setup */
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
} ngap_initial_context_setup_resp_t;
|
||||
|
||||
typedef struct ngap_initial_context_setup_fail_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* TODO add cause */
|
||||
} ngap_initial_context_setup_fail_t, ngap_ue_ctxt_modification_fail_t, ngap_pdusession_setup_req_fail_t;
|
||||
|
||||
typedef struct ngap_nas_non_delivery_ind_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
/* TODO: add cause */
|
||||
} ngap_nas_non_delivery_ind_t;
|
||||
|
||||
typedef struct ngap_ue_ctxt_modification_req_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Bit-mask of possible present parameters */
|
||||
ngap_ue_ctxt_modification_present_t present;
|
||||
|
||||
/* Following fields are optionnaly present */
|
||||
|
||||
/* Security key */
|
||||
uint8_t security_key[SECURITY_KEY_LENGTH];
|
||||
|
||||
/* UE aggregate maximum bitrate */
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* NR Security capabilities */
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
} ngap_ue_ctxt_modification_req_t;
|
||||
|
||||
typedef struct ngap_ue_ctxt_modification_resp_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
} ngap_ue_ctxt_modification_resp_t;
|
||||
|
||||
typedef struct ngap_ue_release_complete_s {
|
||||
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
} ngap_ue_release_complete_t;
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// NGAP -> RRC messages
|
||||
typedef struct ngap_downlink_nas_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* Unique UE identifier within an gNB */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* NAS pdu */
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
} ngap_downlink_nas_t;
|
||||
|
||||
|
||||
typedef struct ngap_initial_context_setup_req_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* UE aggregate maximum bitrate */
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* guami */
|
||||
ngap_guami_t guami;
|
||||
|
||||
/* allowed nssai */
|
||||
uint8_t nb_allowed_nssais;
|
||||
ngap_allowed_NSSAI_t allowed_nssai[8];
|
||||
|
||||
/* Security algorithms */
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
|
||||
/* Security key */
|
||||
uint8_t security_key[SECURITY_KEY_LENGTH];
|
||||
|
||||
/* Number of pdusession to be setup in the list */
|
||||
uint8_t nb_of_pdusessions;
|
||||
/* list of pdusession to be setup by RRC layers */
|
||||
pdusession_t pdusession_param[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Mobility Restriction List */
|
||||
uint8_t mobility_restriction_flag;
|
||||
ngap_mobility_restriction_t mobility_restriction;
|
||||
|
||||
/* Nas Pdu */
|
||||
uint8_t nas_pdu_flag;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
} ngap_initial_context_setup_req_t;
|
||||
|
||||
|
||||
typedef struct ngap_paging_ind_s {
|
||||
/* UE paging identity */
|
||||
ngap_ue_paging_identity_t ue_paging_identity;
|
||||
|
||||
/* Indicates origin of paging */
|
||||
ngap_cn_domain_t cn_domain;
|
||||
|
||||
/* PLMN_identity in TAI of Paging*/
|
||||
ngap_plmn_identity_t plmn_identity[256];
|
||||
|
||||
/* TAC in TAIList of Paging*/
|
||||
int16_t tac[256];
|
||||
|
||||
/* size of TAIList*/
|
||||
int16_t tai_size;
|
||||
|
||||
/* Optional fields */
|
||||
ngap_paging_drx_t paging_drx;
|
||||
|
||||
ngap_paging_priority_t paging_priority;
|
||||
} ngap_paging_ind_t;
|
||||
|
||||
typedef struct ngap_pdusession_setup_req_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession to be setup in the list */
|
||||
uint8_t nb_pdusessions_tosetup;
|
||||
|
||||
/* E RAB setup request */
|
||||
pdusession_t pdusession_setup_params[NGAP_MAX_PDUSESSION];
|
||||
|
||||
} ngap_pdusession_setup_req_t;
|
||||
|
||||
typedef struct ngap_pdusession_setup_resp_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_of_pdusessions;
|
||||
/* list of pdusession setup-ed by RRC layers */
|
||||
pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusession failed to be setup in list */
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
/* list of pdusessions that failed to be setup */
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
} ngap_pdusession_setup_resp_t;
|
||||
|
||||
typedef struct ngap_path_switch_req_s {
|
||||
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_of_pdusessions;
|
||||
|
||||
/* list of pdusession setup-ed by RRC layers */
|
||||
pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
ngap_guami_t ue_guami;
|
||||
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* Security algorithms */
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
|
||||
} ngap_path_switch_req_t;
|
||||
|
||||
typedef struct ngap_path_switch_req_ack_s {
|
||||
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* UE aggregate maximum bitrate */
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_pdusessions_tobeswitched;
|
||||
|
||||
/* list of pdusession to be switched by RRC layers */
|
||||
pdusession_tobeswitched_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusessions to be released by RRC */
|
||||
uint8_t nb_pdusessions_tobereleased;
|
||||
|
||||
/* list of pdusessions to be released */
|
||||
pdusession_failed_t pdusessions_tobereleased[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Security key */
|
||||
int next_hop_chain_count;
|
||||
uint8_t next_security_key[SECURITY_KEY_LENGTH];
|
||||
|
||||
} ngap_path_switch_req_ack_t;
|
||||
|
||||
typedef struct ngap_pdusession_modification_ind_s {
|
||||
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_of_pdusessions_tobemodified;
|
||||
|
||||
uint8_t nb_of_pdusessions_nottobemodified;
|
||||
|
||||
/* list of pdusession setup-ed by RRC layers */
|
||||
pdusession_setup_t pdusessions_tobemodified[NGAP_MAX_PDUSESSION];
|
||||
|
||||
pdusession_setup_t pdusessions_nottobemodified[NGAP_MAX_PDUSESSION];
|
||||
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
} ngap_pdusession_modification_ind_t;
|
||||
|
||||
// NGAP --> RRC messages
|
||||
typedef struct ngap_ue_release_command_s {
|
||||
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
} ngap_ue_release_command_t;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// NGAP <-- RRC messages
|
||||
typedef struct ngap_ue_release_req_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
ngap_Cause_t cause;
|
||||
long cause_value;
|
||||
} ngap_ue_release_req_t, ngap_ue_release_resp_t;
|
||||
|
||||
typedef struct ngap_pdusession_modify_req_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession to be modify in the list */
|
||||
uint8_t nb_pdusessions_tomodify;
|
||||
|
||||
/* E RAB modify request */
|
||||
pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION];
|
||||
} ngap_pdusession_modify_req_t;
|
||||
|
||||
typedef struct ngap_pdusession_modify_resp_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession modify-ed in the list */
|
||||
uint8_t nb_of_pdusessions;
|
||||
/* list of pdusession modify-ed by RRC layers */
|
||||
pdusession_modify_t pdusessions[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusession failed to be modify in list */
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
/* list of pdusessions that failed to be modify */
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
} ngap_pdusession_modify_resp_t;
|
||||
|
||||
typedef struct pdusession_release_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
} pdusession_release_t;
|
||||
|
||||
typedef struct ngap_pdusession_release_command_s {
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
|
||||
/* Number of pdusession to be released in the list */
|
||||
uint8_t nb_pdusessions_torelease;
|
||||
|
||||
/* PDUSession release command */
|
||||
pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION];
|
||||
|
||||
} ngap_pdusession_release_command_t;
|
||||
|
||||
typedef struct ngap_pdusession_release_resp_s {
|
||||
/* AMF UE id */
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession released in the list */
|
||||
uint8_t nb_of_pdusessions_released;
|
||||
|
||||
/* list of pdusessions released */
|
||||
pdusession_release_t pdusession_release[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusession failed to be released in list */
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
/* list of pdusessions that failed to be released */
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
|
||||
} ngap_pdusession_release_resp_t;
|
||||
|
||||
#endif /* NGAP_MESSAGES_TYPES_H_ */
|
||||
@@ -31,3 +31,6 @@
|
||||
MESSAGE_DEF(RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataReq, rrc_dcch_data_req)
|
||||
MESSAGE_DEF(RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataInd, rrc_dcch_data_ind)
|
||||
MESSAGE_DEF(RRC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq, rrc_pcch_data_req)
|
||||
|
||||
// gNB
|
||||
MESSAGE_DEF(NR_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataInd, nr_rrc_dcch_data_ind)
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#define RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_dcch_data_ind
|
||||
#define RRC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_pcch_data_req
|
||||
|
||||
// gNB
|
||||
#define NR_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_ind
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// Messages between RRC and PDCP layers
|
||||
typedef struct RrcDcchDataReq_s {
|
||||
@@ -61,6 +64,16 @@ typedef struct RrcDcchDataInd_s {
|
||||
uint8_t eNB_index; // LG: needed in UE
|
||||
} RrcDcchDataInd;
|
||||
|
||||
typedef struct NRRrcDcchDataInd_s {
|
||||
uint32_t frame;
|
||||
uint8_t dcch_index;
|
||||
uint32_t sdu_size;
|
||||
uint8_t *sdu_p;
|
||||
uint16_t rnti;
|
||||
uint8_t module_id;
|
||||
uint8_t gNB_index; // LG: needed in UE
|
||||
} NRRrcDcchDataInd;
|
||||
|
||||
typedef struct RrcPcchDataReq_s {
|
||||
uint32_t sdu_size;
|
||||
uint8_t *sdu_p;
|
||||
|
||||
@@ -299,6 +299,12 @@ typedef struct protocol_ctxt_s {
|
||||
(CTXT_Pp)->module_id, \
|
||||
(CTXT_Pp)->rnti
|
||||
|
||||
#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) \
|
||||
(CTXT_Pp)->frame, \
|
||||
((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB":" UE", \
|
||||
(CTXT_Pp)->module_id, \
|
||||
(CTXT_Pp)->rnti
|
||||
|
||||
#define CHECK_CTXT_ARGS(CTXT_Pp)
|
||||
|
||||
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
|
||||
|
||||
@@ -386,6 +386,7 @@ typedef struct s1ap_register_enb_req_s {
|
||||
uint8_t nb_mme;
|
||||
/* List of MME to connect to */
|
||||
net_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
|
||||
uint16_t mme_port[S1AP_MAX_NB_MME_IP_ADDRESS];
|
||||
uint8_t broadcast_plmn_num[S1AP_MAX_NB_MME_IP_ADDRESS];
|
||||
uint8_t broadcast_plmn_index[S1AP_MAX_NB_MME_IP_ADDRESS][PLMN_LIST_MAX_SIZE];
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ TASK_DEF(TASK_PROTO_AGENT, TASK_PRIORITY_MED, 200)
|
||||
|
||||
/// Radio Resource Control task
|
||||
TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED, 200)
|
||||
TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200)
|
||||
/// Non Access Stratum task
|
||||
TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200)
|
||||
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200)
|
||||
@@ -81,3 +82,8 @@ TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200)
|
||||
//MESSAGE GENERATOR TASK
|
||||
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200)
|
||||
|
||||
#ifdef ITTI_SIM
|
||||
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200)
|
||||
TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2511,6 +2511,9 @@ int RCconfig_S1(
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = 0;
|
||||
}
|
||||
|
||||
/* set S1-mme port (sctp) */
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).mme_port[l] = *S1ParamList.paramarray[l][ENB_MME_PORT_IDX].u16ptr;
|
||||
|
||||
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] <= S1AP_REGISTER_ENB_REQ(msg_p).num_plmn,
|
||||
"List of broadcast PLMN to be sent to MME can not be longer than actual "
|
||||
"PLMN list (max %d, but is %d)\n",
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define ENB_PARAMDEF_H_
|
||||
#include "common/config/config_paramdesc.h"
|
||||
#include "RRC_paramsvalues.h"
|
||||
#include "s1ap_eNB_default_values.h"
|
||||
|
||||
#define ENB_CONFIG_STRING_CC_NODE_FUNCTION "node_function"
|
||||
#define ENB_CONFIG_STRING_CC_NODE_TIMING "node_timing"
|
||||
@@ -910,6 +911,7 @@ typedef struct srb1_params_s {
|
||||
|
||||
#define ENB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4"
|
||||
#define ENB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6"
|
||||
#define ENB_CONFIG_STRING_MME_PORT "port"
|
||||
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active"
|
||||
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference"
|
||||
#define ENB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX "broadcast_plmn_index"
|
||||
@@ -924,14 +926,20 @@ typedef struct srb1_params_s {
|
||||
{ENB_CONFIG_STRING_MME_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX, NULL, 0, uptr:NULL, defintarrayval:NULL, TYPE_UINTARRAY, 6} \
|
||||
{ENB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX, NULL, 0, uptr:NULL, defintarrayval:NULL, TYPE_UINTARRAY, 6}, \
|
||||
{ENB_CONFIG_STRING_MME_PORT, NULL, 0, u16ptr:NULL, defuintval:S1AP_PORT_NUMBER, TYPE_UINT16, 0}, \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ENB_MME_IPV4_ADDRESS_IDX 0
|
||||
#define ENB_MME_IPV6_ADDRESS_IDX 1
|
||||
#define ENB_MME_IP_ADDRESS_ACTIVE_IDX 2
|
||||
#define ENB_MME_IP_ADDRESS_PREFERENCE_IDX 3
|
||||
#define ENB_MME_BROADCAST_PLMN_INDEX 4
|
||||
#define ENB_MME_PORT_IDX 5
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* X2 configuration parameters section name */
|
||||
|
||||
+28
-25
@@ -39,7 +39,7 @@
|
||||
|
||||
#include "x2ap_eNB.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "ngap_gNB.h"
|
||||
#include "sctp_eNB_task.h"
|
||||
#include "gtpv1u_eNB_task.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
@@ -75,26 +75,29 @@ static void configure_nr_rrc(uint32_t gnb_id)
|
||||
static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties)
|
||||
{
|
||||
uint32_t gnb_id;
|
||||
//MessageDef *msg_p;
|
||||
MessageDef *msg_p;
|
||||
uint32_t register_gnb_pending = 0;
|
||||
|
||||
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
|
||||
{
|
||||
//s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse
|
||||
if(NGAP_CONF_MODE){
|
||||
ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse
|
||||
|
||||
// note: there is an implicit relationship between the data structure and the message name
|
||||
msg_p = itti_alloc_new_message (TASK_GNB_APP, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse
|
||||
|
||||
// note: there is an implicit relationship between the data structure and the message name
|
||||
/*msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse
|
||||
RCconfig_NR_NG(msg_p, gnb_id);
|
||||
|
||||
ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse
|
||||
|
||||
RCconfig_NR_S1(msg_p, gnb_id);*/
|
||||
LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx);
|
||||
|
||||
itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
}
|
||||
|
||||
if (gnb_id == 0) RCconfig_nr_gtpu();
|
||||
|
||||
/*s1ap_register_gNB = &S1AP_REGISTER_ENB_REQ(msg_p); //Message Temporarily reuse
|
||||
LOG_I(GNB_APP,"default drx %d\n",s1ap_register_gNB->default_drx);*/
|
||||
|
||||
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
|
||||
|
||||
//itti_send_msg_to_task (TASK_S1AP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
|
||||
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
|
||||
|
||||
register_gnb_pending++;
|
||||
}
|
||||
@@ -173,7 +176,7 @@ void *gNB_app_task(void *args_p)
|
||||
__attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end);
|
||||
}
|
||||
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
/* Try to register each gNB */
|
||||
//registered_gnb = 0;
|
||||
__attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
|
||||
@@ -201,16 +204,16 @@ void *gNB_app_task(void *args_p)
|
||||
break;
|
||||
|
||||
|
||||
/*
|
||||
case S1AP_REGISTER_ENB_CNF:
|
||||
LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
|
||||
S1AP_REGISTER_ENB_CNF(msg_p).nb_mme);
|
||||
|
||||
case NGAP_REGISTER_GNB_CNF:
|
||||
LOG_I(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name,
|
||||
NGAP_REGISTER_GNB_CNF(msg_p).nb_amf);
|
||||
/*
|
||||
DevAssert(register_gnb_pending > 0);
|
||||
register_gnb_pending--;
|
||||
|
||||
// Check if at least gNB is registered with one MME
|
||||
if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) {
|
||||
// Check if at least gNB is registered with one AMF
|
||||
if (NGAP_REGISTER_GNB_CNF(msg_p).nb_amf > 0) {
|
||||
registered_gnb++;
|
||||
}
|
||||
|
||||
@@ -226,7 +229,7 @@ void *gNB_app_task(void *args_p)
|
||||
} else {
|
||||
uint32_t not_associated = gnb_nb - registered_gnb;
|
||||
|
||||
LOG_W(GNB_APP, " %d gNB %s not associated with a MME, retrying registration in %d seconds ...\n",
|
||||
LOG_W(GNB_APP, " %d gNB %s not associated with a AMF, retrying registration in %d seconds ...\n",
|
||||
not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY);
|
||||
|
||||
// Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds
|
||||
@@ -241,12 +244,12 @@ void *gNB_app_task(void *args_p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
*/
|
||||
case S1AP_DEREGISTERED_ENB_IND:
|
||||
LOG_W(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
|
||||
S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme);
|
||||
break;
|
||||
|
||||
case NGAP_DEREGISTERED_GNB_IND:
|
||||
LOG_W(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name,
|
||||
NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf);
|
||||
|
||||
/* TODO handle recovering of registration */
|
||||
break;
|
||||
|
||||
+174
-134
@@ -38,6 +38,7 @@
|
||||
#include "UTIL/OTG/otg_externs.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "ngap_gNB.h"
|
||||
#include "sctp_eNB_task.h"
|
||||
#include "sctp_default_values.h"
|
||||
// #include "SystemInformationBlockType2.h"
|
||||
@@ -341,8 +342,8 @@ void RCconfig_nr_flexran()
|
||||
/* gNB ID from configuration, as read in by RCconfig_RRC() */
|
||||
if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) {
|
||||
// Calculate a default gNB ID
|
||||
if (EPC_MODE_ENABLED)
|
||||
gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
|
||||
if (AMF_MODE_ENABLED)
|
||||
gnb_id = i + (ngap_generate_gNB_id () & 0xFFFFFF8);
|
||||
else
|
||||
gnb_id = i;
|
||||
} else {
|
||||
@@ -535,7 +536,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
AssertFatal (i<num_gnbs,"Failed to parse config file no %ith element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
/*
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
if (strcasecmp( *(GNBSParams[GNB_ASN1_VERBOSITY_IDX].strptr), GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
@@ -561,10 +562,10 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
|
||||
if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default gNB ID
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = i + (hash & 0xFFFF8);
|
||||
hash = ngap_generate_gNB_id ();
|
||||
gnb_id = i + (hash & 0xFFFFFF8);
|
||||
} else {
|
||||
gnb_id = i;
|
||||
}
|
||||
@@ -672,16 +673,19 @@ int RCconfig_nr_gtpu(void ) {
|
||||
|
||||
|
||||
|
||||
char* gnb_interface_name_for_NGU = NULL;
|
||||
char* gnb_ipv4_address_for_NGU = NULL;
|
||||
uint32_t gnb_port_for_NGU = 0;
|
||||
char* gnb_interface_name_for_S1U = NULL;
|
||||
char* gnb_ipv4_address_for_S1U = NULL;
|
||||
uint32_t gnb_port_for_S1U = 0;
|
||||
char *address = NULL;
|
||||
char *cidr = NULL;
|
||||
char gtpupath[MAX_OPTNAME_SIZE*2 + 8];
|
||||
|
||||
uint8_t gnb_mode = 0;
|
||||
|
||||
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
|
||||
|
||||
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
|
||||
paramdef_t GTPUParams[] = GNBGTPUPARAMS_DESC;
|
||||
LOG_I(GTPU,"Configuring GTPu\n");
|
||||
|
||||
@@ -691,15 +695,23 @@ int RCconfig_nr_gtpu(void ) {
|
||||
AssertFatal (num_gnbs >0,
|
||||
"Failed to parse config file no active gNodeBs in %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
|
||||
|
||||
|
||||
sprintf(gtpupath,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
config_get( GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath);
|
||||
|
||||
config_get(GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath);
|
||||
|
||||
config_get(NETParams,sizeof(NETParams)/sizeof(paramdef_t),gtpupath);
|
||||
|
||||
if (NETParams[0].strptr != NULL) { // SA
|
||||
LOG_I(GTPU, "SA mode \n");
|
||||
cidr = gnb_ipv4_address_for_NGU;
|
||||
gnb_mode = 0;
|
||||
} else {// NSA
|
||||
LOG_I(GTPU, "NSA mode \n");
|
||||
cidr = gnb_ipv4_address_for_S1U;
|
||||
gnb_mode = 1;
|
||||
}
|
||||
|
||||
address = strtok(cidr, "/");
|
||||
|
||||
|
||||
if (address) {
|
||||
MessageDef *message;
|
||||
AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, GTPV1U_ENB_S1_REQ))!=NULL,"");
|
||||
@@ -707,18 +719,25 @@ int RCconfig_nr_gtpu(void ) {
|
||||
// LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up);
|
||||
|
||||
|
||||
IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
|
||||
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
|
||||
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U;
|
||||
if (gnb_mode == 1) { // NSA
|
||||
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
|
||||
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
|
||||
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U;
|
||||
} else {// TODO SA
|
||||
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" );
|
||||
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
|
||||
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_NGU;
|
||||
}
|
||||
|
||||
itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
|
||||
} else
|
||||
LOG_E(GTPU,"invalid address for S1U\n");
|
||||
LOG_E(GTPU,"invalid address for NGU\n");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
|
||||
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
int j,k = 0;
|
||||
int gnb_id;
|
||||
@@ -741,7 +760,7 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
|
||||
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
/*
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
if (strcasecmp( *(GNBSParams[GNB_ASN1_VERBOSITY_IDX].strptr), GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
@@ -766,56 +785,61 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
|
||||
if (GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt>0) {
|
||||
// Output a list of all gNBs.
|
||||
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if (GNBParamList.numelt > 0) {
|
||||
for (k = 0; k < GNBParamList.numelt; k++) {
|
||||
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default gNB ID
|
||||
if (EPC_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFF8);
|
||||
} else {
|
||||
gnb_id = k;
|
||||
}
|
||||
} else {
|
||||
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default gNB ID
|
||||
if (AMF_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
|
||||
hash = ngap_generate_gNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFFFF8);
|
||||
} else {
|
||||
gnb_id = k;
|
||||
}
|
||||
} else {
|
||||
gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr);
|
||||
}
|
||||
|
||||
|
||||
// search if in active list
|
||||
for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) {
|
||||
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) {
|
||||
// search if in active list
|
||||
for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) {
|
||||
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) {
|
||||
paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC;
|
||||
paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0};
|
||||
paramdef_t SNSSAIParams[] = GNBSNSSAIPARAMS_DESC;
|
||||
paramlist_def_t SNSSAIParamList = {GNB_CONFIG_STRING_SNSSAI_LIST, NULL, 0};
|
||||
/* map parameter checking array instances to parameter definition array instances */
|
||||
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
|
||||
checkedparam_t config_check_SNSSAIParams [] = SNSSAIPARAMS_CHECK;
|
||||
|
||||
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
|
||||
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
|
||||
for (int J = 0; J < sizeof(SNSSAIParams) / sizeof(paramdef_t); ++J)
|
||||
SNSSAIParams[J].chkPptr = &(config_check_SNSSAIParams[J]);
|
||||
|
||||
paramdef_t S1Params[] = GNBS1PARAMS_DESC;
|
||||
paramlist_def_t S1ParamList = {GNB_CONFIG_STRING_MME_IP_ADDRESS,NULL,0};
|
||||
|
||||
paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC;
|
||||
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = gnb_id;
|
||||
|
||||
if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) {
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_MACRO_ENB;
|
||||
} else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) {
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_HOME_ENB;
|
||||
} else {
|
||||
AssertFatal (0,
|
||||
"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n",
|
||||
RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr));
|
||||
}
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
paramdef_t NGParams[] = GNBNGPARAMS_DESC;
|
||||
paramlist_def_t NGParamList = {GNB_CONFIG_STRING_AMF_IP_ADDRESS,NULL,0};
|
||||
|
||||
paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC;
|
||||
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
|
||||
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k);
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).gNB_id = gnb_id;
|
||||
|
||||
if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_MACRO_GNB;
|
||||
} else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_HOME_ENB;
|
||||
} else {
|
||||
AssertFatal (0,
|
||||
"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n",
|
||||
RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr));
|
||||
}
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).gNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
|
||||
AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
|
||||
&& !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
|
||||
"It seems that you use an old configuration file. Please change the existing\n"
|
||||
@@ -831,100 +855,116 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
|
||||
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
|
||||
PLMNParamList.numelt);
|
||||
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn = PLMNParamList.numelt;
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).num_plmn = PLMNParamList.numelt;
|
||||
|
||||
for (int l = 0; l < PLMNParamList.numelt; ++l) {
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).default_drx = 0;
|
||||
AssertFatal((S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 2) ||
|
||||
(S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 3),
|
||||
"BAD MNC DIGIT LENGTH %d",
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l]);
|
||||
}
|
||||
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
|
||||
config_getlist( &S1ParamList,S1Params,sizeof(S1Params)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0;
|
||||
|
||||
for (int l = 0; l < S1ParamList.numelt; l++) {
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme += 1;
|
||||
|
||||
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4_address,*(S1ParamList.paramarray[l][GNB_MME_IPV4_ADDRESS_IDX].strptr));
|
||||
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6_address,*(S1ParamList.paramarray[l][GNB_MME_IPV6_ADDRESS_IDX].strptr));
|
||||
char snssaistr[MAX_OPTNAME_SIZE*2 + 8];
|
||||
sprintf(snssaistr, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_PLMN_LIST, l);
|
||||
config_getlist(&SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams)/sizeof(paramdef_t), snssaistr);
|
||||
|
||||
if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) {
|
||||
}
|
||||
if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1;
|
||||
} else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) {
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1;
|
||||
} else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) {
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1;
|
||||
}
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).default_drx = 0;
|
||||
AssertFatal((NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 2) ||
|
||||
(NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 3),
|
||||
"BAD MNC DIGIT LENGTH %d",
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l]);
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).num_nssai[l] = SNSSAIParamList.numelt;
|
||||
for (int s = 0; s < SNSSAIParamList.numelt; ++s) {
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sST = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERIVE_TYPE_IDX].uptr;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 0;
|
||||
if(*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 1;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[0] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0xFF0000) >> 16;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[1] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0x00FF00) >> 8;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[2] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0x0000FF);
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
|
||||
config_getlist( &NGParamList,NGParams,sizeof(NGParams)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).nb_amf = 0;
|
||||
|
||||
for (int l = 0; l < NGParamList.numelt; l++) {
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).nb_amf += 1;
|
||||
|
||||
strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv4_address,*(NGParamList.paramarray[l][GNB_AMF_IPV4_ADDRESS_IDX].strptr));
|
||||
strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv6_address,*(NGParamList.paramarray[l][GNB_AMF_IPV6_ADDRESS_IDX].strptr));
|
||||
|
||||
if (S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr)
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].numelt;
|
||||
if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) {
|
||||
}
|
||||
if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1;
|
||||
} else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1;
|
||||
} else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) {
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1;
|
||||
}
|
||||
|
||||
if (NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr)
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].numelt;
|
||||
else
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = 0;
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = 0;
|
||||
|
||||
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] <= S1AP_REGISTER_ENB_REQ(msg_p).num_plmn,
|
||||
"List of broadcast PLMN to be sent to MME can not be longer than actual "
|
||||
AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] <= NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
|
||||
"List of broadcast PLMN to be sent to AMF can not be longer than actual "
|
||||
"PLMN list (max %d, but is %d)\n",
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn,
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]);
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]);
|
||||
|
||||
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]; ++el) {
|
||||
for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]; ++el) {
|
||||
/* UINTARRAY gets mapped to int, see config_libconfig.c:223 */
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr[el];
|
||||
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0
|
||||
&& S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn,
|
||||
"index for MME's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n",
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el],
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn);
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr[el];
|
||||
AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0
|
||||
&& NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
|
||||
"index for AMF's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n",
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el],
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).num_plmn);
|
||||
}
|
||||
|
||||
/* if no broadcasst_plmn array is defined, fill default values */
|
||||
if (S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1AP_REGISTER_ENB_REQ(msg_p).num_plmn;
|
||||
if (NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGAP_REGISTER_GNB_REQ(msg_p).num_plmn;
|
||||
|
||||
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el)
|
||||
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
|
||||
for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++el)
|
||||
NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// SCTP SETTING
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
|
||||
if (EPC_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
// SCTP SETTING
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
|
||||
if (AMF_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
|
||||
}
|
||||
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||
// NETWORK_INTERFACES
|
||||
// NETWORK_INTERFACES
|
||||
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
|
||||
|
||||
// S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U);
|
||||
cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr);
|
||||
address = strtok(cidr, "/");
|
||||
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0;
|
||||
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4 = 1;
|
||||
|
||||
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4_address, address);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU);
|
||||
cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr);
|
||||
address = strtok(cidr, "/");
|
||||
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0;
|
||||
NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1;
|
||||
|
||||
strcpy(NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4_address, address);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1021,10 +1061,10 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
for (k = 0; k < GNBParamList.numelt; k++) {
|
||||
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
|
||||
// Calculate a default eNB ID
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFF8);
|
||||
hash = ngap_generate_gNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFFFF8);
|
||||
} else {
|
||||
gnb_id = k;
|
||||
}
|
||||
@@ -1150,7 +1190,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
|
||||
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (AMF_MODE_ENABLED) {
|
||||
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
|
||||
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
|
||||
X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "platform_constants.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "s1ap_messages_types.h"
|
||||
#include "ngap_messages_types.h"
|
||||
|
||||
#ifdef CMAKER
|
||||
#include "rrc_messages_types.h"
|
||||
@@ -102,7 +103,7 @@ extern void NRRCConfig(void);
|
||||
//void ru_config_display(void);
|
||||
|
||||
void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc);
|
||||
int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i);
|
||||
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
|
||||
int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
|
||||
|
||||
#endif /* GNB_CONFIG_H_ */
|
||||
|
||||
@@ -150,7 +150,7 @@ typedef struct ccparams_nr_x2 {
|
||||
{GNB_CONFIG_STRING_GNB_ID, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_CELL_TYPE, NULL, 0, strptr:NULL, defstrval:"CELL_MACRO_GNB", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_NAME, NULL, 0, strptr:NULL, defstrval:"OAIgNodeB", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_TRACKING_AREA_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_TRACKING_AREA_CODE, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE_OLD, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_MOBILE_NETWORK_CODE_OLD, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_TRANSPORT_S_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_mac", TYPE_STRING, 0}, \
|
||||
@@ -236,38 +236,58 @@ typedef struct ccparams_nr_x2 {
|
||||
}
|
||||
|
||||
|
||||
/* SNSSAI ID configuration */
|
||||
|
||||
#define GNB_CONFIG_STRING_SNSSAI_LIST "snssaiList"
|
||||
|
||||
#define GNB_CONFIG_STRING_SLICE_SERIVE_TYPE "sst"
|
||||
#define GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR "sd"
|
||||
|
||||
/* MME configuration parameters section name */
|
||||
#define GNB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address"
|
||||
#define GNB_SLICE_SERIVE_TYPE_IDX 0
|
||||
#define GNB_SLICE_DIFFERENTIATOR_IDX 1
|
||||
|
||||
#define GNBSNSSAIPARAMS_DESC { \
|
||||
/* optname helpstr paramflags XXXptr def val type numelt */ \
|
||||
{GNB_CONFIG_STRING_SLICE_SERIVE_TYPE, "slice serive type", 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR, "slice differentiator", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
|
||||
}
|
||||
|
||||
#define SLICE_SERIVE_TYPE_OKRANGES {1,2,3,4}
|
||||
|
||||
#define SNSSAIPARAMS_CHECK { \
|
||||
{ .s1 = { config_check_intval, SLICE_SERIVE_TYPE_OKRANGES, 4 } }, \
|
||||
{ .s5 = { NULL } }, \
|
||||
}
|
||||
|
||||
/* AMF configuration parameters section name */
|
||||
#define GNB_CONFIG_STRING_AMF_IP_ADDRESS "amf_ip_address"
|
||||
|
||||
/* SRB1 configuration parameters names */
|
||||
|
||||
|
||||
#define GNB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4"
|
||||
#define GNB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6"
|
||||
#define GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active"
|
||||
#define GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference"
|
||||
#define GNB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX "broadcast_plmn_index"
|
||||
#define GNB_CONFIG_STRING_AMF_IPV4_ADDRESS "ipv4"
|
||||
#define GNB_CONFIG_STRING_AMF_IPV6_ADDRESS "ipv6"
|
||||
#define GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE "active"
|
||||
#define GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE "preference"
|
||||
#define GNB_CONFIG_STRING_AMF_BROADCAST_PLMN_INDEX "broadcast_plmn_index"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* MME configuration parameters */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define GNBS1PARAMS_DESC { \
|
||||
{GNB_CONFIG_STRING_MME_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_MME_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
#define GNBNGPARAMS_DESC { \
|
||||
{GNB_CONFIG_STRING_AMF_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_AMF_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
}
|
||||
|
||||
#define GNB_MME_IPV4_ADDRESS_IDX 0
|
||||
#define GNB_MME_IPV6_ADDRESS_IDX 1
|
||||
#define GNB_MME_IP_ADDRESS_ACTIVE_IDX 2
|
||||
#define GNB_MME_IP_ADDRESS_PREFERENCE_IDX 3
|
||||
#define GNB_MME_BROADCAST_PLMN_INDEX 4
|
||||
#define GNB_AMF_IPV4_ADDRESS_IDX 0
|
||||
#define GNB_AMF_IPV6_ADDRESS_IDX 1
|
||||
#define GNB_AMF_IP_ADDRESS_ACTIVE_IDX 2
|
||||
#define GNB_AMF_IP_ADDRESS_PREFERENCE_IDX 3
|
||||
#define GNB_AMF_BROADCAST_PLMN_INDEX 4
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* SCTP configuration parameters section name */
|
||||
@@ -295,11 +315,11 @@ typedef struct ccparams_nr_x2 {
|
||||
/* S1 interface configuration parameters section name */
|
||||
#define GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
|
||||
|
||||
#define GNB_INTERFACE_NAME_FOR_S1_MME_IDX 0
|
||||
#define GNB_IPV4_ADDRESS_FOR_S1_MME_IDX 1
|
||||
#define GNB_INTERFACE_NAME_FOR_S1U_IDX 2
|
||||
#define GNB_IPV4_ADDR_FOR_S1U_IDX 3
|
||||
#define GNB_PORT_FOR_S1U_IDX 4
|
||||
#define GNB_INTERFACE_NAME_FOR_NG_AMF_IDX 0
|
||||
#define GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX 1
|
||||
#define GNB_INTERFACE_NAME_FOR_NGU_IDX 2
|
||||
#define GNB_IPV4_ADDR_FOR_NGU_IDX 3
|
||||
#define GNB_PORT_FOR_NGU_IDX 4
|
||||
#define GNB_IPV4_ADDR_FOR_X2C_IDX 5
|
||||
#define GNB_PORT_FOR_X2C_IDX 6
|
||||
|
||||
@@ -307,9 +327,15 @@ typedef struct ccparams_nr_x2 {
|
||||
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME "GNB_INTERFACE_NAME_FOR_S1_MME"
|
||||
#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME "GNB_IPV4_ADDRESS_FOR_S1_MME"
|
||||
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U "GNB_INTERFACE_NAME_FOR_S1U"
|
||||
#define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U "GNB_IPV4_ADDRESS_FOR_S1U"
|
||||
#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1U "GNB_IPV4_ADDRESS_FOR_S1U"
|
||||
#define GNB_CONFIG_STRING_GNB_PORT_FOR_S1U "GNB_PORT_FOR_S1U"
|
||||
|
||||
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF "GNB_INTERFACE_NAME_FOR_NG_AMF"
|
||||
#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF "GNB_IPV4_ADDRESS_FOR_NG_AMF"
|
||||
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU "GNB_INTERFACE_NAME_FOR_NGU"
|
||||
#define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU "GNB_IPV4_ADDRESS_FOR_NGU"
|
||||
#define GNB_CONFIG_STRING_GNB_PORT_FOR_NGU "GNB_PORT_FOR_NGU"
|
||||
|
||||
/* X2 interface configuration parameters names */
|
||||
#define GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C "GNB_IPV4_ADDRESS_FOR_X2C"
|
||||
#define GNB_CONFIG_STRING_ENB_PORT_FOR_X2C "GNB_PORT_FOR_X2C"
|
||||
@@ -319,11 +345,11 @@ typedef struct ccparams_nr_x2 {
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define GNBNETPARAMS_DESC { \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \
|
||||
}
|
||||
@@ -335,8 +361,11 @@ typedef struct ccparams_nr_x2 {
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define GNBGTPUPARAMS_DESC { \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:&gnb_interface_name_for_NGU, defstrval:"lo", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:&gnb_ipv4_address_for_NGU, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:&gnb_port_for_NGU, defintval:2152, TYPE_UINT, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:&gnb_interface_name_for_S1U, defstrval:"lo", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:&gnb_port_for_S1U, defintval:2152, TYPE_UINT, 0} \
|
||||
}
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -157,93 +157,93 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH) {
|
||||
// E.g. in row 20 and column 5 we have set value 66 ('0001000010') which means RACH can be sent at subframe 1 or 6
|
||||
int64_t table_6_3_3_2_2_prachConfig_Index [256][9] = {
|
||||
//format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration
|
||||
{0, -1, 16, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{0, -1, 16, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{0, -1, 16, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{0, -1, 16, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{0, -1, 8, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{0, -1, 8, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{0, -1, 8, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{0, -1, 8, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{0, -1, 4, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{0, -1, 4, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{0, -1, 4, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{0, -1, 4, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{0, -1, 2, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{0, -1, 2, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{0, -1, 2, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{0, -1, 2, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{0, -1, 1, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{0, -1, 1, 0, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{0, -1, 1, 0, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{0, -1, 1, 0, 66, 0, -1, -1, 0}, // (subframe number) 1,6
|
||||
{0, -1, 1, 0, 132, 0, -1, -1, 0}, // (subframe number) 2,7
|
||||
{0, -1, 1, 0, 264, 0, -1, -1, 0}, // (subframe number) 3,8
|
||||
{0, -1, 1, 0, 146, 0, -1, -1, 0}, // (subframe number) 1,4,7
|
||||
{0, -1, 1, 0, 292, 0, -1, -1, 0}, // (subframe number) 2,5,8
|
||||
{0, -1, 1, 0, 584, 0, -1, -1, 0}, // (subframe number) 3, 6, 9
|
||||
{0, -1, 1, 0, 341, 0, -1, -1, 0}, // (subframe number) 0,2,4,6,8
|
||||
{0, -1, 1, 0, 682, 0, -1, -1, 0}, // (subframe number) 1,3,5,7,9
|
||||
{0, -1, 1, 0, 1023, 0, -1, -1, 0}, // (subframe number) 0,1,2,3,4,5,6,7,8,9
|
||||
{1, -1, 16, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{1, -1, 16, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{1, -1, 16, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{1, -1, 16, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{1, -1, 8, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{1, -1, 8, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{1, -1, 8, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{1, -1, 8, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{1, -1, 4, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{1, -1, 4, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{1, -1, 4, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{1, -1, 4, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{1, -1, 2, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{1, -1, 2, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{1, -1, 2, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{1, -1, 2, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{1, -1, 1, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{1, -1, 1, 0, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{1, -1, 1, 0, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{1, -1, 1, 0, 66, 0, -1, -1, 0}, // (subframe number) 1,6
|
||||
{1, -1, 1, 0, 132, 0, -1, -1, 0}, // (subframe number) 2,7
|
||||
{1, -1, 1, 0, 264, 0, -1, -1, 0}, // (subframe number) 3,8
|
||||
{1, -1, 1, 0, 146, 0, -1, -1, 0}, // (subframe number) 1,4,7
|
||||
{1, -1, 1, 0, 292, 0, -1, -1, 0}, // (subframe number) 2,5,8
|
||||
{1, -1, 1, 0, 584, 0, -1, -1, 0}, // (subframe number) 3,6,9
|
||||
{2, -1, 16, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{2, -1, 8, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{2, -1, 4, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{2, -1, 2, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{2, -1, 2, 0, 32, 0, -1, -1, 0}, // (subframe number) 5
|
||||
{2, -1, 1, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{2, -1, 1, 0, 32, 0, -1, -1, 0}, // (subframe number) 5
|
||||
{3, -1, 16, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{3, -1, 16, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{3, -1, 16, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{3, -1, 16, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{3, -1, 8, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{3, -1, 8, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{3, -1, 8, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{3, -1, 4, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{3, -1, 4, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{3, -1, 4, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{3, -1, 4, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{3, -1, 2, 1, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{3, -1, 2, 1, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{3, -1, 2, 1, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{3, -1, 2, 1, 512, 0, -1, -1, 0}, // (subframe number) 9
|
||||
{3, -1, 1, 0, 2, 0, -1, -1, 0}, // (subframe number) 1
|
||||
{3, -1, 1, 0, 16, 0, -1, -1, 0}, // (subframe number) 4
|
||||
{3, -1, 1, 0, 128, 0, -1, -1, 0}, // (subframe number) 7
|
||||
{3, -1, 1, 0, 66, 0, -1, -1, 0}, // (subframe number) 1,6
|
||||
{3, -1, 1, 0, 132, 0, -1, -1, 0}, // (subframe number) 2,7
|
||||
{3, -1, 1, 0, 264, 0, -1, -1, 0}, // (subframe number) 3,8
|
||||
{3, -1, 1, 0, 146, 0, -1, -1, 0}, // (subframe number) 1,4,7
|
||||
{3, -1, 1, 0, 292, 0, -1, -1, 0}, // (subframe number) 2,5,8
|
||||
{3, -1, 1, 0, 584, 0, -1, -1, 0}, // (subframe number) 3, 6, 9
|
||||
{3, -1, 1, 0, 341, 0, -1, -1, 0}, // (subframe number) 0,2,4,6,8
|
||||
{3, -1, 1, 0, 682, 0, -1, -1, 0}, // (subframe number) 1,3,5,7,9
|
||||
{3, -1, 1, 0, 1023, 0, -1, -1, 0}, // (subframe number) 0,1,2,3,4,5,6,7,8,9
|
||||
{0, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{0, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{0, -1, 16, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{0, -1, 16, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{0, -1, 8, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{0, -1, 8, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{0, -1, 8, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{0, -1, 8, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{0, -1, 4, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{0, -1, 4, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{0, -1, 4, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{0, -1, 4, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{0, -1, 2, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{0, -1, 2, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{0, -1, 2, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{0, -1, 2, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{0, -1, 1, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{0, -1, 1, 0, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{0, -1, 1, 0, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{0, -1, 1, 0, 66, 0, 1, 1, 0}, // (subframe number) 1,6
|
||||
{0, -1, 1, 0, 132, 0, 1, 1, 0}, // (subframe number) 2,7
|
||||
{0, -1, 1, 0, 264, 0, 1, 1, 0}, // (subframe number) 3,8
|
||||
{0, -1, 1, 0, 146, 0, 1, 1, 0}, // (subframe number) 1,4,7
|
||||
{0, -1, 1, 0, 292, 0, 1, 1, 0}, // (subframe number) 2,5,8
|
||||
{0, -1, 1, 0, 584, 0, 1, 1, 0}, // (subframe number) 3, 6, 9
|
||||
{0, -1, 1, 0, 341, 0, 1, 1, 0}, // (subframe number) 0,2,4,6,8
|
||||
{0, -1, 1, 0, 682, 0, 1, 1, 0}, // (subframe number) 1,3,5,7,9
|
||||
{0, -1, 1, 0, 1023, 0, 1, 1, 0}, // (subframe number) 0,1,2,3,4,5,6,7,8,9
|
||||
{1, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{1, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{1, -1, 16, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{1, -1, 16, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{1, -1, 8, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{1, -1, 8, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{1, -1, 8, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{1, -1, 8, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{1, -1, 4, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{1, -1, 4, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{1, -1, 4, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{1, -1, 4, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{1, -1, 2, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{1, -1, 2, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{1, -1, 2, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{1, -1, 2, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{1, -1, 1, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{1, -1, 1, 0, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{1, -1, 1, 0, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{1, -1, 1, 0, 66, 0, 1, 1, 0}, // (subframe number) 1,6
|
||||
{1, -1, 1, 0, 132, 0, 1, 1, 0}, // (subframe number) 2,7
|
||||
{1, -1, 1, 0, 264, 0, 1, 1, 0}, // (subframe number) 3,8
|
||||
{1, -1, 1, 0, 146, 0, 1, 1, 0}, // (subframe number) 1,4,7
|
||||
{1, -1, 1, 0, 292, 0, 1, 1, 0}, // (subframe number) 2,5,8
|
||||
{1, -1, 1, 0, 584, 0, 1, 1, 0}, // (subframe number) 3,6,9
|
||||
{2, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{2, -1, 8, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{2, -1, 4, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{2, -1, 2, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{2, -1, 2, 0, 32, 0, 1, 1, 0}, // (subframe number) 5
|
||||
{2, -1, 1, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{2, -1, 1, 0, 32, 0, 1, 1, 0}, // (subframe number) 5
|
||||
{3, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{3, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{3, -1, 16, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{3, -1, 16, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{3, -1, 8, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{3, -1, 8, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{3, -1, 8, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{3, -1, 4, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{3, -1, 4, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{3, -1, 4, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{3, -1, 4, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{3, -1, 2, 1, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{3, -1, 2, 1, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{3, -1, 2, 1, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{3, -1, 2, 1, 512, 0, 1, 1, 0}, // (subframe number) 9
|
||||
{3, -1, 1, 0, 2, 0, 1, 1, 0}, // (subframe number) 1
|
||||
{3, -1, 1, 0, 16, 0, 1, 1, 0}, // (subframe number) 4
|
||||
{3, -1, 1, 0, 128, 0, 1, 1, 0}, // (subframe number) 7
|
||||
{3, -1, 1, 0, 66, 0, 1, 1, 0}, // (subframe number) 1,6
|
||||
{3, -1, 1, 0, 132, 0, 1, 1, 0}, // (subframe number) 2,7
|
||||
{3, -1, 1, 0, 264, 0, 1, 1, 0}, // (subframe number) 3,8
|
||||
{3, -1, 1, 0, 146, 0, 1, 1, 0}, // (subframe number) 1,4,7
|
||||
{3, -1, 1, 0, 292, 0, 1, 1, 0}, // (subframe number) 2,5,8
|
||||
{3, -1, 1, 0, 584, 0, 1, 1, 0}, // (subframe number) 3, 6, 9
|
||||
{3, -1, 1, 0, 341, 0, 1, 1, 0}, // (subframe number) 0,2,4,6,8
|
||||
{3, -1, 1, 0, 682, 0, 1, 1, 0}, // (subframe number) 1,3,5,7,9
|
||||
{3, -1, 1, 0, 1023, 0, 1, 1, 0}, // (subframe number) 0,1,2,3,4,5,6,7,8,9
|
||||
{0xa1, -1, 16, 0, 528, 0, 1, 6, 2}, // (subframe number) 4,9
|
||||
{0xa1, -1, 16, 1, 16, 0, 2, 6, 2}, // (subframe number) 4
|
||||
{0xa1, -1, 8, 0, 528, 0, 1, 6, 2}, // (subframe number) 4,9
|
||||
@@ -417,73 +417,73 @@ int64_t table_6_3_3_2_2_prachConfig_Index [256][9] = {
|
||||
// Table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum
|
||||
int64_t table_6_3_3_2_3_prachConfig_Index [256][9] = {
|
||||
//format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration
|
||||
{0, -1, 16, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 8, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 4, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 0, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 0, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{0, -1, 2, 1, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{0, -1, 1, 0, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{0, -1, 1, 0, 256, 0, -1, -1, 0}, // (subrame number 8)
|
||||
{0, -1, 1, 0, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{0, -1, 1, 0, 64, 0, -1, -1, 0}, // (subrame number 6)
|
||||
{0, -1, 1, 0, 32, 0, -1, -1, 0}, // (subrame number 5)
|
||||
{0, -1, 1, 0, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{0, -1, 1, 0, 8, 0, -1, -1, 0}, // (subrame number 3)
|
||||
{0, -1, 1, 0, 4, 0, -1, -1, 0}, // (subrame number 2)
|
||||
{0, -1, 1, 0, 66, 0, -1, -1, 0}, // (subrame number 1,6)
|
||||
{0, -1, 1, 0, 66, 7, -1, -1, 0}, // (subrame number 1,6)
|
||||
{0, -1, 1, 0, 528, 0, -1, -1, 0}, // (subrame number 4,9)
|
||||
{0, -1, 1, 0, 264, 0, -1, -1, 0}, // (subrame number 3,8)
|
||||
{0, -1, 1, 0, 132, 0, -1, -1, 0}, // (subrame number 2,7)
|
||||
{0, -1, 1, 0, 768, 0, -1, -1, 0}, // (subrame number 8,9)
|
||||
{0, -1, 1, 0, 784, 0, -1, -1, 0}, // (subrame number 4,8,9)
|
||||
{0, -1, 1, 0, 536, 0, -1, -1, 0}, // (subrame number 3,4,9)
|
||||
{0, -1, 1, 0, 896, 0, -1, -1, 0}, // (subrame number 7,8,9)
|
||||
{0, -1, 1, 0, 792, 0, -1, -1, 0}, // (subrame number 3,4,8,9)
|
||||
{0, -1, 1, 0, 960, 0, -1, -1, 0}, // (subrame number 6,7,8,9)
|
||||
{0, -1, 1, 0, 594, 0, -1, -1, 0}, // (subrame number 1,4,6,9)
|
||||
{0, -1, 1, 0, 682, 0, -1, -1, 0}, // (subrame number 1,3,5,7,9)
|
||||
{1, -1, 16, 1, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{1, -1, 8, 1, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{1, -1, 4, 1, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{1, -1, 2, 0, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{1, -1, 2, 1, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{1, -1, 1, 0, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{2, -1, 16, 1, 64, 0, -1, -1, 0}, // (subrame number 6)
|
||||
{2, -1, 8, 1, 64, 0, -1, -1, 0}, // (subrame number 6)
|
||||
{2, -1, 4, 1, 64, 0, -1, -1, 0}, // (subrame number 6)
|
||||
{2, -1, 2, 0, 64, 7, -1, -1, 0}, // (subrame number 6)
|
||||
{2, -1, 2, 1, 64, 7, -1, -1, 0}, // (subrame number 6)
|
||||
{2, -1, 1, 0, 64, 7, -1, -1, 0}, // (subrame number 6)
|
||||
{3, -1, 16, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 8, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 4, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 0, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 1, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 0, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{3, -1, 2, 1, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{3, -1, 1, 0, 512, 0, -1, -1, 0}, // (subrame number 9)
|
||||
{3, -1, 1, 0, 256, 0, -1, -1, 0}, // (subrame number 8)
|
||||
{3, -1, 1, 0, 128, 0, -1, -1, 0}, // (subrame number 7)
|
||||
{3, -1, 1, 0, 64, 0, -1, -1, 0}, // (subrame number 6)
|
||||
{3, -1, 1, 0, 32, 0, -1, -1, 0}, // (subrame number 5)
|
||||
{3, -1, 1, 0, 16, 0, -1, -1, 0}, // (subrame number 4)
|
||||
{3, -1, 1, 0, 8, 0, -1, -1, 0}, // (subrame number 3)
|
||||
{3, -1, 1, 0, 4, 0, -1, -1, 0}, // (subrame number 2)
|
||||
{3, -1, 1, 0, 66, 0, -1, -1, 0}, // (subrame number 1,6)
|
||||
{3, -1, 1, 0, 66, 7, -1, -1, 0}, // (subrame number 1,6)
|
||||
{3, -1, 1, 0, 528, 0, -1, -1, 0}, // (subrame number 4,9)
|
||||
{3, -1, 1, 0, 264, 0, -1, -1, 0}, // (subrame number 3,8)
|
||||
{3, -1, 1, 0, 132, 0, -1, -1, 0}, // (subrame number 2,7)
|
||||
{3, -1, 1, 0, 768, 0, -1, -1, 0}, // (subrame number 8,9)
|
||||
{3, -1, 1, 0, 784, 0, -1, -1, 0}, // (subrame number 4,8,9)
|
||||
{3, -1, 1, 0, 536, 0, -1, -1, 0}, // (subrame number 3,4,9)
|
||||
{3, -1, 1, 0, 896, 0, -1, -1, 0}, // (subrame number 7,8,9)
|
||||
{3, -1, 1, 0, 792, 0, -1, -1, 0}, // (subrame number 3,4,8,9)
|
||||
{3, -1, 1, 0, 594, 0, -1, -1, 0}, // (subrame number 1,4,6,9)
|
||||
{3, -1, 1, 0, 682, 0, -1, -1, 0}, // (subrame number 1,3,5,7,9)
|
||||
{0, -1, 16, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 8, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 4, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 0, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 2, 0, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{0, -1, 2, 1, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{0, -1, 1, 0, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{0, -1, 1, 0, 256, 0, 1, 1, 0}, // (subrame number 8)
|
||||
{0, -1, 1, 0, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{0, -1, 1, 0, 64, 0, 1, 1, 0}, // (subrame number 6)
|
||||
{0, -1, 1, 0, 32, 0, 1, 1, 0}, // (subrame number 5)
|
||||
{0, -1, 1, 0, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{0, -1, 1, 0, 8, 0, 1, 1, 0}, // (subrame number 3)
|
||||
{0, -1, 1, 0, 4, 0, 1, 1, 0}, // (subrame number 2)
|
||||
{0, -1, 1, 0, 66, 0, 1, 1, 0}, // (subrame number 1,6)
|
||||
{0, -1, 1, 0, 66, 7, 1, 1, 0}, // (subrame number 1,6)
|
||||
{0, -1, 1, 0, 528, 0, 1, 1, 0}, // (subrame number 4,9)
|
||||
{0, -1, 1, 0, 264, 0, 1, 1, 0}, // (subrame number 3,8)
|
||||
{0, -1, 1, 0, 132, 0, 1, 1, 0}, // (subrame number 2,7)
|
||||
{0, -1, 1, 0, 768, 0, 1, 1, 0}, // (subrame number 8,9)
|
||||
{0, -1, 1, 0, 784, 0, 1, 1, 0}, // (subrame number 4,8,9)
|
||||
{0, -1, 1, 0, 536, 0, 1, 1, 0}, // (subrame number 3,4,9)
|
||||
{0, -1, 1, 0, 896, 0, 1, 1, 0}, // (subrame number 7,8,9)
|
||||
{0, -1, 1, 0, 792, 0, 1, 1, 0}, // (subrame number 3,4,8,9)
|
||||
{0, -1, 1, 0, 960, 0, 1, 1, 0}, // (subrame number 6,7,8,9)
|
||||
{0, -1, 1, 0, 594, 0, 1, 1, 0}, // (subrame number 1,4,6,9)
|
||||
{0, -1, 1, 0, 682, 0, 1, 1, 0}, // (subrame number 1,3,5,7,9)
|
||||
{1, -1, 16, 1, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{1, -1, 8, 1, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{1, -1, 4, 1, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{1, -1, 2, 0, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{1, -1, 2, 1, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{1, -1, 1, 0, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{2, -1, 16, 1, 64, 0, 1, 1, 0}, // (subrame number 6)
|
||||
{2, -1, 8, 1, 64, 0, 1, 1, 0}, // (subrame number 6)
|
||||
{2, -1, 4, 1, 64, 0, 1, 1, 0}, // (subrame number 6)
|
||||
{2, -1, 2, 0, 64, 7, 1, 1, 0}, // (subrame number 6)
|
||||
{2, -1, 2, 1, 64, 7, 1, 1, 0}, // (subrame number 6)
|
||||
{2, -1, 1, 0, 64, 7, 1, 1, 0}, // (subrame number 6)
|
||||
{3, -1, 16, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 8, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 4, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 0, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 1, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 2, 0, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{3, -1, 2, 1, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{3, -1, 1, 0, 512, 0, 1, 1, 0}, // (subrame number 9)
|
||||
{3, -1, 1, 0, 256, 0, 1, 1, 0}, // (subrame number 8)
|
||||
{3, -1, 1, 0, 128, 0, 1, 1, 0}, // (subrame number 7)
|
||||
{3, -1, 1, 0, 64, 0, 1, 1, 0}, // (subrame number 6)
|
||||
{3, -1, 1, 0, 32, 0, 1, 1, 0}, // (subrame number 5)
|
||||
{3, -1, 1, 0, 16, 0, 1, 1, 0}, // (subrame number 4)
|
||||
{3, -1, 1, 0, 8, 0, 1, 1, 0}, // (subrame number 3)
|
||||
{3, -1, 1, 0, 4, 0, 1, 1, 0}, // (subrame number 2)
|
||||
{3, -1, 1, 0, 66, 0, 1, 1, 0}, // (subrame number 1,6)
|
||||
{3, -1, 1, 0, 66, 7, 1, 1, 0}, // (subrame number 1,6)
|
||||
{3, -1, 1, 0, 528, 0, 1, 1, 0}, // (subrame number 4,9)
|
||||
{3, -1, 1, 0, 264, 0, 1, 1, 0}, // (subrame number 3,8)
|
||||
{3, -1, 1, 0, 132, 0, 1, 1, 0}, // (subrame number 2,7)
|
||||
{3, -1, 1, 0, 768, 0, 1, 1, 0}, // (subrame number 8,9)
|
||||
{3, -1, 1, 0, 784, 0, 1, 1, 0}, // (subrame number 4,8,9)
|
||||
{3, -1, 1, 0, 536, 0, 1, 1, 0}, // (subrame number 3,4,9)
|
||||
{3, -1, 1, 0, 896, 0, 1, 1, 0}, // (subrame number 7,8,9)
|
||||
{3, -1, 1, 0, 792, 0, 1, 1, 0}, // (subrame number 3,4,8,9)
|
||||
{3, -1, 1, 0, 594, 0, 1, 1, 0}, // (subrame number 1,4,6,9)
|
||||
{3, -1, 1, 0, 682, 0, 1, 1, 0}, // (subrame number 1,3,5,7,9)
|
||||
{0xa1, -1, 16, 1, 512, 0, 2, 6, 2}, // (subrame number 9)
|
||||
{0xa1, -1, 8, 1, 512, 0, 2, 6, 2}, // (subrame number 9)
|
||||
{0xa1, -1, 4, 1, 512, 0, 1, 6, 2}, // (subrame number 9)
|
||||
|
||||
@@ -96,7 +96,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
@param module_id_t mod_id module ID
|
||||
@param int cc_id CC ID
|
||||
@param frame_t frame frame number
|
||||
@param int slot reference number */
|
||||
@param int slot reference number
|
||||
@param UE_nr_rxtx_proc_t *proc pointer to process context */
|
||||
void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
fapi_nr_dl_config_request_t *dl_config,
|
||||
fapi_nr_ul_config_request_t *ul_config,
|
||||
@@ -104,7 +105,8 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
module_id_t mod_id,
|
||||
int cc_id,
|
||||
frame_t frame,
|
||||
int slot);
|
||||
int slot,
|
||||
int thread_id);
|
||||
|
||||
/* \brief Get SR payload (0,1) from UE MAC
|
||||
@param Mod_id Instance id of UE in machine
|
||||
@@ -211,9 +213,10 @@ and fills the PRACH PDU per each FD occasion.
|
||||
@param module_idP Index of UE instance
|
||||
@param frameP Frame index
|
||||
@param slotP Slot index
|
||||
@param thread_id RX/TX Thread ID
|
||||
@returns void
|
||||
*/
|
||||
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
|
||||
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id);
|
||||
|
||||
/* \brief This function schedules the Msg3 transmission
|
||||
@param
|
||||
@@ -264,7 +267,7 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4
|
||||
@param CC_id Component Carrier Index
|
||||
@param frame
|
||||
@param gNB_id gNB index
|
||||
@param nr_tti_tx slot for PRACH transmission
|
||||
@param nr_slot_tx slot for PRACH transmission
|
||||
@returns indication to generate PRACH to phy */
|
||||
uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
fapi_nr_ul_config_prach_pdu *prach_pdu,
|
||||
@@ -273,7 +276,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
UE_MODE_t UE_mode,
|
||||
frame_t frame,
|
||||
uint8_t gNB_id,
|
||||
int nr_tti_tx);
|
||||
int nr_slot_tx);
|
||||
|
||||
/* \brief Function implementing the routine for the selection of Random Access resources (5.1.2 TS 38.321).
|
||||
@param module_idP Index of UE instance
|
||||
|
||||
@@ -401,7 +401,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
UE_MODE_t UE_mode,
|
||||
frame_t frame,
|
||||
uint8_t gNB_id,
|
||||
int nr_tti_tx){
|
||||
int nr_slot_tx){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES];
|
||||
@@ -489,9 +489,9 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
}
|
||||
|
||||
//mac->RA_tx_frame = frame;
|
||||
//mac->RA_tx_subframe = nr_tti_tx;
|
||||
//mac->RA_tx_slot = nr_slot_tx;
|
||||
//mac->RA_backoff_frame = frame;
|
||||
//mac->RA_backoff_subframe = nr_tti_tx;
|
||||
//mac->RA_backoff_slot = nr_slot_tx;
|
||||
|
||||
if (size_sdu > 0) {
|
||||
|
||||
@@ -510,7 +510,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
if (mac->generate_nr_prach == 1)
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
|
||||
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
||||
(uint8_t *) payload, // UL MAC pdu pointer
|
||||
@@ -544,7 +544,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
// - handle backoff and raResponseWindow params
|
||||
|
||||
// LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
|
||||
// mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
|
||||
// mod_id, frame, nr_slot_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
|
||||
|
||||
if (mac->RA_BI_found){
|
||||
prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator;
|
||||
@@ -564,7 +564,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
|
||||
} else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) {
|
||||
|
||||
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: nr_tti_tx %d: RAR reception failed \n", mod_id, frame, nr_tti_tx);
|
||||
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: nr_slot_tx %d: RAR reception failed \n", mod_id, frame, nr_slot_tx);
|
||||
|
||||
mac->ra_state = RA_UE_IDLE;
|
||||
mac->RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||
@@ -622,22 +622,22 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
// frame_diff = (sframe_t) frame - mac->RA_backoff_frame;
|
||||
// if (frame_diff < 0) frame_diff = -frame_diff;
|
||||
// mac->RA_backoff_frame = frame;
|
||||
// mac->RA_backoff_subframe = nr_tti_tx;
|
||||
// mac->RA_backoff_slot = nr_slot_tx;
|
||||
// }
|
||||
// compute RA window parameters
|
||||
// if (mac->RA_window_cnt > 0){
|
||||
// frame_diff = (frame_t) frame - mac->RA_tx_frame;
|
||||
// if (frame_diff < 0) frame_diff = -frame_diff;
|
||||
// mac->RA_window_cnt -= ((10 * frame_diff) + (nr_tti_tx - mac->RA_tx_subframe));
|
||||
// LOG_D(MAC, "[MAC][UE %d][RAPROC] Frame %d, subframe %d: RA Active, adjusted window cnt %d\n", mod_id, frame, nr_tti_tx, mac->RA_window_cnt);
|
||||
// mac->RA_window_cnt -= ((10 * frame_diff) + (nr_slot_tx - mac->RA_tx_subframe));
|
||||
// LOG_D(MAC, "[MAC][UE %d][RAPROC] Frame %d, subframe %d: RA Active, adjusted window cnt %d\n", mod_id, frame, nr_slot_tx, mac->RA_window_cnt);
|
||||
// }
|
||||
|
||||
// mac->RA_tx_frame = frame;
|
||||
// mac->RA_tx_subframe = nr_tti_tx;
|
||||
// mac->RA_tx_slot = nr_slot_tx;
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
if (mac->generate_nr_prach == 1)
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -646,12 +646,12 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
LOG_D(MAC, "[MAC][UE %d][RAPROC][%d.%d]: RAR not received yet (RA window count %d) \n",
|
||||
mod_id,
|
||||
frame,
|
||||
nr_tti_tx,
|
||||
nr_slot_tx,
|
||||
mac->RA_window_cnt);
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
if (mac->generate_nr_prach == 1)
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
|
||||
int ss_id;
|
||||
uint8_t bwp_id = 1, coreset_id = 1;
|
||||
//NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_BWP_Downlink_t *bwp = mac->DLbwp[bwp_id - 1];
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
|
||||
@@ -775,7 +775,8 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
module_id_t mod_id,
|
||||
int cc_id,
|
||||
frame_t frame,
|
||||
int slot){
|
||||
int slot,
|
||||
int thread_id){
|
||||
|
||||
scheduled_response->dl_config = dl_config;
|
||||
scheduled_response->ul_config = ul_config;
|
||||
@@ -784,7 +785,7 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
scheduled_response->CC_id = cc_id;
|
||||
scheduled_response->frame = frame;
|
||||
scheduled_response->slot = slot;
|
||||
|
||||
scheduled_response->thread_id = thread_id;
|
||||
}
|
||||
|
||||
uint32_t get_ssb_slot(uint32_t ssb_index){
|
||||
@@ -1471,7 +1472,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
*/
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
@@ -1485,7 +1486,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
dcireq.dl_config_req.number_pdus = 0;
|
||||
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
|
||||
|
||||
fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot);
|
||||
fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
@@ -1649,7 +1650,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
}
|
||||
}
|
||||
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config_req, &tx_req, mod_id, cc_id, rx_frame, rx_slot);
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config_req, &tx_req, mod_id, cc_id, rx_frame, rx_slot, ul_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
@@ -1718,7 +1719,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
ul_config_list->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
|
||||
ul_config->number_pdus++;
|
||||
// scheduled_response
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, ul_info->module_id, ul_info->cc_id, ul_info->frame_rx, ul_info->slot_rx);
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, ul_info->module_id, ul_info->cc_id, ul_info->frame_rx, ul_info->slot_rx, ul_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
@@ -1773,7 +1774,7 @@ void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac,
|
||||
// PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3.
|
||||
// - todo:
|
||||
// - Partial configuration is actually already stored in (fapi_nr_prach_config_t) &mac->phy_config.config_req->prach_config
|
||||
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
||||
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id) {
|
||||
|
||||
uint16_t format, format0, format1, ncs;
|
||||
int is_nr_prach_slot;
|
||||
@@ -1901,7 +1902,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
} // if format1
|
||||
} // is_nr_prach_slot
|
||||
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP);
|
||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
} // if is_nr_UL_slot
|
||||
@@ -1967,7 +1968,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
|
||||
csi_MeasConfig_t csi_MeasConfig = ue->csi_MeasConfig;
|
||||
PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig= ue->PUSCH_ServingCellConfig;
|
||||
PDSCH_ServingCellConfig_t PDSCH_ServingCellConfig= ue->PDSCH_ServingCellConfig;
|
||||
NR_UE_PDCCH *pdcch_vars2 = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id];
|
||||
NR_UE_PDCCH *pdcch_vars2 = ue->pdcch_vars[proc->thread_id][eNB_id];
|
||||
// 1 CARRIER_IN
|
||||
// crossCarrierSchedulingConfig from higher layers, variable crossCarrierSchedulingConfig indicates if 'cross carrier scheduling' is enabled or not:
|
||||
// if No cross carrier scheduling: number of bits for CARRIER_IND is 0
|
||||
@@ -2094,7 +2095,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
|
||||
(dynamic_prb_BundlingType2==dy_2_n4)||(dynamic_prb_BundlingType2==dy_2_wideband)) prb_BundlingType_size=1;
|
||||
|
||||
// 15 RATE_MATCHING_IND FIXME!!!
|
||||
// according to TS 38.212: Rate matching indicator – 0, 1, or 2 bits according to higher layer parameter rateMatchPattern
|
||||
// according to TS 38.212: Rate matching indicator E0, 1, or 2 bits according to higher layer parameter rateMatchPattern
|
||||
uint8_t rateMatching_bits = pdsch_config.n_rateMatchPatterns;
|
||||
// 16 ZP_CSI_RS_TRIGGER FIXME!!!
|
||||
// 0, 1, or 2 bits as defined in Subclause 5.1.4.2 of [6, TS 38.214].
|
||||
@@ -2237,7 +2238,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
|
||||
// 2 bits otherwise
|
||||
uint8_t ptrs_dmrs_bits=0; //FIXME!!!
|
||||
// 46 BETA_OFFSET_IND
|
||||
// at IE PUSCH-Config, beta_offset indicator – 0 if the higher layer parameter betaOffsets = semiStatic; otherwise 2 bits
|
||||
// at IE PUSCH-Config, beta_offset indicator E0 if the higher layer parameter betaOffsets = semiStatic; otherwise 2 bits
|
||||
// uci-OnPUSCH
|
||||
// Selection between and configuration of dynamic and semi-static beta-offset. If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets
|
||||
uint8_t betaOffsets = 0;
|
||||
@@ -4249,10 +4250,10 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
case NR_RNTI_P:
|
||||
/*
|
||||
// Short Messages Indicator – 2 bits
|
||||
// Short Messages Indicator E2 bits
|
||||
for (int i=0; i<2; i++)
|
||||
dci_pdu |= (((uint64_t)dci_pdu_rel15->short_messages_indicator>>(1-i))&1)<<(dci_size-pos++);
|
||||
// Short Messages – 8 bits
|
||||
// Short Messages E8 bits
|
||||
for (int i=0; i<8; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->short_messages>>(7-i))&1)<<(dci_size-pos++);
|
||||
// Freq domain assignment 0-16 bit
|
||||
@@ -4319,13 +4320,13 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
// HARQ process number 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
// Downlink assignment index – 2 bits
|
||||
// Downlink assignment index E2 bits
|
||||
pos+=2;
|
||||
dci_pdu_rel15->dai[0].val = (*dci_pdu>>(dci_size-pos))&3;
|
||||
// TPC command for scheduled PUCCH – 2 bits
|
||||
// TPC command for scheduled PUCCH E2 bits
|
||||
pos+=2;
|
||||
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
||||
// PDSCH-to-HARQ_feedback timing indicator – 3 bits
|
||||
// PDSCH-to-HARQ_feedback timing indicator E3 bits
|
||||
pos+=3;
|
||||
dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = (*dci_pdu>>(dci_size-pos))&7;
|
||||
|
||||
@@ -4343,10 +4344,9 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
// Time domain assignment 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
// This is not supported yet - Skip for now
|
||||
// Frequency hopping flag – 1 bit
|
||||
//pos++;
|
||||
//dci_pdu_rel15->frequency_hopping_flag.val= (*dci_pdu>>(dci_size-pos))&1;
|
||||
// Frequency hopping flag E1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->frequency_hopping_flag.val= (*dci_pdu>>(dci_size-pos))&1;
|
||||
// MCS 5 bit
|
||||
pos+=5;
|
||||
dci_pdu_rel15->mcs= (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||
@@ -4359,10 +4359,10 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
// HARQ process number 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
// TPC command for scheduled PUSCH – 2 bits
|
||||
// TPC command for scheduled PUSCH E2 bits
|
||||
pos+=2;
|
||||
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
||||
// UL/SUL indicator – 1 bit
|
||||
// UL/SUL indicator E1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
dci_pdu->= ((uint64_t)*dci_pdu>>(dci_size-pos)ul_sul_indicator&1)<<(dci_size-pos++);
|
||||
@@ -4380,7 +4380,7 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
// Time domain assignment 4bit
|
||||
for (int i=0; i<4; i++)
|
||||
dci_pdu->= (((uint64_t)*dci_pdu>>(dci_size-pos)time_domain_assignment>>(3-i))&1)<<(dci_size-pos++);
|
||||
// Frequency hopping flag – 1 bit
|
||||
// Frequency hopping flag E1 bit
|
||||
dci_pdu->= ((uint64_t)*dci_pdu>>(dci_size-pos)frequency_hopping_flag&1)<<(dci_size-pos++);
|
||||
// MCS 5 bit
|
||||
for (int i=0; i<5; i++)
|
||||
@@ -4394,11 +4394,11 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
for (int i=0; i<4; i++)
|
||||
*dci_pdu |= (((uint64_t)*dci_pdu>>(dci_size-pos)harq_pid>>(3-i))&1)<<(dci_size-pos++);
|
||||
|
||||
// TPC command for scheduled PUSCH – 2 bits
|
||||
// TPC command for scheduled PUSCH E2 bits
|
||||
for (int i=0; i<2; i++)
|
||||
dci_pdu->= (((uint64_t)*dci_pdu>>(dci_size-pos)tpc>>(1-i))&1)<<(dci_size-pos++);
|
||||
*/
|
||||
// UL/SUL indicator – 1 bit
|
||||
// UL/SUL indicator E1 bit
|
||||
/*
|
||||
commented for now (RK): need to get this information from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
|
||||
@@ -372,7 +372,7 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
memset(pucch_pdu,0,sizeof(nfapi_nr_pucch_pdu_t));
|
||||
UL_tti_req->n_pdus+=1;
|
||||
|
||||
LOG_I(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n",
|
||||
LOG_D(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n",
|
||||
frameP,slotP,O_sr,O_ack,curr_pucch->csi_bits);
|
||||
|
||||
nr_configure_pucch(pucch_pdu,
|
||||
|
||||
@@ -70,7 +70,7 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
|
||||
|
||||
float num_ssb_per_RO = ssb_per_rach_occasion[cfg->prach_config.ssb_per_rach.value];
|
||||
uint16_t start_symbol_index = 0;
|
||||
uint8_t mu,N_dur,N_t_slot,start_symbol = 0, temp_start_symbol = 0, N_RA_slot;
|
||||
uint8_t mu,N_dur=0,N_t_slot=0,start_symbol = 0, temp_start_symbol = 0, N_RA_slot=0;
|
||||
uint16_t format,RA_sfn_index = -1;
|
||||
uint8_t config_period = 1;
|
||||
uint16_t prach_occasion_id = -1;
|
||||
@@ -139,7 +139,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) {
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0];
|
||||
|
||||
uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
uint8_t mu,N_dur,N_t_slot,start_symbol,N_RA_slot = 0;
|
||||
uint8_t mu,N_dur=0,N_t_slot=0,start_symbol=0,N_RA_slot = 0;
|
||||
uint16_t format,N_RA_sfn = 0,unused_RA_occasion,repetition = 0;
|
||||
uint8_t num_active_ssb = 0;
|
||||
uint8_t max_association_period = 1;
|
||||
@@ -421,14 +421,23 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
|
||||
uint8_t ul_carrier_id = 0; // 0 for NUL 1 for SUL
|
||||
NR_SearchSpace_t *ss;
|
||||
// ra_rnti from 5.1.3 in 38.321
|
||||
uint16_t ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8);
|
||||
|
||||
uint16_t msg2_frame, msg2_slot,monitoring_slot_period,monitoring_offset;
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
NR_RA_t *ra = &cc->ra[0];
|
||||
|
||||
uint16_t ra_rnti;
|
||||
|
||||
// ra_rnti from 5.1.3 in 38.321
|
||||
// FK: in case of long PRACH the phone seems to expect the subframe number instead of the slot number here.
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present==NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839)
|
||||
ra_rnti=1+symbol+(9/*slotP*/*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8);
|
||||
else
|
||||
ra_rnti=1+symbol+(slotP*14)+(freq_index*14*80)+(ul_carrier_id*14*80*8);
|
||||
|
||||
|
||||
// if the preamble received correspond to one of the listed
|
||||
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
|
||||
int pr_found=0;
|
||||
|
||||
@@ -159,13 +159,15 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
|
||||
const int abs_slot = (slots_per_frame * frameP) + slotP;
|
||||
const int slot_per_period = (slots_per_frame>>1)<<(*cc->ServingCellConfigCommon->ssb_periodicityServingCell);
|
||||
int eff_120_slot;
|
||||
const BIT_STRING_t *shortBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.shortBitmap;
|
||||
const BIT_STRING_t *mediumBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap;
|
||||
const BIT_STRING_t *longBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.longBitmap;
|
||||
uint8_t buf = 0;
|
||||
switch (cc->ServingCellConfigCommon->ssb_PositionsInBurst->present) {
|
||||
case 1:
|
||||
// presence of ssbs possible in the first 2 slots of ssb period
|
||||
if ((abs_slot % slot_per_period) < 2 &&
|
||||
(((mediumBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0)
|
||||
(((shortBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0)
|
||||
fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id);
|
||||
break;
|
||||
case 2:
|
||||
@@ -180,16 +182,16 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
|
||||
"240kHZ subcarrier spacing currently not supported for SSBs\n");
|
||||
if ((abs_slot % slot_per_period) < 8) {
|
||||
eff_120_slot = slotP;
|
||||
buf = mediumBitmap->buf[0];
|
||||
buf = longBitmap->buf[0];
|
||||
} else if ((abs_slot % slot_per_period) < 17) {
|
||||
eff_120_slot = slotP - 9;
|
||||
buf = mediumBitmap->buf[1];
|
||||
buf = longBitmap->buf[1];
|
||||
} else if ((abs_slot % slot_per_period) < 26) {
|
||||
eff_120_slot = slotP - 18;
|
||||
buf = mediumBitmap->buf[2];
|
||||
buf = longBitmap->buf[2];
|
||||
} else if ((abs_slot % slot_per_period) < 35) {
|
||||
eff_120_slot = slotP - 27;
|
||||
buf = mediumBitmap->buf[3];
|
||||
buf = longBitmap->buf[3];
|
||||
}
|
||||
if (((buf >> (6 - (eff_120_slot << 1))) & 3) != 0)
|
||||
fill_ssb_vrb_map(cc, ssb_offset0 / (ratio * 12) - 10, CC_id);
|
||||
|
||||
@@ -641,8 +641,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
* Possible improvement: take the periodicity from input file.
|
||||
* If such UE is not scheduled now, it will be by the preprocessor later.
|
||||
* If we add the CE, ta_apply will be reset */
|
||||
if (frame >= (sched_ctrl->ta_frame + 10) % 1023)
|
||||
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
|
||||
if (frame == (sched_ctrl->ta_frame + 10) % 1024)
|
||||
sched_ctrl->ta_apply = false; /* the timer is reset once TA CE is scheduled */
|
||||
|
||||
if (sched_ctrl->rbSize <= 0)
|
||||
continue;
|
||||
|
||||
@@ -812,7 +812,11 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
|
||||
}
|
||||
if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) {
|
||||
#if (NR_RRC_VERSION >= MAKE_VERSION(16, 0, 0))
|
||||
N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706;
|
||||
#else
|
||||
N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706;
|
||||
#endif
|
||||
if (N2<O_uci && N3>O_uci) {
|
||||
if (pucch_resource < n_list)
|
||||
resource_id = pucchresset->resourceList.list.array[pucch_resource];
|
||||
@@ -1702,7 +1706,7 @@ inline void add_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
||||
/*
|
||||
* Remove a UE from NR_UE_list listP
|
||||
*/
|
||||
inline int remove_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
||||
static inline void remove_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
||||
int *cur = &listP->head;
|
||||
while (*cur != -1 && *cur != UE_id)
|
||||
cur = &listP->next[*cur];
|
||||
@@ -1710,7 +1714,7 @@ inline int remove_nr_ue_list(NR_UE_list_t *listP, int UE_id) {
|
||||
int *next = &listP->next[*cur];
|
||||
*cur = listP->next[*cur];
|
||||
*next = -1;
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP)
|
||||
|
||||
@@ -869,10 +869,45 @@ boolean_t pdcp_remove_UE(
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pdcp_config_set_security(const protocol_ctxt_t* const ctxt_pP, pdcp_t *pdcp_pP, rb_id_t rb_id,
|
||||
uint16_t lc_idP, uint8_t security_modeP, uint8_t *kRRCenc_pP, uint8_t *kRRCint_pP, uint8_t *kUPenc_pP)
|
||||
void pdcp_config_set_security(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
pdcp_t *const pdcp_pP,
|
||||
const rb_id_t rb_id,
|
||||
const uint16_t lc_idP,
|
||||
const uint8_t security_modeP,
|
||||
uint8_t *const kRRCenc_pP,
|
||||
uint8_t *const kRRCint_pP,
|
||||
uint8_t *const kUPenc_pP)
|
||||
{
|
||||
TODO;
|
||||
DevAssert(pdcp_pP != NULL);
|
||||
|
||||
if ((security_modeP >= 0) && (security_modeP <= 0x77)) {
|
||||
pdcp_pP->cipheringAlgorithm = security_modeP & 0x0f;
|
||||
pdcp_pP->integrityProtAlgorithm = (security_modeP>>4) & 0xf;
|
||||
LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_SET_SECURITY_MODE: cipheringAlgorithm %d integrityProtAlgorithm %d\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
|
||||
pdcp_pP->cipheringAlgorithm,
|
||||
pdcp_pP->integrityProtAlgorithm);
|
||||
pdcp_pP->kRRCenc = kRRCenc_pP;
|
||||
pdcp_pP->kRRCint = kRRCint_pP;
|
||||
pdcp_pP->kUPenc = kUPenc_pP;
|
||||
/* Activate security */
|
||||
pdcp_pP->security_activated = 1;
|
||||
MSC_LOG_EVENT(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
"0 Set security ciph %X integ %x UE %"PRIx16" ",
|
||||
pdcp_pP->cipheringAlgorithm,
|
||||
pdcp_pP->integrityProtAlgorithm,
|
||||
ctxt_pP->rnti);
|
||||
} else {
|
||||
MSC_LOG_EVENT(
|
||||
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
|
||||
"0 Set security failed UE %"PRIx16" ",
|
||||
ctxt_pP->rnti);
|
||||
LOG_E(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
|
||||
security_modeP);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean_t pdcp_data_req_drb(
|
||||
|
||||
@@ -1285,7 +1285,7 @@ static int missing_size(nr_rlc_entity_am_t *entity, missing_data_t *m,
|
||||
missing_data_t m_nack;
|
||||
|
||||
/* be careful to limit a range to 255 SNs, that is: cut if needed */
|
||||
sn_count = m->sn_end - m->sn_start;
|
||||
sn_count = m->sn_end - m->sn_start + 1;
|
||||
if (sn_count < 0)
|
||||
sn_count += entity->sn_modulus;
|
||||
|
||||
|
||||
@@ -917,6 +917,9 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
|
||||
void nr_rlc_tick(int frame, int subframe)
|
||||
{
|
||||
if (frame != nr_rlc_current_time_last_frame ||
|
||||
subframe != nr_rlc_current_time_last_subframe)
|
||||
subframe != nr_rlc_current_time_last_subframe) {
|
||||
nr_rlc_current_time_last_frame = frame;
|
||||
nr_rlc_current_time_last_subframe = subframe;
|
||||
nr_rlc_current_time++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_count=13
|
||||
test_count=14
|
||||
|
||||
for i in `seq $test_count`
|
||||
do
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* am test (SN field size 18):
|
||||
* test status reporting with missing packet
|
||||
* at time 1, UE receives an SDU of 50 bytes
|
||||
* at time 2, UE receives an SDU of 50 bytes
|
||||
* at time 3, UE receives an SDU of 50 bytes
|
||||
* at time 4, UE receives an SDU of 50 bytes
|
||||
* transmission fails for first SDU, okay for the others
|
||||
* then some time with transmission failing
|
||||
* then at time 49, UE receives an SDU, transmission okay
|
||||
* then at time 50, transmission failing again (we had a bug triggered by this)
|
||||
* finally at time 55, transmission okay again to clear buffers
|
||||
*/
|
||||
|
||||
TIME, 1,
|
||||
GNB_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18,
|
||||
UE_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18,
|
||||
GNB_RECV_FAILS, 1,
|
||||
GNB_PDU_SIZE, 80,
|
||||
UE_PDU_SIZE, 80,
|
||||
UE_SDU, 0, 50,
|
||||
TIME, 2,
|
||||
GNB_RECV_FAILS, 0,
|
||||
UE_SDU, 1, 50,
|
||||
TIME, 3,
|
||||
GNB_BUFFER_STATUS,
|
||||
UE_SDU, 2, 50,
|
||||
TIME, 4,
|
||||
GNB_BUFFER_STATUS,
|
||||
UE_SDU, 3, 50,
|
||||
TIME, 5,
|
||||
GNB_BUFFER_STATUS,
|
||||
GNB_RECV_FAILS, 1,
|
||||
TIME, 6,
|
||||
GNB_BUFFER_STATUS,
|
||||
UE_BUFFER_STATUS,
|
||||
TIME, 49,
|
||||
GNB_RECV_FAILS, 0,
|
||||
UE_SDU, 4, 50,
|
||||
TIME, 50,
|
||||
GNB_RECV_FAILS, 1,
|
||||
GNB_BUFFER_STATUS,
|
||||
UE_BUFFER_STATUS,
|
||||
TIME, 55,
|
||||
GNB_RECV_FAILS, 0,
|
||||
TIME, -1
|
||||
Binary file not shown.
@@ -110,7 +110,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
|
||||
ret = nr_ue_scheduler(NULL, ul_info);
|
||||
|
||||
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra)
|
||||
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
|
||||
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
|
||||
|
||||
switch(ret){
|
||||
case UE_CONNECTION_OK:
|
||||
@@ -157,7 +157,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
if (ret >= 0) {
|
||||
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" );
|
||||
AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" );
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->thread_id);
|
||||
nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ typedef struct {
|
||||
frame_t frame;
|
||||
/// slot
|
||||
int slot;
|
||||
/// proc is needed to signal back decoded frame number to PHY. However, this is not really FAPI procedure and should be done differently
|
||||
UE_nr_rxtx_proc_t * proc;
|
||||
/// index of the current UE RX/TX thread
|
||||
int thread_id;
|
||||
|
||||
/// NR UE FAPI-like P7 message, direction: L1 to L2
|
||||
/// data reception indication structure
|
||||
@@ -95,6 +95,9 @@ typedef struct {
|
||||
frame_t frame_tx;
|
||||
/// slot tx
|
||||
uint32_t slot_tx;
|
||||
/// index of the current UE RX/TX thread
|
||||
int thread_id;
|
||||
|
||||
/// dci reception indication structure
|
||||
fapi_nr_dci_indication_t *dci_ind;
|
||||
} nr_uplink_indication_t;
|
||||
@@ -111,6 +114,8 @@ typedef struct {
|
||||
frame_t frame;
|
||||
/// slot
|
||||
int slot;
|
||||
/// index of the current UE RX/TX thread
|
||||
int thread_id;
|
||||
|
||||
/// NR UE FAPI-like P7 message, direction: L2 to L1
|
||||
/// downlink transmission configuration request structure
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
|
||||
#include "COMMON/s1ap_messages_types.h"
|
||||
#include "COMMON/rrc_messages_types.h"
|
||||
#if ITTI_SIM
|
||||
#include "COMMON/itti_sim_messages_types.h"
|
||||
#endif
|
||||
|
||||
#include "collection/tree.h"
|
||||
#include "rrc_types_NB_IoT.h"
|
||||
|
||||
@@ -43,6 +43,77 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
int
|
||||
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
||||
rnti_t rntiP){
|
||||
// todo
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
nr_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_sizeP,
|
||||
uint8_t *const buffer_pP,
|
||||
const pdcp_transmission_mode_t modeP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
if(sdu_sizeP == 255) {
|
||||
LOG_I(RRC,"sdu_sizeP == 255");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
|
||||
buffer_pP,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->rnti,
|
||||
muiP,
|
||||
sdu_sizeP);
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
//memcpy (RRC_DCCH_DATA_REQ (message_p).sdu_p, buffer_pP, sdu_sizeP);
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
itti_send_msg_to_task (
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
LOG_I(RRC,"sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB\n");
|
||||
|
||||
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
|
||||
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
|
||||
* messages automatically */
|
||||
if (ctxt_pP->enb_flag && NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type))
|
||||
pdcp_run(ctxt_pP);
|
||||
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
}
|
||||
|
||||
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
|
||||
@@ -41,8 +41,34 @@
|
||||
#include <per_encoder.h>
|
||||
|
||||
#include "asn1_msg.h"
|
||||
#include "../nr_rrc_proto.h"
|
||||
#include "RRC/NR/nr_rrc_extern.h"
|
||||
#if defined(NR_Rel15)
|
||||
#include "NR_DL-CCCH-Message.h"
|
||||
#include "NR_UL-CCCH-Message.h"
|
||||
#include "NR_DL-DCCH-Message.h"
|
||||
#include "NR_RRCReject.h"
|
||||
#include "NR_RejectWaitTime.h"
|
||||
#include "NR_RRCSetup.h"
|
||||
#include "NR_RRCSetup-IEs.h"
|
||||
#include "NR_SRB-ToAddModList.h"
|
||||
#include "NR_CellGroupConfig.h"
|
||||
#include "NR_RLC-BearerConfig.h"
|
||||
#include "NR_RLC-Config.h"
|
||||
#include "NR_LogicalChannelConfig.h"
|
||||
#include "NR_PDCP-Config.h"
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
#include "NR_SecurityModeCommand.h"
|
||||
#include "NR_CipheringAlgorithm.h"
|
||||
#include "NR_RRCReconfiguration-IEs.h"
|
||||
#include "NR_DRB-ToAddMod.h"
|
||||
#include "NR_DRB-ToAddModList.h"
|
||||
#include "NR_SecurityConfig.h"
|
||||
#include "NR_RRCReconfiguration-v1530-IEs.h"
|
||||
#include "NR_UL-DCCH-Message.h"
|
||||
#include "NR_SDAP-Config.h"
|
||||
#include "NR_RRCReconfigurationComplete.h"
|
||||
#include "NR_RRCReconfigurationComplete-IEs.h"
|
||||
#if defined(NR_Rel16)
|
||||
#include "NR_SCS-SpecificCarrier.h"
|
||||
#include "NR_TDD-UL-DL-ConfigCommon.h"
|
||||
#include "NR_FrequencyInfoUL.h"
|
||||
@@ -574,6 +600,661 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
|
||||
spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t do_RRCReject(uint8_t Mod_id,
|
||||
uint8_t *const buffer)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
asn_enc_rval_t enc_rval;;
|
||||
NR_DL_CCCH_Message_t dl_ccch_msg;
|
||||
NR_RRCReject_t *rrcReject;
|
||||
NR_RejectWaitTime_t waitTime = 1;
|
||||
|
||||
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
|
||||
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
|
||||
dl_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_CCCH_MessageType__c1));
|
||||
dl_ccch_msg.message.choice.c1->present = NR_RRCReject__criticalExtensions_PR_rrcReject;
|
||||
|
||||
dl_ccch_msg.message.choice.c1->choice.rrcReject = CALLOC(1,sizeof(NR_RRCReject_t));
|
||||
rrcReject = dl_ccch_msg.message.choice.c1->choice.rrcReject;
|
||||
|
||||
rrcReject->criticalExtensions.choice.rrcReject = CALLOC(1, sizeof(struct NR_RRCReject_IEs));
|
||||
rrcReject->criticalExtensions.choice.rrcReject->waitTime = CALLOC(1, sizeof(NR_RejectWaitTime_t));
|
||||
|
||||
rrcReject->criticalExtensions.present = NR_RRCReject__criticalExtensions_PR_rrcReject;
|
||||
rrcReject->criticalExtensions.choice.rrcReject->waitTime = &waitTime;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_ccch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"RRCReject Encoded %zd bits (%zd bytes)\n",
|
||||
enc_rval.encoded,(enc_rval.encoded+7)/8);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
int CC_id,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
NR_SRB_ToAddModList_t *SRB_configList)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
asn_enc_rval_t enc_rval;;
|
||||
NR_DL_CCCH_Message_t dl_ccch_msg;
|
||||
NR_RRCSetup_t *rrcSetup;
|
||||
NR_RRCSetup_IEs_t *ie;
|
||||
NR_SRB_ToAddMod_t *SRB1_config = NULL;
|
||||
NR_PDCP_Config_t *pdcp_Config = NULL;
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL;
|
||||
NR_RLC_Config_t *rlc_Config = NULL;
|
||||
NR_LogicalChannelConfig_t *logicalChannelConfig = NULL;
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL;
|
||||
|
||||
char masterCellGroup_buf[1000];
|
||||
long *logicalChannelGroup = NULL;
|
||||
|
||||
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
|
||||
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
|
||||
dl_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_CCCH_MessageType__c1));
|
||||
dl_ccch_msg.message.choice.c1->present = NR_DL_CCCH_MessageType__c1_PR_rrcSetup;
|
||||
dl_ccch_msg.message.choice.c1->choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_t));
|
||||
|
||||
rrcSetup = dl_ccch_msg.message.choice.c1->choice.rrcSetup;
|
||||
rrcSetup->criticalExtensions.present = NR_RRCSetup__criticalExtensions_PR_rrcSetup;
|
||||
rrcSetup->rrc_TransactionIdentifier = transaction_id;
|
||||
rrcSetup->criticalExtensions.choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_IEs_t));
|
||||
ie = rrcSetup->criticalExtensions.choice.rrcSetup;
|
||||
|
||||
/****************************** radioBearerConfig ******************************/
|
||||
/* Configure SRB1 */
|
||||
if (SRB_configList) {
|
||||
free(SRB_configList);
|
||||
}
|
||||
|
||||
SRB_configList = calloc(1, sizeof(NR_SRB_ToAddModList_t));
|
||||
// SRB1
|
||||
/* TODO */
|
||||
SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t));
|
||||
SRB1_config->srb_Identity = 1;
|
||||
// pdcp_Config->t_Reordering
|
||||
SRB1_config->pdcp_Config = pdcp_Config;
|
||||
ie->radioBearerConfig.srb_ToAddModList = SRB_configList;
|
||||
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB1_config);
|
||||
|
||||
ie->radioBearerConfig.srb3_ToRelease = NULL;
|
||||
ie->radioBearerConfig.drb_ToAddModList = NULL;
|
||||
ie->radioBearerConfig.drb_ToReleaseList = NULL;
|
||||
ie->radioBearerConfig.securityConfig = NULL;
|
||||
|
||||
/****************************** masterCellGroup ******************************/
|
||||
/* TODO */
|
||||
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
||||
cellGroupConfig->cellGroupId = 0;
|
||||
|
||||
/* Rlc Bearer Config */
|
||||
/* TS38.331 9.2.1 Default SRB configurations */
|
||||
cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
||||
rlc_BearerConfig = calloc(1, sizeof(NR_RLC_BearerConfig_t));
|
||||
rlc_BearerConfig->logicalChannelIdentity = 1;
|
||||
rlc_BearerConfig->servedRadioBearer = calloc(1, sizeof(*rlc_BearerConfig->servedRadioBearer));
|
||||
rlc_BearerConfig->servedRadioBearer->present = NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
|
||||
rlc_BearerConfig->servedRadioBearer->choice.srb_Identity = 1;
|
||||
rlc_BearerConfig->reestablishRLC = NULL;
|
||||
rlc_Config = calloc(1, sizeof(NR_RLC_Config_t));
|
||||
rlc_Config->present = NR_RLC_Config_PR_am;
|
||||
rlc_Config->choice.am = calloc(1, sizeof(*rlc_Config->choice.am));
|
||||
rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms35;
|
||||
rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms0;
|
||||
rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t));
|
||||
*(rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size12;
|
||||
rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45;
|
||||
rlc_Config->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_infinity;
|
||||
rlc_Config->choice.am->ul_AM_RLC.pollByte = NR_PollByte_infinity;
|
||||
rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8;
|
||||
rlc_BearerConfig->rlc_Config = rlc_Config;
|
||||
logicalChannelConfig = calloc(1, sizeof(NR_LogicalChannelConfig_t));
|
||||
logicalChannelConfig->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig->ul_SpecificParameters));
|
||||
logicalChannelConfig->ul_SpecificParameters->priority = 1;
|
||||
logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
|
||||
logicalChannelGroup = CALLOC(1, sizeof(long));
|
||||
*logicalChannelGroup = 0;
|
||||
logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = logicalChannelGroup;
|
||||
rlc_BearerConfig->mac_LogicalChannelConfig = logicalChannelConfig;
|
||||
ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig);
|
||||
|
||||
cellGroupConfig->rlc_BearerToReleaseList = NULL;
|
||||
cellGroupConfig->sCellToAddModList = NULL;
|
||||
cellGroupConfig->sCellToReleaseList = NULL;
|
||||
|
||||
/* mac CellGroup Config */
|
||||
mac_CellGroupConfig = calloc(1, sizeof(NR_MAC_CellGroupConfig_t));
|
||||
mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config));
|
||||
mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
|
||||
mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80;
|
||||
mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config));
|
||||
mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup));
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10;
|
||||
mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1;
|
||||
cellGroupConfig->mac_CellGroupConfig = mac_CellGroupConfig;
|
||||
|
||||
// cellGroupConfig.physicalCellGroupConfig;
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
||||
NULL,
|
||||
(void *)cellGroupConfig,
|
||||
masterCellGroup_buf,
|
||||
100);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) {
|
||||
LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_ccch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
if(enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
|
||||
enc_rval.encoded,(enc_rval.encoded+7)/8);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
uint8_t do_NR_SecurityModeCommand(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t Transaction_id,
|
||||
const uint8_t cipheringAlgorithm,
|
||||
NR_IntegrityProtAlgorithm_t *integrityProtAlgorithm
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
asn_enc_rval_t enc_rval;
|
||||
memset(&dl_dcch_msg,0,sizeof(NR_DL_DCCH_Message_t));
|
||||
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
|
||||
dl_dcch_msg.message.choice.c1=CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1));
|
||||
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_securityModeCommand;
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand = CALLOC(1, sizeof(struct NR_SecurityModeCommand));
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand->rrc_TransactionIdentifier = Transaction_id;
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand->criticalExtensions.present = NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand;
|
||||
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand->criticalExtensions.choice.securityModeCommand =
|
||||
CALLOC(1, sizeof(struct NR_SecurityModeCommand_IEs));
|
||||
// the two following information could be based on the mod_id
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm
|
||||
= (NR_CipheringAlgorithm_t)cipheringAlgorithm;
|
||||
dl_dcch_msg.message.choice.c1->choice.securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm
|
||||
= integrityProtAlgorithm;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"[gNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti,
|
||||
enc_rval.encoded,
|
||||
(enc_rval.encoded+7)/8);
|
||||
|
||||
if (enc_rval.encoded==-1) {
|
||||
LOG_E(NR_RRC,"[gNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// rrc_ue_process_ueCapabilityEnquiry(0,1000,&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry,0);
|
||||
// exit(-1);
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
/*TODO*/
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t Transaction_id)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request;
|
||||
|
||||
asn_enc_rval_t enc_rval;
|
||||
memset(&dl_dcch_msg,0,sizeof(NR_DL_DCCH_Message_t));
|
||||
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
|
||||
dl_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1));
|
||||
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry;
|
||||
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry = CALLOC(1,sizeof(struct NR_UECapabilityEnquiry));
|
||||
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->rrc_TransactionIdentifier = Transaction_id;
|
||||
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.present = NR_UECapabilityEnquiry__criticalExtensions_PR_ueCapabilityEnquiry;
|
||||
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry = CALLOC(1,sizeof(struct NR_UECapabilityEnquiry_IEs));
|
||||
ue_capabilityrat_request = CALLOC(1,sizeof(NR_UE_CapabilityRAT_Request_t));
|
||||
memset(ue_capabilityrat_request,0,sizeof(NR_UE_CapabilityRAT_Request_t));
|
||||
ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr;
|
||||
|
||||
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list,
|
||||
ue_capabilityrat_request);
|
||||
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti,
|
||||
enc_rval.encoded,
|
||||
(enc_rval.encoded+7)/8);
|
||||
|
||||
if (enc_rval.encoded==-1) {
|
||||
LOG_E(NR_RRC,"[gNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
|
||||
uint8_t do_NR_RRCConnectionRelease(uint8_t *buffer,
|
||||
uint8_t Transaction_id) {
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
NR_RRCRelease_t *rrcConnectionRelease;
|
||||
memset(&dl_dcch_msg,0,sizeof(NR_DL_DCCH_Message_t));
|
||||
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
|
||||
dl_dcch_msg.message.choice.c1=CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1));
|
||||
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_rrcRelease;
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcRelease = CALLOC(1, sizeof(struct NR_RRCRelease));
|
||||
rrcConnectionRelease = dl_dcch_msg.message.choice.c1->choice.rrcRelease;
|
||||
// RRCConnectionRelease
|
||||
rrcConnectionRelease->rrc_TransactionIdentifier = Transaction_id;
|
||||
rrcConnectionRelease->criticalExtensions.present = NR_RRCRelease__criticalExtensions_PR_rrcRelease;
|
||||
rrcConnectionRelease->criticalExtensions.choice.rrcRelease = NULL;
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_dcch_msg,
|
||||
buffer,
|
||||
RRC_BUF_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);
|
||||
return -1;
|
||||
}
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
uint16_t do_RRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *buffer,
|
||||
uint8_t Transaction_id,
|
||||
gNB_RRC_INST *gnb_rrc_inst
|
||||
)
|
||||
{
|
||||
NR_DL_DCCH_Message_t dl_dcch_msg;
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_RRCReconfiguration_IEs_t *ie;
|
||||
NR_SRB_ToAddModList_t *SRB_configList = NULL;
|
||||
NR_SRB_ToAddModList_t *SRB_configList2 = NULL;
|
||||
NR_SRB_ToAddMod_t *SRB2_config = NULL;
|
||||
NR_DRB_ToAddModList_t *DRB_configList = NULL;
|
||||
NR_DRB_ToAddModList_t *DRB_configList2 = NULL;
|
||||
NR_DRB_ToAddMod_t *DRB_config = NULL;
|
||||
NR_SDAP_Config_t *sdap_config = NULL;
|
||||
NR_SecurityConfig_t *security_config = NULL;
|
||||
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
|
||||
|
||||
memset(&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t));
|
||||
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
|
||||
dl_dcch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_DCCH_MessageType__c1));
|
||||
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration;
|
||||
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration = calloc(1, sizeof(NR_RRCReconfiguration_t));
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier = Transaction_id;
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
|
||||
|
||||
/******************** Radio Bearer Config ********************/
|
||||
/* Configure SRB2 */
|
||||
SRB_configList2 = ue_context_pP->ue_context.SRB_configList2[Transaction_id];
|
||||
SRB_configList = ue_context_pP->ue_context.SRB_configList;
|
||||
SRB_configList = CALLOC(1, sizeof(*SRB_configList));
|
||||
memset(SRB_configList, 0, sizeof(*SRB_configList));
|
||||
|
||||
if (SRB_configList2) {
|
||||
free(SRB_configList2);
|
||||
}
|
||||
|
||||
SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2));
|
||||
memset(SRB_configList2, 0, sizeof(*SRB_configList2));
|
||||
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
|
||||
SRB2_config->srb_Identity = 2;
|
||||
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
|
||||
ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config);
|
||||
|
||||
/* Configure DRB */
|
||||
DRB_configList = ue_context_pP->ue_context.DRB_configList;
|
||||
if (DRB_configList) {
|
||||
free(DRB_configList);
|
||||
}
|
||||
|
||||
DRB_configList = CALLOC(1, sizeof(*DRB_configList));
|
||||
memset(DRB_configList, 0, sizeof(*DRB_configList));
|
||||
|
||||
DRB_configList2 = ue_context_pP->ue_context.DRB_configList2[Transaction_id];
|
||||
if (DRB_configList2) {
|
||||
free(DRB_configList2);
|
||||
}
|
||||
DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2));
|
||||
memset(DRB_configList2, 0, sizeof(*DRB_configList2));
|
||||
|
||||
DRB_config = CALLOC(1, sizeof(*DRB_config));
|
||||
DRB_config->drb_Identity = 1;
|
||||
DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation));
|
||||
DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config;
|
||||
// TODO sdap_Config
|
||||
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
|
||||
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
|
||||
DRB_config->cnAssociation->choice.sdap_Config = sdap_config;
|
||||
// TODO pdcp_Config
|
||||
DRB_config->reestablishPDCP = NULL;
|
||||
DRB_config->recoverPDCP = NULL;
|
||||
DRB_config->pdcp_Config = calloc(1, sizeof(*DRB_config->pdcp_Config));
|
||||
DRB_config->pdcp_Config->drb = calloc(1,sizeof(*DRB_config->pdcp_Config->drb));
|
||||
DRB_config->pdcp_Config->drb->discardTimer = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->discardTimer));
|
||||
*DRB_config->pdcp_Config->drb->discardTimer = NR_PDCP_Config__drb__discardTimer_ms30;
|
||||
DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL));
|
||||
*DRB_config->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits;
|
||||
DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1, sizeof(*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL));
|
||||
*DRB_config->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits;
|
||||
DRB_config->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed;
|
||||
DRB_config->pdcp_Config->drb->headerCompression.choice.notUsed = 0;
|
||||
|
||||
DRB_config->pdcp_Config->drb->integrityProtection = NULL;
|
||||
DRB_config->pdcp_Config->drb->statusReportRequired = NULL;
|
||||
DRB_config->pdcp_Config->drb->outOfOrderDelivery = NULL;
|
||||
DRB_config->pdcp_Config->moreThanOneRLC = NULL;
|
||||
|
||||
DRB_config->pdcp_Config->t_Reordering = calloc(1, sizeof(*DRB_config->pdcp_Config->t_Reordering));
|
||||
*DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
|
||||
DRB_config->pdcp_Config->ext1 = NULL;
|
||||
|
||||
ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
|
||||
ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config);
|
||||
|
||||
/* Configure Security */
|
||||
// security_config = CALLOC(1, sizeof(NR_SecurityConfig_t));
|
||||
// security_config->securityAlgorithmConfig = CALLOC(1, sizeof(*ie->radioBearerConfig->securityConfig->securityAlgorithmConfig));
|
||||
// security_config->securityAlgorithmConfig->cipheringAlgorithm = NR_CipheringAlgorithm_nea0;
|
||||
// security_config->securityAlgorithmConfig->integrityProtAlgorithm = NULL;
|
||||
// security_config->keyToUse = CALLOC(1, sizeof(*ie->radioBearerConfig->securityConfig->keyToUse));
|
||||
// *security_config->keyToUse = NR_SecurityConfig__keyToUse_master;
|
||||
|
||||
ie = calloc(1, sizeof(NR_RRCReconfiguration_IEs_t));
|
||||
ie->radioBearerConfig = calloc(1, sizeof(NR_RadioBearerConfig_t));
|
||||
ie->radioBearerConfig->srb_ToAddModList = SRB_configList;
|
||||
ie->radioBearerConfig->drb_ToAddModList = DRB_configList;
|
||||
ie->radioBearerConfig->securityConfig = security_config;
|
||||
ie->radioBearerConfig->srb3_ToRelease = NULL;
|
||||
ie->radioBearerConfig->drb_ToReleaseList = NULL;
|
||||
|
||||
/******************** Secondary Cell Group ********************/
|
||||
// rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier);
|
||||
// fill_default_secondaryCellGroup( carrier->servingcellconfigcommon,
|
||||
// ue_context_pP->ue_context.secondaryCellGroup,
|
||||
// 1,
|
||||
// 1,
|
||||
// carrier->pdsch_AntennaPorts,
|
||||
// carrier->initial_csi_index[gnb_rrc_inst->Nb_ue]);
|
||||
|
||||
/******************** Meas Config ********************/
|
||||
// measConfig
|
||||
ie->measConfig = NULL;
|
||||
// lateNonCriticalExtension
|
||||
ie->lateNonCriticalExtension = NULL;
|
||||
// nonCriticalExtension
|
||||
ie->nonCriticalExtension = calloc(1, sizeof(NR_RRCReconfiguration_v1530_IEs_t));
|
||||
dedicatedNAS_Message = calloc(1, sizeof(NR_DedicatedNAS_Message_t));
|
||||
dedicatedNAS_Message->buf = ue_context_pP->ue_context.nas_pdu.buffer;
|
||||
dedicatedNAS_Message->size = ue_context_pP->ue_context.nas_pdu.length;
|
||||
ie->nonCriticalExtension->dedicatedNAS_MessageList = calloc(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList));
|
||||
ASN_SEQUENCE_ADD(&ie->nonCriticalExtension->dedicatedNAS_MessageList->list, dedicatedNAS_Message);
|
||||
|
||||
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&dl_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_D(NR_RRC,"[gNB %d] RRCReconfiguration for UE %x Encoded %zd bits (%zd bytes)\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti,
|
||||
enc_rval.encoded,
|
||||
(enc_rval.encoded+7)/8);
|
||||
|
||||
if (enc_rval.encoded == -1) {
|
||||
LOG_E(NR_RRC,"[gNB %d] ASN1 : RRCReconfiguration encoding failed for UE %x\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
|
||||
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
|
||||
asn_enc_rval_t enc_rval;
|
||||
uint8_t buf[5],buf2=0;
|
||||
NR_UL_CCCH_Message_t ul_ccch_msg;
|
||||
NR_RRCSetupRequest_t *rrcSetupRequest;
|
||||
memset((void *)&ul_ccch_msg,0,sizeof(NR_UL_CCCH_Message_t));
|
||||
ul_ccch_msg.message.present = NR_UL_CCCH_MessageType_PR_c1;
|
||||
ul_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_UL_CCCH_MessageType__c1));
|
||||
ul_ccch_msg.message.choice.c1->present = NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest;
|
||||
ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest = CALLOC(1, sizeof(NR_RRCSetupRequest_t));
|
||||
rrcSetupRequest = ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest;
|
||||
|
||||
|
||||
if (1) {
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.present = NR_InitialUE_Identity_PR_randomValue;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.size = 5;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.bits_unused = 1;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf = buf;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[0] = rv[0];
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[1] = rv[1];
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[2] = rv[2];
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[3] = rv[3];
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[4] = rv[4]&0xfe;
|
||||
} else {
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.present = NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.size = 1;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.bits_unused = 0;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.buf = buf;
|
||||
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.buf[0] = 0x12;
|
||||
}
|
||||
|
||||
rrcSetupRequest->rrcSetupRequest.establishmentCause = NR_EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data;
|
||||
rrcSetupRequest->rrcSetupRequest.spare.buf = &buf2;
|
||||
rrcSetupRequest->rrcSetupRequest.spare.size=1;
|
||||
rrcSetupRequest->rrcSetupRequest.spare.bits_unused = 7;
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_UL_CCCH_Message, (void *)&ul_ccch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_CCCH_Message,
|
||||
NULL,
|
||||
(void *)&ul_ccch_msg,
|
||||
buffer,
|
||||
100);
|
||||
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(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *buffer,
|
||||
const uint8_t Transaction_id
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_UL_DCCH_Message_t ul_dcch_msg;
|
||||
NR_RRCReconfigurationComplete_t *rrcReconfigurationComplete;
|
||||
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
|
||||
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
|
||||
ul_dcch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_UL_DCCH_MessageType__c1));
|
||||
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete;
|
||||
ul_dcch_msg.message.choice.c1->choice.rrcReconfigurationComplete = CALLOC(1, sizeof(NR_RRCReconfigurationComplete_t));
|
||||
rrcReconfigurationComplete = ul_dcch_msg.message.choice.c1->choice.rrcReconfigurationComplete;
|
||||
rrcReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id;
|
||||
rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete = CALLOC(1, sizeof(NR_RRCReconfigurationComplete_IEs_t));
|
||||
rrcReconfigurationComplete->criticalExtensions.present =
|
||||
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete;
|
||||
rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL;
|
||||
rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete->lateNonCriticalExtension = NULL;
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&ul_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
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){
|
||||
asn_enc_rval_t enc_rval;
|
||||
|
||||
NR_UL_DCCH_Message_t ul_dcch_msg;
|
||||
NR_RRCSetupComplete_t *RrcSetupComplete;
|
||||
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
|
||||
|
||||
uint8_t buf[6];
|
||||
|
||||
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
|
||||
ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1));
|
||||
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete;
|
||||
ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_t));
|
||||
RrcSetupComplete = ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete;
|
||||
RrcSetupComplete->rrc_TransactionIdentifier = Transaction_id;
|
||||
RrcSetupComplete->criticalExtensions.present = NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_IEs_t));
|
||||
// RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension = CALLOC(1,
|
||||
// sizeof(*RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension));
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->selectedPLMN_Identity = sel_plmn_id;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->registeredAMF = NULL;
|
||||
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value = CALLOC(1, sizeof(struct NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value));
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->present = NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size = 6;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf = buf;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[0] = 0x12;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[1] = 0x34;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[2] = 0x56;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[3] = 0x78;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[4] = 0x9A;
|
||||
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[5] = 0xBC;
|
||||
|
||||
memset(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,0,sizeof(OCTET_STRING_t));
|
||||
OCTET_STRING_fromBuf(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,dedicatedInfoNAS,dedicatedInfoNASLength);
|
||||
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
|
||||
}
|
||||
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
|
||||
NULL,
|
||||
(void *)&ul_dcch_msg,
|
||||
buffer,
|
||||
100);
|
||||
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);
|
||||
|
||||
return((enc_rval.encoded+7)/8);
|
||||
}
|
||||
|
||||
int do_DLInformationTransfer_NR (void * p) {
|
||||
return 0;
|
||||
|
||||
@@ -82,3 +82,47 @@ void do_PHYSICALCELLGROUP(uint8_t Mod_id,
|
||||
|
||||
void do_SpCellConfig(gNB_RRC_INST *rrc,
|
||||
struct NR_SpCellConfig *spconfig);
|
||||
|
||||
uint8_t do_RRCReject(uint8_t Mod_id,
|
||||
uint8_t *const buffer);
|
||||
|
||||
uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
int CC_id,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t transaction_id,
|
||||
NR_SRB_ToAddModList_t *SRB_configList);
|
||||
uint8_t do_NR_SecurityModeCommand(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *const buffer,
|
||||
const uint8_t Transaction_id,
|
||||
const uint8_t cipheringAlgorithm,
|
||||
NR_IntegrityProtAlgorithm_t *integrityProtAlgorithm);
|
||||
|
||||
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_RRCConnectionRelease(uint8_t *buffer,
|
||||
uint8_t Transaction_id);
|
||||
uint16_t do_RRCReconfiguration(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t *buffer,
|
||||
uint8_t Transaction_id,
|
||||
gNB_RRC_INST *gnb_rrc_inst);
|
||||
|
||||
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_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
|
||||
|
||||
uint8_t do_NR_RRCReconfigurationComplete(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
uint8_t *buffer,
|
||||
const uint8_t Transaction_id
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@
|
||||
#include "NR_BCCH-BCH-Message.h"
|
||||
#include "NR_PLMN-IdentityInfo.h"
|
||||
#include "NR_MCC-MNC-Digit.h"
|
||||
#include "NR_NG-5G-S-TMSI.h"
|
||||
//#include "MCCH-Message.h"
|
||||
//#include "MBSFNAreaConfiguration-r9.h"
|
||||
//#include "SCellToAddMod-r10.h"
|
||||
@@ -89,10 +90,10 @@ typedef struct nr_uid_linear_allocator_s {
|
||||
|
||||
|
||||
#define PROTOCOL_NR_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT
|
||||
#define PROTOCOL_NR_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
|
||||
#define PROTOCOL_NR_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp)
|
||||
|
||||
#define PROTOCOL_NR_RRC_CTXT_FMT PROTOCOL_CTXT_FMT
|
||||
#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
|
||||
#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp)
|
||||
|
||||
|
||||
#define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
|
||||
@@ -149,7 +150,7 @@ typedef struct UE_RRC_INFO_NR_s {
|
||||
uint32_t SIStatus;
|
||||
uint32_t SIcnt;
|
||||
uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA
|
||||
uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
|
||||
uint16_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
|
||||
uint8_t handoverTarget;
|
||||
//HO_STATE_t ho_state;
|
||||
uint16_t
|
||||
@@ -168,8 +169,9 @@ typedef struct UE_RRC_INFO_NR_s {
|
||||
|
||||
typedef struct UE_S_TMSI_NR_s {
|
||||
boolean_t presence;
|
||||
mme_code_t mme_code;
|
||||
m_tmsi_t m_tmsi;
|
||||
uint16_t amf_set_id;
|
||||
uint8_t amf_pointer;
|
||||
uint32_t fiveg_tmsi;
|
||||
} __attribute__ ((__packed__)) NR_UE_S_TMSI;
|
||||
|
||||
|
||||
@@ -246,6 +248,14 @@ typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
|
||||
uint32_t Next_check_frame;
|
||||
} NR_SRB_INFO_TABLE_ENTRY;
|
||||
|
||||
typedef struct nr_rrc_guami_s {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_len;
|
||||
uint8_t amf_region_id;
|
||||
uint16_t amf_set_id;
|
||||
uint8_t amf_pointer;
|
||||
} nr_rrc_guami_t;
|
||||
|
||||
typedef struct gNB_RRC_UE_s {
|
||||
uint8_t primaryCC_id;
|
||||
@@ -267,7 +277,9 @@ typedef struct gNB_RRC_UE_s {
|
||||
|
||||
|
||||
NR_UE_NR_Capability_t* UE_Capability_nr;
|
||||
int UE_Capability_size;
|
||||
NR_UE_MRDC_Capability_t* UE_Capability_MRDC;
|
||||
int UE_MRDC_Capability_size;
|
||||
|
||||
NR_CellGroupConfig_t *secondaryCellGroup;
|
||||
NR_RRCReconfiguration_t *reconfig;
|
||||
@@ -275,13 +287,12 @@ typedef struct gNB_RRC_UE_s {
|
||||
|
||||
ImsiMobileIdentity_t imsi;
|
||||
|
||||
#if defined(ENABLE_SECURITY)
|
||||
/* KeNB as derived from KASME received from EPC */
|
||||
uint8_t kenb[32];
|
||||
int8_t kenb_ncc;
|
||||
/* KgNB as derived from KASME received from EPC */
|
||||
uint8_t kgnb[32];
|
||||
int8_t kgnb_ncc;
|
||||
uint8_t nh[32];
|
||||
int8_t nh_ncc;
|
||||
#endif
|
||||
|
||||
/* Used integrity/ciphering algorithms */
|
||||
NR_CipheringAlgorithm_t ciphering_algorithm;
|
||||
e_NR_IntegrityProtAlgorithm integrity_algorithm;
|
||||
@@ -290,8 +301,10 @@ typedef struct gNB_RRC_UE_s {
|
||||
rnti_t rnti;
|
||||
uint64_t random_ue_identity;
|
||||
|
||||
/* Information from UE RRC ConnectionRequest */
|
||||
UE_S_TMSI Initialue_identity_s_TMSI;
|
||||
/* Information from UE RRC Setup Request */
|
||||
NR_UE_S_TMSI Initialue_identity_5g_s_TMSI;
|
||||
uint64_t ng_5G_S_TMSI_Part1;
|
||||
uint16_t ng_5G_S_TMSI_Part2;
|
||||
NR_EstablishmentCause_t establishment_cause;
|
||||
|
||||
/* Information from UE RRC ConnectionReestablishmentRequest */
|
||||
@@ -302,8 +315,11 @@ typedef struct gNB_RRC_UE_s {
|
||||
|
||||
/* Information from S1AP initial_context_setup_req */
|
||||
uint32_t gNB_ue_s1ap_id :24;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
nr_rrc_guami_t ue_guami;
|
||||
|
||||
security_capabilities_t security_capabilities;
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
|
||||
/* Total number of e_rab already setup in the list */
|
||||
uint8_t setup_e_rabs;
|
||||
@@ -343,6 +359,10 @@ typedef struct gNB_RRC_UE_s {
|
||||
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig;
|
||||
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig;
|
||||
|
||||
/* Nas Pdu */
|
||||
uint8_t nas_pdu_flag;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
|
||||
} gNB_RRC_UE_t;
|
||||
|
||||
typedef uid_t ue_uid_t;
|
||||
|
||||
@@ -93,6 +93,23 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
||||
|
||||
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
|
||||
|
||||
void
|
||||
rrc_gNB_generate_SecurityModeCommand(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
);
|
||||
|
||||
uint8_t
|
||||
rrc_gNB_get_next_transaction_identifier(
|
||||
module_id_t gnb_mod_idP
|
||||
);
|
||||
|
||||
void
|
||||
rrc_gNB_generate_UECapabilityEnquiry(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
);
|
||||
|
||||
void nr_rrc_rx_tx(void);
|
||||
|
||||
/**\brief RRC eNB task.
|
||||
@@ -104,8 +121,23 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe);
|
||||
|
||||
/**\ Function to set or overwrite PTRS DL RRC parameters.
|
||||
\ *bwp Pointer to dedicated RC config structure
|
||||
\ *ptrsNrb Pointer to K_ptrs N_RB related parameters
|
||||
\ *ptrsMcs Pointer to L_ptrs MCS related parameters
|
||||
\ *ptrsNrb Pointer to K_ptrs N_RB related parameters
|
||||
\ *ptrsMcs Pointer to L_ptrs MCS related parameters
|
||||
\ *epre_Ratio Pointer to ep_ratio
|
||||
\ *reOffset Pointer to RE Offset Value */
|
||||
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset);
|
||||
|
||||
uint8_t
|
||||
nr_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_size,
|
||||
uint8_t *const buffer_pP,
|
||||
const pdcp_transmission_mode_t modeP
|
||||
);
|
||||
|
||||
int
|
||||
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
||||
rnti_t rntiP);
|
||||
|
||||
+1166
-9
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
* 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_gNB_NGAP.h
|
||||
* \brief rrc NGAP procedures for gNB
|
||||
* \author Yoshio INOUE, Masayuki HARADA
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
* (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
|
||||
*/
|
||||
|
||||
#include "rrc_gNB_NGAP.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "rrc_eNB_S1AP.h"
|
||||
#include "gnb_config.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "gtpv1u.h"
|
||||
|
||||
#include "asn1_conversions.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "pdcp.h"
|
||||
#include "pdcp_primitives.h"
|
||||
|
||||
#include "msc.h"
|
||||
|
||||
#include "gtpv1u_eNB_task.h"
|
||||
#include "RRC/LTE/rrc_eNB_GTPV1U.h"
|
||||
|
||||
#include "S1AP_NAS-PDU.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "UTIL/OSA/osa_defs.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
/* Value to indicate an invalid UE initial id */
|
||||
static const uint16_t UE_INITIAL_ID_INVALID = 0;
|
||||
|
||||
/*! \fn uint16_t get_next_ue_initial_id(uint8_t mod_id)
|
||||
*\brief provide an UE initial ID for NGAP initial communication.
|
||||
*\param mod_id Instance ID of gNB.
|
||||
*\return the UE initial ID.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static uint16_t
|
||||
get_next_ue_initial_id(
|
||||
const module_id_t mod_id
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
static uint16_t ue_initial_id[NUMBER_OF_gNB_MAX];
|
||||
ue_initial_id[mod_id]++;
|
||||
|
||||
/* Never use UE_INITIAL_ID_INVALID this is the invalid id! */
|
||||
if (ue_initial_id[mod_id] == UE_INITIAL_ID_INVALID) {
|
||||
ue_initial_id[mod_id]++;
|
||||
}
|
||||
|
||||
return ue_initial_id[mod_id];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Get the UE NG struct containing hashtables NG_id/UE_id.
|
||||
* Is also used to set the NG_id of the UE, depending on inputs.
|
||||
*/
|
||||
struct rrc_ue_ngap_ids_s *
|
||||
rrc_gNB_NGAP_get_ue_ids(
|
||||
gNB_RRC_INST *const rrc_instance_pP,
|
||||
const uint16_t ue_initial_id,
|
||||
const uint32_t gNB_ue_ngap_idP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
rrc_ue_ngap_ids_t *result = NULL;
|
||||
|
||||
/* TODO */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_get_ue_context_from_ngap_ids(
|
||||
const instance_t instanceP,
|
||||
const uint16_t ue_initial_idP,
|
||||
const uint32_t gNB_ue_ngap_idP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
rrc_ue_ngap_ids_t *temp = NULL;
|
||||
temp = rrc_gNB_NGAP_get_ue_ids(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], ue_initial_idP, gNB_ue_ngap_idP);
|
||||
|
||||
if (temp != NULL) {
|
||||
return rrc_gNB_get_ue_context(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], temp->ue_rnti);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
nr_rrc_pdcp_config_security(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
const uint8_t send_security_mode_command
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
|
||||
(void)SRB_configList;
|
||||
uint8_t *kRRCenc = NULL;
|
||||
uint8_t *kRRCint = NULL;
|
||||
uint8_t *kUPenc = NULL;
|
||||
pdcp_t *pdcp_p = NULL;
|
||||
static int print_keys= 1;
|
||||
hashtable_rc_t h_rc;
|
||||
hash_key_t key;
|
||||
|
||||
#ifndef PHYSIM
|
||||
/* Derive the keys from kgnb */
|
||||
if (SRB_configList != NULL) {
|
||||
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kUPenc);
|
||||
}
|
||||
|
||||
derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kRRCenc);
|
||||
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
|
||||
ue_context_pP->ue_context.kgnb,
|
||||
&kRRCint);
|
||||
#endif
|
||||
if (!IS_SOFTMODEM_IQPLAYER) {
|
||||
SET_LOG_DUMP(DEBUG_SECURITY) ;
|
||||
}
|
||||
|
||||
|
||||
if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
|
||||
if (print_keys == 1 ) {
|
||||
print_keys =0;
|
||||
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kgnb, 32,"\nKgNB:" );
|
||||
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" );
|
||||
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" );
|
||||
}
|
||||
}
|
||||
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
|
||||
|
||||
if (h_rc == HASH_TABLE_OK) {
|
||||
pdcp_config_set_security(
|
||||
ctxt_pP,
|
||||
pdcp_p,
|
||||
DCCH,
|
||||
DCCH+2,
|
||||
(send_security_mode_command == TRUE) ?
|
||||
0 | (ue_context_pP->ue_context.integrity_algorithm << 4) :
|
||||
(ue_context_pP->ue_context.ciphering_algorithm ) |
|
||||
(ue_context_pP->ue_context.integrity_algorithm << 4),
|
||||
kRRCenc,
|
||||
kRRCint,
|
||||
kUPenc);
|
||||
} else {
|
||||
LOG_E(NR_RRC,
|
||||
PROTOCOL_NR_RRC_CTXT_UE_FMT"Could not get PDCP instance for SRB DCCH %u\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
DCCH);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Initial UE NAS message on S1AP.
|
||||
*/
|
||||
void
|
||||
rrc_gNB_send_NGAP_NAS_FIRST_REQ(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP,
|
||||
NR_RRCSetupComplete_IEs_t *rrcSetupComplete
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
// gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
||||
MessageDef *message_p = NULL;
|
||||
rrc_ue_ngap_ids_t *rrc_ue_ngap_ids_p = NULL;
|
||||
// hashtable_rc_t h_rc;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_RRC_GNB, NGAP_NAS_FIRST_REQ);
|
||||
memset(&message_p->ittiMsg.ngap_nas_first_req, 0, sizeof(ngap_nas_first_req_t));
|
||||
ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id);
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
|
||||
rrc_ue_ngap_ids_p = malloc(sizeof(rrc_ue_ngap_ids_t));
|
||||
rrc_ue_ngap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
|
||||
rrc_ue_ngap_ids_p->gNB_ue_ngap_id = UE_INITIAL_ID_INVALID;
|
||||
rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti;
|
||||
|
||||
// h_rc = hashtable_insert(RC.nrrrc[ctxt_pP->module_id]->initial_id2_s1ap_ids,
|
||||
// (hash_key_t)ue_context_pP->ue_context.ue_initial_id,
|
||||
// rrc_ue_s1ap_ids_p);
|
||||
|
||||
// if (h_rc != HASH_TABLE_OK) {
|
||||
// LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n",
|
||||
// ctxt_pP->module_id,
|
||||
// ue_context_pP->ue_context.ue_initial_id);
|
||||
// }
|
||||
|
||||
/* Assume that cause is coded in the same way in RRC and NGap, just check that the value is in NGap range */
|
||||
AssertFatal(ue_context_pP->ue_context.establishment_cause < NGAP_RRC_CAUSE_LAST,
|
||||
"Establishment cause invalid (%jd/%d) for gNB %d!",
|
||||
ue_context_pP->ue_context.establishment_cause,
|
||||
NGAP_RRC_CAUSE_LAST,
|
||||
ctxt_pP->module_id);
|
||||
NGAP_NAS_FIRST_REQ(message_p).establishment_cause = ue_context_pP->ue_context.establishment_cause;
|
||||
|
||||
/* Forward NAS message */
|
||||
NGAP_NAS_FIRST_REQ(message_p).nas_pdu.buffer = rrcSetupComplete->dedicatedNAS_Message.buf;
|
||||
NGAP_NAS_FIRST_REQ(message_p).nas_pdu.length = rrcSetupComplete->dedicatedNAS_Message.size;
|
||||
// extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
|
||||
// NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length,
|
||||
// ue_context_pP);
|
||||
|
||||
/* Fill UE identities with available information */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask = NGAP_UE_IDENTITIES_NONE;
|
||||
/* Fill s-TMSI */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.m_tmsi = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi;
|
||||
|
||||
/* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */
|
||||
int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1;
|
||||
NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity;
|
||||
|
||||
if (rrcSetupComplete->registeredAMF != NULL) {
|
||||
NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami;
|
||||
|
||||
if (r_amf->plmn_Identity != NULL) {
|
||||
if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) {
|
||||
/* Use first indicated PLMN MCC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
|
||||
if (r_amf->plmn_Identity->mnc.list.count > 0) {
|
||||
/* Use first indicated PLMN MNC if it is defined */
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity];
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
} else {
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
/* amf_Identifier */
|
||||
uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier);
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
|
||||
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
|
||||
|
||||
ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc;
|
||||
ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len;
|
||||
ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id;
|
||||
ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer;
|
||||
|
||||
MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB,
|
||||
MSC_NGAP_AMF,
|
||||
(const char *)&message_p->ittiMsg.ngap_nas_first_req,
|
||||
sizeof(ngap_nas_first_req_t),
|
||||
MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->rnti);
|
||||
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n",
|
||||
ctxt_pP->module_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id,
|
||||
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id,
|
||||
ue_context_pP->ue_context.rnti);
|
||||
}
|
||||
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, message_p);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
|
||||
MessageDef *msg_p,
|
||||
const char *msg_name,
|
||||
instance_t instance
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
uint16_t ue_initial_id;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
rrc_gNB_ue_context_t *ue_context_p = NULL;
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
ue_initial_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_initial_id;
|
||||
gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).gNB_ue_ngap_id;
|
||||
|
||||
ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id);
|
||||
LOG_I(NR_RRC, "[gNB %d] Received %s: ue_initial_id %d, gNB_ue_ngap_id %d \n",
|
||||
instance, msg_name, ue_initial_id, gNB_ue_ngap_id);
|
||||
|
||||
if (ue_context_p == NULL) {
|
||||
/* Can not associate this message to an UE index, send a failure to NGAP and discard it! */
|
||||
MessageDef *msg_fail_p = NULL;
|
||||
LOG_W(NR_RRC, "[gNB %d] In NGAP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, gNB_ue_ngap_id);
|
||||
msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_INITIAL_CONTEXT_SETUP_FAIL);
|
||||
NGAP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
|
||||
// TODO add failure cause when defined!
|
||||
itti_send_msg_to_task (TASK_NGAP, instance, msg_fail_p);
|
||||
return (-1);
|
||||
} else {
|
||||
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
|
||||
ue_context_p->ue_context.gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).gNB_ue_ngap_id;
|
||||
ue_context_p->ue_context.amf_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).amf_ue_ngap_id;
|
||||
|
||||
/* NAS PDU */
|
||||
if (ue_context_p->ue_context.nas_pdu_flag == 1) {
|
||||
ue_context_p->ue_context.nas_pdu.length = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.length;
|
||||
ue_context_p->ue_context.nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.buffer;
|
||||
}
|
||||
|
||||
/* TODO security */
|
||||
rrc_gNB_process_security(&ctxt, ue_context_p, &(NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_capabilities));
|
||||
|
||||
uint8_t send_security_mode_command = TRUE;
|
||||
|
||||
nr_rrc_pdcp_config_security(
|
||||
&ctxt,
|
||||
ue_context_p,
|
||||
send_security_mode_command);
|
||||
|
||||
if (send_security_mode_command) {
|
||||
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p);
|
||||
send_security_mode_command = FALSE;
|
||||
|
||||
nr_rrc_pdcp_config_security(
|
||||
&ctxt,
|
||||
ue_context_p,
|
||||
send_security_mode_command);
|
||||
} else {
|
||||
/* rrc_gNB_generate_UECapabilityEnquiry */
|
||||
rrc_gNB_generate_UECapabilityEnquiry(&ctxt, ue_context_p);
|
||||
}
|
||||
|
||||
// in case, send the S1SP initial context response if it is not sent with the attach complete message
|
||||
if (ue_context_p->ue_context.Status == NR_RRC_RECONFIGURED) {
|
||||
LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
MessageDef *msg_p = NULL;
|
||||
int e_rab;
|
||||
int e_rabs_done = 0;
|
||||
int e_rabs_failed = 0;
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_ENB, NGAP_INITIAL_CONTEXT_SETUP_RESP);
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_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) {
|
||||
e_rabs_done++;
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[e_rab].pdusession_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
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[e_rab].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[e_rab];
|
||||
memcpy(NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[e_rab].gNB_addr.buffer , ue_context_pP->ue_context.gnb_gtp_addrs[e_rab].buffer, 20);
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[e_rab].gNB_addr.length = 4;
|
||||
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
|
||||
} else {
|
||||
e_rabs_failed++;
|
||||
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[e_rab].pdusession_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
|
||||
// TODO add cause when it will be integrated
|
||||
}
|
||||
}
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_RRC_GNB,
|
||||
MSC_S1AP_ENB,
|
||||
(const char *)&NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p),
|
||||
sizeof(ngap_initial_context_setup_resp_t),
|
||||
MSC_AS_TIME_FMT" INITIAL_CONTEXT_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ue_context_pP->ue_id_rnti,
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id,
|
||||
e_rabs_done, e_rabs_failed);
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions = e_rabs_done;
|
||||
NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions_failed = e_rabs_failed;
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
|
||||
}
|
||||
|
||||
static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(uint16_t algorithms) {
|
||||
//#warning "Forced return NR_CipheringAlgorithm_nea0, to be deleted in future"
|
||||
return NR_CipheringAlgorithm_nea0;
|
||||
}
|
||||
|
||||
static e_NR_IntegrityProtAlgorithm rrc_gNB_select_integrity(uint16_t algorithms) {
|
||||
|
||||
// to be continue
|
||||
return NR_IntegrityProtAlgorithm_nia0;
|
||||
}
|
||||
|
||||
int
|
||||
rrc_gNB_process_security(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
ngap_security_capabilities_t *security_capabilities_pP
|
||||
) {
|
||||
boolean_t changed = FALSE;
|
||||
NR_CipheringAlgorithm_t cipheringAlgorithm;
|
||||
e_NR_IntegrityProtAlgorithm integrityProtAlgorithm;
|
||||
/* Save security parameters */
|
||||
ue_context_pP->ue_context.security_capabilities = *security_capabilities_pP;
|
||||
// translation
|
||||
LOG_D(NR_RRC,
|
||||
"[eNB %d] NAS security_capabilities.encryption_algorithms %u AS ciphering_algorithm %lu NAS security_capabilities.integrity_algorithms %u AS integrity_algorithm %u\n",
|
||||
ctxt_pP->module_id,
|
||||
ue_context_pP->ue_context.security_capabilities.nRencryption_algorithms,
|
||||
(unsigned long)ue_context_pP->ue_context.ciphering_algorithm,
|
||||
ue_context_pP->ue_context.security_capabilities.nRintegrity_algorithms,
|
||||
ue_context_pP->ue_context.integrity_algorithm);
|
||||
/* Select relevant algorithms */
|
||||
cipheringAlgorithm = rrc_gNB_select_ciphering (ue_context_pP->ue_context.security_capabilities.nRencryption_algorithms);
|
||||
|
||||
if (ue_context_pP->ue_context.ciphering_algorithm != cipheringAlgorithm) {
|
||||
ue_context_pP->ue_context.ciphering_algorithm = cipheringAlgorithm;
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
integrityProtAlgorithm = rrc_gNB_select_integrity (ue_context_pP->ue_context.security_capabilities.nRintegrity_algorithms);
|
||||
|
||||
if (ue_context_pP->ue_context.integrity_algorithm != integrityProtAlgorithm) {
|
||||
ue_context_pP->ue_context.integrity_algorithm = integrityProtAlgorithm;
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
LOG_I (NR_RRC, "[eNB %d][UE %x] Selected security algorithms (%p): %lx, %x, %s\n",
|
||||
ctxt_pP->module_id,
|
||||
ue_context_pP->ue_context.rnti,
|
||||
security_capabilities_pP,
|
||||
(unsigned long)cipheringAlgorithm,
|
||||
integrityProtAlgorithm,
|
||||
changed ? "changed" : "same");
|
||||
return changed;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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_gNB_NGAP.h
|
||||
* \brief rrc NGAP procedures for gNB
|
||||
* \author Yoshio INOUE, Masayuki HARADA
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
* (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
|
||||
*/
|
||||
|
||||
#ifndef RRC_GNB_NGAP_H_
|
||||
#define RRC_GNB_NGAP_H_
|
||||
|
||||
#include "rrc_gNB_UE_context.h"
|
||||
#include "nr_rrc_defs.h"
|
||||
#include "nr_rrc_extern.h"
|
||||
|
||||
#include "NR_RRCSetupComplete-IEs.h"
|
||||
#include "NR_RegisteredAMF.h"
|
||||
|
||||
typedef struct rrc_ue_ngap_ids_s {
|
||||
/* Tree related data */
|
||||
RB_ENTRY(rrc_ue_ngap_ids_s) entries;
|
||||
|
||||
// keys
|
||||
uint16_t ue_initial_id;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
// value
|
||||
rnti_t ue_rnti;
|
||||
} rrc_ue_ngap_ids_t;
|
||||
|
||||
void
|
||||
rrc_gNB_send_NGAP_NAS_FIRST_REQ(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_pP,
|
||||
NR_RRCSetupComplete_IEs_t *rrcSetupComplete
|
||||
);
|
||||
|
||||
int
|
||||
rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
|
||||
MessageDef *msg_p,
|
||||
const char *msg_name,
|
||||
instance_t instance
|
||||
);
|
||||
|
||||
void
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
);
|
||||
|
||||
int
|
||||
rrc_gNB_process_security(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
ngap_security_capabilities_t *security_capabilities_pP
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -189,7 +189,7 @@ void rrc_gNB_free_mem_UE_context(
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void rrc_gNB_remove_ue_context(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
struct rrc_gNB_ue_context_s *ue_context_pP)
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -220,4 +220,82 @@ void rrc_gNB_remove_ue_context(
|
||||
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// return the ue context if there is already an UE with ue_identityP, NULL otherwise
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_ue_context_random_exist(
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t ue_identityP
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head) {
|
||||
if (ue_context_p->ue_context.random_ue_identity == ue_identityP)
|
||||
return ue_context_p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// return the ue context if there is already an UE with the same S-TMSI, NULL otherwise
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_ue_context_5g_s_tmsi_exist(
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t s_TMSI
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head) {
|
||||
LOG_I(NR_RRC,"checking for UE 5G S-TMSI %ld: rnti %d \n",
|
||||
s_TMSI, ue_context_p->ue_context.rnti);
|
||||
|
||||
if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 == s_TMSI) {
|
||||
return ue_context_p;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_get_next_free_ue_context(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t ue_identityP
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
ue_context_p = rrc_gNB_get_ue_context(rrc_instance_pP, ctxt_pP->rnti);
|
||||
|
||||
if (ue_context_p == NULL) {
|
||||
ue_context_p = rrc_gNB_allocate_new_UE_context(rrc_instance_pP);
|
||||
|
||||
if (ue_context_p == NULL) {
|
||||
LOG_E(NR_RRC,
|
||||
PROTOCOL_NR_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else
|
||||
ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed
|
||||
ue_context_p->ue_context.random_ue_identity = ue_identityP;
|
||||
RB_INSERT(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_p);
|
||||
LOG_D(NR_RRC,
|
||||
PROTOCOL_NR_RRC_CTXT_UE_FMT" Created new UE context uid %u\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
|
||||
ue_context_p->local_uid);
|
||||
return ue_context_p;
|
||||
} else {
|
||||
LOG_E(NR_RRC,
|
||||
PROTOCOL_NR_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n",
|
||||
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return(ue_context_p);
|
||||
}
|
||||
|
||||
@@ -73,10 +73,34 @@ rrc_gNB_get_ue_context(
|
||||
rnti_t rntiP
|
||||
);
|
||||
|
||||
void rrc_gNB_free_mem_UE_context(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
struct rrc_gNB_ue_context_s *const ue_context_pP
|
||||
);
|
||||
|
||||
void rrc_gNB_remove_ue_context(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
gNB_RRC_INST* rrc_instance_pP,
|
||||
struct rrc_gNB_ue_context_s* ue_context_pP
|
||||
);
|
||||
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_ue_context_random_exist(
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t ue_identityP
|
||||
);
|
||||
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_ue_context_5g_s_tmsi_exist(
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t s_TMSI
|
||||
);
|
||||
|
||||
struct rrc_gNB_ue_context_s *
|
||||
rrc_gNB_get_next_free_ue_context(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
gNB_RRC_INST *rrc_instance_pP,
|
||||
const uint64_t ue_identityP
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -222,7 +222,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10;
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1;
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1));
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311_v1530 = NR_RLF_TimersAndConstants__ext1__t311_v1530_ms30000;
|
||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000;
|
||||
secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL;
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated));
|
||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL;
|
||||
@@ -894,7 +894,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0);
|
||||
*pucchresset0id1=2;
|
||||
ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1);
|
||||
pucchresset0->maxPayloadMinus1=NULL;
|
||||
pucchresset0->maxPayloadSize=NULL;
|
||||
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0);
|
||||
|
||||
@@ -905,7 +905,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0);
|
||||
*pucchresset1id1=4;
|
||||
ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1);
|
||||
pucchresset1->maxPayloadMinus1=NULL;
|
||||
pucchresset1->maxPayloadSize=NULL;
|
||||
ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1);
|
||||
|
||||
pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList));
|
||||
@@ -1296,7 +1296,7 @@ void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMc
|
||||
for(i = 0; i < 3; i++) {
|
||||
ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list,&ptrsMcs[i]);
|
||||
}
|
||||
}// if memory exist then over write the old values
|
||||
}// if memory exist then over write the old values
|
||||
else {
|
||||
for(i = 0; i < 2; i++) {
|
||||
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] = ptrsNrb[i];
|
||||
|
||||
@@ -67,4 +67,43 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
|
||||
// todo
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
rrc_data_req_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
|
||||
)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
itti_send_msg_to_task (
|
||||
TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
|
||||
}
|
||||
|
||||
+2354
-297
File diff suppressed because it is too large
Load Diff
@@ -53,8 +53,15 @@
|
||||
#include "NR_MIB.h"
|
||||
#include "NR_BCCH-BCH-Message.h"
|
||||
#include "NR_DL-DCCH-Message.h"
|
||||
#include "../NR/nr_rrc_defs.h"
|
||||
|
||||
#define NB_NR_UE_INST 1
|
||||
#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
|
||||
|
||||
typedef uint32_t channel_t;
|
||||
|
||||
@@ -63,14 +70,65 @@ typedef enum {
|
||||
nr_RadioBearerConfigX_r15=1
|
||||
} nsa_message_t;
|
||||
|
||||
#define MAX_UE_NR_CAPABILITY_SIZE 255
|
||||
typedef struct OAI_NR_UECapability_s {
|
||||
uint8_t sdu[MAX_UE_NR_CAPABILITY_SIZE];
|
||||
uint8_t sdu_size;
|
||||
NR_UE_NR_Capability_t *UE_NR_Capability;
|
||||
} OAI_NR_UECapability_t;
|
||||
|
||||
typedef struct NR_UE_RRC_INST_s {
|
||||
|
||||
NR_MeasConfig_t *meas_config;
|
||||
NR_CellGroupConfig_t *cell_group_config;
|
||||
NR_RadioBearerConfig_t *radio_bearer_config;
|
||||
|
||||
|
||||
NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
|
||||
NR_ReportConfigToAddMod_t *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
|
||||
NR_QuantityConfig_t *QuantityConfig[NB_CNX_UE];
|
||||
NR_MeasIdToAddMod_t *MeasId[NB_CNX_UE][MAX_MEAS_ID];
|
||||
NR_MeasGapConfig_t *measGapConfig[NB_CNX_UE];
|
||||
NR_RSRP_Range_t s_measure;
|
||||
NR_SRB_ToAddMod_t *SRB1_config[NB_CNX_UE];
|
||||
NR_SRB_ToAddMod_t *SRB2_config[NB_CNX_UE];
|
||||
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];
|
||||
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_size;
|
||||
|
||||
NR_SystemInformation_t *si[NB_CNX_UE];
|
||||
NR_SIB1_t *sib1[NB_CNX_UE];
|
||||
NR_SIB2_t *sib2[NB_CNX_UE];
|
||||
NR_SIB3_t *sib3[NB_CNX_UE];
|
||||
NR_SIB4_t *sib4[NB_CNX_UE];
|
||||
NR_SIB5_t *sib5[NB_CNX_UE];
|
||||
NR_SIB6_t *sib6[NB_CNX_UE];
|
||||
NR_SIB7_t *sib7[NB_CNX_UE];
|
||||
NR_SIB8_t *sib8[NB_CNX_UE];
|
||||
NR_SIB9_t *sib9[NB_CNX_UE];
|
||||
NR_SIB10_r16_t *sib10[NB_CNX_UE];
|
||||
NR_SIB11_r16_t *sib11[NB_CNX_UE];
|
||||
NR_SIB12_r16_t *sib12[NB_CNX_UE];
|
||||
NR_SIB13_r16_t *sib13[NB_CNX_UE];
|
||||
NR_SIB14_r16_t *sib14[NB_CNX_UE];
|
||||
plmn_t plmnID;
|
||||
|
||||
NR_UE_RRC_INFO Info[NB_SIG_CNX_UE];
|
||||
|
||||
NR_MIB_t *mib;
|
||||
|
||||
|
||||
/* KeNB as computed from parameters within USIM card */
|
||||
uint8_t kgnb[32];
|
||||
NR_CipheringAlgorithm_t cipheringAlgorithm;
|
||||
e_NR_IntegrityProtAlgorithm integrityProtAlgorithm;
|
||||
|
||||
// lists
|
||||
// CellGroupConfig.rlc-BearerToAddModList
|
||||
RRC_LIST_TYPE(NR_RLC_BearerConfig_t, NR_maxLC_ID) RLC_Bearer_Config_list;
|
||||
@@ -118,7 +176,11 @@ typedef struct NR_UE_RRC_INST_s {
|
||||
RRC_LIST_TYPE(NR_CSI_ResourceConfig_t, NR_maxNrofCSI_ResourceConfigurations) CSI_ResourceConfig_list;
|
||||
// CellGroupConfig.spCellConfig.spCellConfigDedicated
|
||||
RRC_LIST_TYPE(NR_CSI_ReportConfig_t, NR_maxNrofCSI_ReportConfigurations) CSI_ReportConfig_list;
|
||||
|
||||
|
||||
long selected_plmn_identity;
|
||||
Rrc_State_NR_t nrRrcState;
|
||||
Rrc_Sub_State_NR_t nrRrcSubState;
|
||||
as_nas_info_t initialNasMsg;
|
||||
} NR_UE_RRC_INST_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,12 +59,12 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char*);
|
||||
\param size length of buffer*/
|
||||
//TODO check to use which one
|
||||
//int8_t nr_rrc_ue_decode_rrcReconfiguration(const uint8_t *buffer, const uint32_t size);
|
||||
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const uint8_t *buffer, const uint32_t size);
|
||||
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id, const uint8_t *buffer, const uint32_t size);
|
||||
|
||||
|
||||
/**\brief Process NR RRC connection reconfiguration via SRB3
|
||||
\param rrcReconfiguration decoded rrc connection reconfiguration*/
|
||||
int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfiguration);
|
||||
int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCReconfiguration_t *rrcReconfiguration);
|
||||
|
||||
/**\prief Process measurement config from NR RRC connection reconfiguration message
|
||||
\param meas_config measurement configuration*/
|
||||
@@ -73,7 +73,7 @@ int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config);
|
||||
/**\prief Process secondary cell group config from NR RRC connection reconfiguration message or EN-DC primitives
|
||||
\param cell_group_config secondary cell group configuration*/
|
||||
//TODO check EN-DC function call flow.
|
||||
int8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config);
|
||||
int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupConfig_t *cell_group_config);
|
||||
|
||||
/**\prief Process radio bearer config from NR RRC connection reconfiguration message
|
||||
\param radio_bearer_config radio bearer configuration*/
|
||||
@@ -114,6 +114,16 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
|
||||
const rb_id_t Srb_id,
|
||||
uint8_t *const buffer_pP);
|
||||
|
||||
|
||||
/**\brief RRC UE task.
|
||||
\param void *args_p Pointer on arguments to start the task. */
|
||||
void *rrc_nrue_task(void *args_p);
|
||||
|
||||
/**\brief RRC UE generate RRCSetupRequest message.
|
||||
\param ctxt_pP protocol context
|
||||
\param gNB_index gNB index */
|
||||
void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index );
|
||||
|
||||
/** @}*/
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 sdap_gNB.c
|
||||
* \brief sdap tasks for gNB
|
||||
* \author Konstantinos Alexandris <Konstantinos.Alexandris@eurecom.fr>, Cedric Roux <Cedric.Roux@eurecom.fr>, Navid Nikaein <Navid.Nikaein@eurecom.fr>
|
||||
* \date 2018
|
||||
* \version 1.0
|
||||
*/
|
||||
#define SDAP_GNB
|
||||
#define SDAP_GNB_C
|
||||
|
||||
@@ -0,0 +1,649 @@
|
||||
/*
|
||||
* 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 itti_sim.c
|
||||
* \brief simulator for itti message from node to UE
|
||||
* \author Yoshio INOUE, Masayuki HARADA
|
||||
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
#include <common/utils/assertions.h>
|
||||
|
||||
#include "msc.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
#include "PHY/phy_vars.h"
|
||||
#include "SCHED/sched_common_vars.h"
|
||||
#include "LAYER2/MAC/mac_vars.h"
|
||||
#include "RRC/LTE/rrc_vars.h"
|
||||
#include "gnb_config.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
|
||||
#ifdef SMBV
|
||||
#include "PHY/TOOLS/smbv.h"
|
||||
unsigned short config_frames[4] = {2,9,11,13};
|
||||
#endif
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
#ifndef OPENAIR2
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#endif
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include <openair2/GNB_APP/gnb_app.h>
|
||||
#include "PHY/TOOLS/phy_scope_interface.h"
|
||||
#include "PHY/TOOLS/nr_phy_scope.h"
|
||||
#include "stats.h"
|
||||
#include "nr-softmodem.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "executables/thread-common.h"
|
||||
#include "NB_IoT_interface.h"
|
||||
#include "x2ap_eNB.h"
|
||||
#include "ngap_gNB.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
#include "RRC/NR_UE/rrc_vars.h"
|
||||
#include "openair3/NAS/UE/nas_ue_task.h"
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
|
||||
uint8_t nfapi_mode = 0; // Default to monolithic mode
|
||||
uint32_t target_dl_mcs = 28;
|
||||
uint32_t target_ul_mcs = 20;
|
||||
uint32_t timing_advance = 0;
|
||||
uint64_t num_missed_slots=0;
|
||||
|
||||
int split73=0;
|
||||
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
|
||||
AssertFatal(false, "Must not be called in this context\n");
|
||||
}
|
||||
|
||||
pthread_cond_t sync_cond;
|
||||
pthread_mutex_t sync_mutex;
|
||||
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
|
||||
int config_sync_var=-1;
|
||||
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
volatile int start_gNB = 0;
|
||||
volatile int oai_exit = 0;
|
||||
|
||||
//static int wait_for_sync = 0;
|
||||
|
||||
unsigned int mmapped_dma=0;
|
||||
int single_thread_flag=1;
|
||||
|
||||
int8_t threequarter_fs=0;
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
//Temp fix for inexistent NR upper layer
|
||||
unsigned char NB_gNB_INST = 1;
|
||||
|
||||
static char *itti_dump_file = NULL;
|
||||
|
||||
int UE_scan = 1;
|
||||
int UE_scan_carrier = 0;
|
||||
runmode_t mode = normal_txrx;
|
||||
static double snr_dB=20;
|
||||
|
||||
FILE *input_fd=NULL;
|
||||
|
||||
int chain_offset=0;
|
||||
|
||||
|
||||
uint8_t dci_Format = 0;
|
||||
uint8_t agregation_Level =0xFF;
|
||||
|
||||
uint8_t nb_antenna_tx = 1;
|
||||
uint8_t nb_antenna_rx = 1;
|
||||
|
||||
char ref[128] = "internal";
|
||||
char channels[128] = "0";
|
||||
|
||||
int otg_enabled;
|
||||
|
||||
extern void *udp_eNB_task(void *args_p);
|
||||
|
||||
int transmission_mode=1;
|
||||
int emulate_rf = 0;
|
||||
int numerology = 0;
|
||||
int usrp_tx_thread = 0;
|
||||
|
||||
|
||||
double cpuf;
|
||||
|
||||
extern char uecap_xer[1024];
|
||||
char uecap_xer_in=0;
|
||||
|
||||
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
||||
* this is very hackish - find a proper solution
|
||||
*/
|
||||
uint8_t abstraction_flag=0;
|
||||
|
||||
/* forward declarations */
|
||||
void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
|
||||
/*---------------------BMC: timespec helpers -----------------------------*/
|
||||
|
||||
struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
|
||||
struct timespec clock_difftime(struct timespec start, struct timespec end) {
|
||||
struct timespec temp;
|
||||
|
||||
if ((end.tv_nsec-start.tv_nsec)<0) {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec-1;
|
||||
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
|
||||
} else {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec;
|
||||
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define KNRM "\x1B[0m"
|
||||
#define KRED "\x1B[31m"
|
||||
#define KGRN "\x1B[32m"
|
||||
#define KBLU "\x1B[34m"
|
||||
#define RESET "\033[0m"
|
||||
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
||||
int ru_id;
|
||||
|
||||
if (s != NULL) {
|
||||
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
|
||||
}
|
||||
|
||||
oai_exit = 1;
|
||||
|
||||
if (RC.ru == NULL)
|
||||
exit(-1); // likely init not completed, prevent crash or hang, exit now...
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
if (RC.ru[ru_id] && RC.ru[ru_id]->rfdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
||||
}
|
||||
|
||||
if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
sleep(1); //allow lte-softmodem threads to exit first
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void wait_gNBs(void) {
|
||||
int i;
|
||||
int waiting=1;
|
||||
|
||||
while (waiting==1) {
|
||||
printf("Waiting for gNB L1 instances to all get configured ... sleeping 50ms (nb_nr_sL1_inst %d)\n",RC.nb_nr_L1_inst);
|
||||
usleep(50*1000);
|
||||
waiting=0;
|
||||
|
||||
for (i=0; i<RC.nb_nr_L1_inst; i++) {
|
||||
|
||||
if (RC.gNB[i]->configured==0) {
|
||||
waiting=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("gNB L1 are configured\n");
|
||||
}
|
||||
|
||||
void wait_RUs(void) {
|
||||
LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
|
||||
// wait for all RUs to be configured over fronthaul
|
||||
pthread_mutex_lock(&RC.ru_mutex);
|
||||
|
||||
while (RC.ru_mask>0) {
|
||||
pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
|
||||
printf("RC.ru_mask:%02lx\n", RC.ru_mask);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&RC.ru_mutex);
|
||||
LOG_I(PHY,"RUs configured\n");
|
||||
}
|
||||
|
||||
|
||||
int stop_L1L2(module_id_t gnb_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int restart_L1L2(module_id_t gnb_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int create_gNB_tasks(uint32_t gnb_nb) {
|
||||
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
|
||||
itti_wait_ready(1);
|
||||
|
||||
|
||||
if (gnb_nb > 0) {
|
||||
if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0){
|
||||
LOG_E(SCTP, "Create task for SCTP failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (is_x2ap_enabled()) {
|
||||
if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0){
|
||||
LOG_E(X2AP, "Create task for X2AP failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_I(X2AP, "X2AP is disabled.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) {
|
||||
if (gnb_nb > 0) {
|
||||
if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) {
|
||||
LOG_E(S1AP, "Create task for NGAP failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if(!emulate_rf){
|
||||
if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
|
||||
LOG_E(UDP_, "Create task for UDP failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (itti_create_task (TASK_GTPV1_U, >pv1u_gNB_task, NULL) < 0) {
|
||||
LOG_E(GTPU, "Create task for GTPV1U failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gnb_nb > 0) {
|
||||
if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
|
||||
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
|
||||
return -1;
|
||||
}
|
||||
LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
|
||||
|
||||
if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) {
|
||||
LOG_E(NR_RRC, "Create task for NR RRC gNB failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
|
||||
|
||||
paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
|
||||
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options(SOFTMODEM_GNB_BIT );
|
||||
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
|
||||
|
||||
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
|
||||
memset((void *)&RC,0,sizeof(RC));
|
||||
/* Read RC configuration file */
|
||||
NRRCConfig();
|
||||
NB_gNB_INST = RC.nb_nr_inst;
|
||||
NB_RU = RC.nb_RU;
|
||||
printf("Configuration: nb_rrc_inst %d, nb_nr_L1_inst %d, nb_ru %hhu\n",NB_gNB_INST,RC.nb_nr_L1_inst,NB_RU);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs],
|
||||
NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs])
|
||||
{
|
||||
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) malloc(sizeof(NR_DL_FRAME_PARMS));
|
||||
config[CC_id] = (nfapi_nr_config_request_scf_t *) malloc(sizeof(nfapi_nr_config_request_scf_t));
|
||||
config[CC_id]->ssb_config.scs_common.value = 1;
|
||||
config[CC_id]->cell_config.frame_duplex_type.value = 1; //FDD
|
||||
config[CC_id]->carrier_config.dl_grid_size[1].value = 106;
|
||||
config[CC_id]->carrier_config.ul_grid_size[1].value = 106;
|
||||
config[CC_id]->cell_config.phy_cell_id.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* helper function to terminate a certain ITTI task
|
||||
*/
|
||||
void terminate_task(task_id_t task_id, module_id_t mod_id) {
|
||||
LOG_I(GNB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
|
||||
MessageDef *msg;
|
||||
msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE);
|
||||
itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
|
||||
}
|
||||
|
||||
//extern void free_transport(PHY_VARS_gNB *);
|
||||
extern void nr_phy_free_RU(RU_t *);
|
||||
|
||||
void init_pdcp(void) {
|
||||
//if (!NODE_IS_DU(RC.rrc[0]->node_type)) {
|
||||
pdcp_layer_init();
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
printf("IS_SOFTMODEM_NOS1 option enabled \n");
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
|
||||
}
|
||||
|
||||
pdcp_module_init(pdcp_initmask);
|
||||
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
|
||||
|
||||
int create_tasks_nrue(uint32_t ue_nb) {
|
||||
LOG_D(ENB_APP, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
|
||||
itti_wait_ready(1);
|
||||
|
||||
if (ue_nb > 0) {
|
||||
printf("create TASK_RRC_NRUE\n");
|
||||
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
|
||||
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
itti_wait_ready(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *itti_sim_ue_rrc_task( void *args_p) {
|
||||
MessageDef *msg_p, *message_p;
|
||||
instance_t instance;
|
||||
unsigned int ue_mod_id;
|
||||
int result;
|
||||
itti_mark_task_ready (TASK_RRC_UE_SIM);
|
||||
|
||||
while(1) {
|
||||
// Wait for a message
|
||||
itti_receive_msg (TASK_RRC_UE_SIM, &msg_p);
|
||||
instance = ITTI_MSG_INSTANCE (msg_p);
|
||||
ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance);
|
||||
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
LOG_W(NR_RRC, " *** Exiting RRC thread\n");
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
case MESSAGE_TEST:
|
||||
LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
case GNB_RRC_BCCH_DATA_IND:
|
||||
message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_MAC_BCCH_DATA_IND);
|
||||
memset (NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = GNB_RRC_BCCH_DATA_IND(msg_p).size;
|
||||
memcpy (NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, GNB_RRC_BCCH_DATA_IND(msg_p).sdu, GNB_RRC_BCCH_DATA_IND(msg_p).size);
|
||||
itti_send_msg_to_task (TASK_RRC_NRUE, instance, message_p);
|
||||
break;
|
||||
case GNB_RRC_CCCH_DATA_IND:
|
||||
message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_MAC_CCCH_DATA_IND);
|
||||
printf("receive GNB_RRC_CCCH_DATA_IND\n");
|
||||
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, GNB_RRC_CCCH_DATA_IND(msg_p).sdu, GNB_RRC_CCCH_DATA_IND(msg_p).size);
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = GNB_RRC_CCCH_DATA_IND(msg_p).size;
|
||||
itti_send_msg_to_task (TASK_RRC_NRUE, instance, message_p);
|
||||
break;
|
||||
case GNB_RRC_DCCH_DATA_IND:
|
||||
printf("receive GNB_RRC_DCCH_DATA_IND\n");
|
||||
message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_DCCH_DATA_IND);
|
||||
NR_RRC_DCCH_DATA_IND (message_p).dcch_index = GNB_RRC_DCCH_DATA_IND(msg_p).rbid;
|
||||
NR_RRC_DCCH_DATA_IND (message_p).sdu_size = GNB_RRC_DCCH_DATA_IND(msg_p).size;
|
||||
NR_RRC_DCCH_DATA_IND (message_p).sdu_p = GNB_RRC_DCCH_DATA_IND(msg_p).sdu;
|
||||
itti_send_msg_to_task (TASK_RRC_NRUE, instance, message_p);
|
||||
break;
|
||||
default:
|
||||
LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
msg_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *itti_sim_gnb_rrc_task( void *args_p) {
|
||||
MessageDef *msg_p, *message_p;
|
||||
instance_t instance;
|
||||
unsigned int ue_mod_id;
|
||||
int result;
|
||||
itti_mark_task_ready (TASK_RRC_GNB_SIM);
|
||||
|
||||
while(1) {
|
||||
// Wait for a message
|
||||
itti_receive_msg (TASK_RRC_GNB_SIM, &msg_p);
|
||||
instance = ITTI_MSG_INSTANCE (msg_p);
|
||||
ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance);
|
||||
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
LOG_W(NR_RRC, " *** Exiting RRC thread\n");
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
case MESSAGE_TEST:
|
||||
LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
case UE_RRC_CCCH_DATA_IND:
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_MAC_CCCH_DATA_IND);
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = UE_RRC_CCCH_DATA_IND(msg_p).size;
|
||||
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).size);
|
||||
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
|
||||
break;
|
||||
case UE_RRC_DCCH_DATA_IND:
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_DCCH_DATA_IND);
|
||||
NR_RRC_DCCH_DATA_IND (message_p).sdu_size = UE_RRC_DCCH_DATA_IND(msg_p).size;
|
||||
NR_RRC_DCCH_DATA_IND (message_p).dcch_index = UE_RRC_DCCH_DATA_IND(msg_p).rbid;
|
||||
NR_RRC_DCCH_DATA_IND (message_p).sdu_p = UE_RRC_DCCH_DATA_IND(msg_p).sdu;
|
||||
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
msg_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
start_background_system();
|
||||
|
||||
///static configuration for NR at the moment
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
set_softmodem_sighandler();
|
||||
#ifdef DEBUG_CONSOLE
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
#endif
|
||||
|
||||
logInit();
|
||||
//configure_linux();
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// AMF_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
AMF_MODE_ENABLED = 0;
|
||||
|
||||
#if T_TRACER
|
||||
T_Config_Init();
|
||||
#endif
|
||||
//randominit (0);
|
||||
set_taus_seed (0);
|
||||
printf("configuring for RAU/RRU\n");
|
||||
|
||||
if (opp_enabled ==1) {
|
||||
reset_opp_meas();
|
||||
}
|
||||
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
// initialize mscgen log after ITTI
|
||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||
|
||||
|
||||
init_opt();
|
||||
|
||||
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
init_pdcp();
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
|
||||
} else {
|
||||
printf("No ITTI, Initializing L1\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(itti_create_task (TASK_RRC_GNB_SIM, itti_sim_gnb_rrc_task, NULL) < 0){
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1); // need a softer mode
|
||||
}
|
||||
|
||||
openair_rrc_top_init_ue_nr("./");
|
||||
|
||||
if (create_tasks_nrue(1) < 0) {
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1); // need a softer mode
|
||||
}
|
||||
|
||||
if(itti_create_task (TASK_RRC_UE_SIM, itti_sim_ue_rrc_task, NULL) < 0){
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1); // need a softer mode
|
||||
}
|
||||
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
|
||||
printf("Sending sync to all threads\n");
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
sync_var=0;
|
||||
pthread_cond_broadcast(&sync_cond);
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
// wait for end of program
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
|
||||
usleep(100000);
|
||||
protocol_ctxt_t ctxt;
|
||||
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
|
||||
|
||||
|
||||
ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[0]);
|
||||
|
||||
if(ue_context_p == NULL){
|
||||
printf("ue_context_p == NULL");
|
||||
}
|
||||
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
|
||||
0,
|
||||
ENB_FLAG_YES,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
NR_UE_rrc_inst[ctxt.module_id].Info[0].State = RRC_SI_RECEIVED;
|
||||
|
||||
rrc_ue_generate_RRCSetupRequest(&ctxt, 0);
|
||||
|
||||
printf("Entering ITTI signals handler\n");
|
||||
itti_wait_tasks_end();
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
|
||||
printf("stopping MODEM threads\n");
|
||||
|
||||
|
||||
/* release memory used by the RU/gNB threads (incomplete), after all
|
||||
* threads have been stopped (they partially use the same memory) */
|
||||
|
||||
pthread_cond_destroy(&sync_cond);
|
||||
pthread_mutex_destroy(&sync_mutex);
|
||||
|
||||
logClean();
|
||||
printf("Bye.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user