nr_rrc_proto.h 7.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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
 */

WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
22 23 24 25 26
/*! \file nr_rrc_proto.h
 * \brief RRC functions prototypes for gNB
 * \author Navid Nikaein and Raymond Knopp, WEI-TAI-CHEN
 * \date 2010 - 2014, 2018
 * \email navid.nikaein@eurecom.fr, kroempa@gmail.com
27
 * \version 1.0
WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
28
 * \company Eurecom, NTUST
29 30 31 32
 */
/** \addtogroup _rrc
 *  @{
 */
33

34 35
#include "RRC/NR/nr_rrc_defs.h"
#include "flexran_agent_extern.h"
Raymond Knopp's avatar
Raymond Knopp committed
36 37 38
#include "NR_RRCReconfiguration.h"
#include "NR_UE-NR-Capability.h"
#include "NR_UE-CapabilityRAT-ContainerList.h"
39
#include "LTE_UE-CapabilityRAT-ContainerList.h"
Raymond Knopp's avatar
Raymond Knopp committed
40 41
#include "NR_CG-Config.h"
#include "NR_CG-ConfigInfo.h"
42
#include "NR_SecurityConfig.h"
43

44
int rrc_init_nr_global_param(void);
45

46
void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
47 48 49
                          uint8_t Lchan_type,
                          uint8_t Role);

50 51 52 53
int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
                           const int         CC_id,
                           const frame_t     frameP,
                           const rb_id_t     Srb_id,
rmagueta's avatar
rmagueta committed
54
                           const rnti_t      rnti,
55 56 57
                           const uint8_t     Nb_tb,
                           uint8_t *const    buffer_pP );

WEI-TAI CHEN's avatar
WEI-TAI CHEN committed
58 59 60 61 62 63 64 65 66
void rrc_gNB_process_SgNBAdditionRequest( 
     const protocol_ctxt_t  *const ctxt_pP,
     rrc_gNB_ue_context_t   *ue_context_pP 
     );

void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( 
     const protocol_ctxt_t  *const ctxt_pP,
     rrc_gNB_ue_context_t   *const ue_context_pP
     );
67

Raymond Knopp's avatar
Raymond Knopp committed
68 69
struct rrc_gNB_ue_context_s *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP);

70
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t * cg_config_info);
Raymond Knopp's avatar
Raymond Knopp committed
71

72
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m);
Raymond Knopp's avatar
Raymond Knopp committed
73

Cedric Roux's avatar
Cedric Roux committed
74 75
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);

76 77 78 79 80 81
void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon);

void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon);

void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0);

Raymond Knopp's avatar
Raymond Knopp committed
82
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
83 84 85 86 87 88
                                     NR_ServingCellConfig_t *servingcellconfigdedicated,
                                     NR_CellGroupConfig_t *secondaryCellGroup,
                                     int scg_id,
                                     int servCellIndex,
                                     int n_physical_antenna_ports,
                                     int initial_csi_index);
Raymond Knopp's avatar
Raymond Knopp committed
89 90

void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
91 92 93 94 95
                           NR_ServingCellConfig_t *servingcellconfigdedicated,
                           NR_RRCReconfiguration_IEs_t *reconfig,
                           NR_CellGroupConfig_t *secondaryCellGroup,
                           int n_physical_antenna_ports,
                           int initial_csi_index);
Raymond Knopp's avatar
Raymond Knopp committed
96

97 98 99 100
void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig,
                           int eps_bearer_id, int rb_id,
                           e_NR_CipheringAlgorithm ciphering_algorithm,
                           e_NR_SecurityConfig__keyToUse key_to_use);
Francesco Mani's avatar
Francesco Mani committed
101

Raymond Knopp's avatar
Raymond Knopp committed
102 103 104 105 106
int generate_CG_Config(gNB_RRC_INST *rrc, 
		       NR_CG_Config_t *cg_Config,
		       NR_RRCReconfiguration_t *reconfig,
		       NR_RadioBearerConfig_t *rbconfig);

107 108 109 110 111 112 113 114
void
rrc_gNB_generate_RRCSetup(
    const protocol_ctxt_t        *const ctxt_pP,
    rrc_gNB_ue_context_t         *const ue_context_pP,
    OCTET_STRING_t               *masterCellGroup_from_DU,
    NR_ServingCellConfigCommon_t *scc,
    const int                    CC_id);

115
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
Raymond Knopp's avatar
Raymond Knopp committed
116

117 118 119 120 121
void
rrc_gNB_generate_SecurityModeCommand(
  const protocol_ctxt_t *const ctxt_pP,
  rrc_gNB_ue_context_t          *const ue_context_pP
);
122

Xue Song's avatar
Xue Song committed
123 124 125 126 127
uint8_t
rrc_gNB_get_next_transaction_identifier(
    module_id_t gnb_mod_idP
);

128 129 130 131 132 133
void
rrc_gNB_generate_UECapabilityEnquiry(
  const protocol_ctxt_t *const ctxt_pP,
  rrc_gNB_ue_context_t  *const ue_context_pP
);

yaojie's avatar
yaojie committed
134 135 136 137 138
void
rrc_gNB_generate_RRCRelease(
  const protocol_ctxt_t *const ctxt_pP,
  rrc_gNB_ue_context_t  *const ue_context_pP
);
139

140 141 142
/**\brief RRC eNB task.
   \param void *args_p Pointer on arguments to start the task. */
void *rrc_gnb_task(void *args_p);
143

Cedric Roux's avatar
Cedric Roux committed
144 145
/* Trigger RRC periodic processing. To be called once per ms. */
void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe);
146

147 148
/**\ Function to set or overwrite PTRS DL RRC parameters.
   \ *bwp Pointer to dedicated RC config structure
149 150
   \ *ptrsNrb Pointer to K_ptrs N_RB related parameters
   \ *ptrsMcs Pointer to L_ptrs MCS related parameters
151 152 153
   \ *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);
154

155 156 157 158 159 160 161 162 163 164 165 166 167 168
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);
169

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
int8_t nr_mac_rrc_data_ind(
    const module_id_t     module_idP,
    const int             CC_id,
    const frame_t         frameP,
    const sub_frame_t     sub_frameP,
    const int             UE_id,
    const rnti_t          rntiP,
    const rb_id_t         srb_idP,
    const uint8_t        *sduP,
    const sdu_size_t      sdu_lenP,
    const boolean_t   brOption
);

int nr_rrc_gNB_decode_ccch(protocol_ctxt_t    *const ctxt_pP,
                           const uint8_t      *buffer,
                           int                buffer_length,
186 187
                           OCTET_STRING_t     *du_to_cu_rrc_container,
			   const int          CC_id);
188

189 190 191 192 193 194 195
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
    const protocol_ctxt_t   *const ctxt_pP,
    rrc_gNB_ue_context_t    *const ue_context_pP,
    uint8_t                  xid,
    uint32_t                 nas_length,
    uint8_t                 *nas_buffer);