enb_config.c 114 KB
Newer Older
1 2 3 4 5
/*
 * 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
Cedric Roux's avatar
Cedric Roux committed
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * 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
 */
nikaeinn's avatar
nikaeinn committed
21

gauthier's avatar
licence  
gauthier committed
22
/*
23 24
  enb_config.c
  -------------------
25
  AUTHOR  : Lionel GAUTHIER, navid nikaein, Laurent Winckel
gauthier's avatar
licence  
gauthier committed
26
  COMPANY : EURECOM
27
  EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
28
*/
29 30

#include <string.h>
31
#include <inttypes.h>
32

33
#include "common/utils/LOG/log.h"
34 35
#include "assertions.h"
#include "enb_config.h"
36 37
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
38 39 40
#include "intertask_interface.h"
#include "s1ap_eNB.h"
#include "sctp_eNB_task.h"
41
#include "sctp_default_values.h"
42
#include "LTE_SystemInformationBlockType2.h"
43 44 45
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "PHY/phy_extern.h"
knopp's avatar
knopp committed
46
#include "PHY/INIT/phy_init.h"
47
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
48 49 50
#include "nfapi_vnf.h"
#include "nfapi_pnf.h"

51 52
#include "L1_paramdef.h"
#include "MACRLC_paramdef.h"
53
#include "common/config/config_userapi.h"
54 55
#include "RRC_config_tools.h"
#include "enb_paramdef.h"
56

Louis Adrien Dufrene's avatar
Louis Adrien Dufrene committed
57
#define RRC_INACTIVITY_THRESH 0
58

59
extern uint16_t sf_ahead;
60 61
extern void set_parallel_conf(char *parallel_conf);
extern void set_worker_conf(char *worker_conf);
62 63
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t   get_thread_worker_conf(void);
64 65
extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw);
extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw);
66 67
extern char *parallel_config;
extern char *worker_config;
68

Thomas Laurent's avatar
Thomas Laurent committed
69
void RCconfig_flexran() {
70 71 72 73
  uint16_t i;
  uint16_t num_enbs;
  char aprefix[MAX_OPTNAME_SIZE*2 + 8];
  /* this will possibly truncate the cell id (RRC assumes int32_t).
Thomas Laurent's avatar
Thomas Laurent committed
74 75
     Both Nid_cell and enb_id are signed in RRC case, but we use unsigned for
     the bitshifting to work properly */
76 77 78 79 80 81 82 83 84 85 86 87
  int32_t Nid_cell = 0;
  uint16_t Nid_cell_tr = 0;
  uint32_t enb_id = 0;
  /* get number of eNBs */
  paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
  config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL);
  num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
  /* for eNB ID */
  paramdef_t ENBParams[]  = ENBPARAMS_DESC;
  paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0};
  /* for Nid_cell */
  checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
knopp's avatar
knopp committed
88
  ccparams_lte_t ccparams_lte;
89
  memset((void *)&ccparams_lte,0,sizeof(ccparams_lte_t));
knopp's avatar
knopp committed
90
  paramdef_t CCsParams[] = CCPARAMS_DESC(ccparams_lte);
91
  paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
Thomas Laurent's avatar
Thomas Laurent committed
92

93
  // Note: these should be turned on for EMTC support inside of FlexRAN
knopp's avatar
knopp committed
94 95 96
  // ccparams_emtc_t ccparams_emtc;
  //paramdef_t brParams[]              = BRPARAMS_DESC(ccparams_emtc);
  //paramdef_t schedulingInfoBrParams[] = SI_INFO_BR_DESC(ccparams_emtc);
97
  //paramlist_def_t schedulingInfoBrParamList = {ENB_CONFIG_STRING_SCHEDULING_INFO_BR, NULL, 0};
knopp's avatar
knopp committed
98
  //paramdef_t rachcelevelParams[]     = RACH_CE_LEVELINFOLIST_R13_DESC(ccparams_emtc);
99
  //paramlist_def_t rachcelevellist    = {ENB_CONFIG_STRING_RACH_CE_LEVELINFOLIST_R13, NULL, 0};
knopp's avatar
knopp committed
100
  //paramdef_t rsrprangeParams[]       = RSRP_RANGE_LIST_DESC(ccparams_emtc);
101
  //paramlist_def_t rsrprangelist      = {ENB_CONFIG_STRING_RSRP_RANGE_LIST, NULL, 0};
knopp's avatar
knopp committed
102
  //paramdef_t prachParams[]           = PRACH_PARAMS_CE_R13_DESC(ccparams_emtc);
103
  //paramlist_def_t prachParamslist    = {ENB_CONFIG_STRING_PRACH_PARAMETERS_CE_R13, NULL, 0};
knopp's avatar
knopp committed
104
  //paramdef_t n1PUCCH_ANR13Params[]   = N1PUCCH_AN_INFOLIST_R13_DESC(ccparams_emtc);
105
  //paramlist_def_t n1PUCCHInfoList    = {ENB_CONFIG_STRING_N1PUCCH_AN_INFOLIST_R13, NULL, 0};
knopp's avatar
knopp committed
106 107 108
  //paramdef_t pcchv1310Params[]       = PCCH_CONFIG_V1310_DESC(ccparams_emtc);
  //paramdef_t sib2freqhoppingParams[] = SIB2_FREQ_HOPPING_R13_DESC(ccparams_emtc);

109 110
  //  paramdef_t SRB1Params[] = SRB1PARAMS_DESC;

111 112 113 114
  /* map parameter checking array instances to parameter definition array instances */
  for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
    CCsParams[I].chkPptr = &(config_check_CCparams[I]);
  }
115

116 117
  paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
  config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
118

119
  if (!RC.flexran) {
Thomas Laurent's avatar
Thomas Laurent committed
120
    RC.flexran = calloc(num_enbs, sizeof(flexran_agent_info_t *));
121
    AssertFatal(RC.flexran,
122
                "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
Thomas Laurent's avatar
Thomas Laurent committed
123 124
                num_enbs * sizeof(flexran_agent_info_t *),
                num_enbs, sizeof(flexran_agent_info_t *));
125
  }
126

127
  for (i = 0; i < num_enbs; i++) {
128
    RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
129
    AssertFatal(RC.flexran[i],
130
                "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
131
                sizeof(flexran_agent_info_t), i + 1, num_enbs);
132
    /* if config says "yes", enable Agent, in all other cases it's like "no" */
133
    RC.flexran[i]->enabled          = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
Thomas Laurent's avatar
Thomas Laurent committed
134

135 136 137
    /* if not enabled, simply skip the rest, it is not needed anyway */
    if (!RC.flexran[i]->enabled)
      continue;
Thomas Laurent's avatar
Thomas Laurent committed
138

139 140 141 142 143
    RC.flexran[i]->interface_name   = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
    //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
    RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
    RC.flexran[i]->remote_port      = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
    RC.flexran[i]->cache_name       = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
144 145
    RC.flexran[i]->node_ctrl_state  = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
    config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t),NULL);
Thomas Laurent's avatar
Thomas Laurent committed
146

147 148 149
    /* eNB ID from configuration, as read in by RCconfig_RRC() */
    if (!ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr) {
      // Calculate a default eNB ID
150
      if (EPC_MODE_ENABLED)
Thomas Laurent's avatar
Thomas Laurent committed
151
        enb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
152
      else
Thomas Laurent's avatar
Thomas Laurent committed
153
        enb_id = i;
154
    } else {
Thomas Laurent's avatar
Thomas Laurent committed
155
      enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
156
    }
157

158 159 160
    /* cell ID */
    sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i);
    config_getlist(&CCsParamList, NULL, 0, aprefix);
Thomas Laurent's avatar
Thomas Laurent committed
161

162 163 164 165 166
    if (CCsParamList.numelt > 0) {
      sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0);
      config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
      Nid_cell_tr = (uint16_t) Nid_cell;
    }
167

168 169 170
    RC.flexran[i]->mod_id   = i;
    RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)enb_id) << 16) | ((uint64_t)Nid_cell_tr);
    /* assume for the moment the monolithic case, i.e. agent can provide
Thomas Laurent's avatar
Thomas Laurent committed
171
       information for all layers */
172
    RC.flexran[i]->capability_mask = FLEXRAN_CAP_LOPHY | FLEXRAN_CAP_HIPHY
173 174 175
                                     | FLEXRAN_CAP_LOMAC | FLEXRAN_CAP_HIMAC
                                     | FLEXRAN_CAP_RLC   | FLEXRAN_CAP_PDCP
                                     | FLEXRAN_CAP_SDAP  | FLEXRAN_CAP_RRC;
176
  }
177
}
178

179

180
void RCconfig_L1(void) {
181 182 183 184
  int               i,j;
  paramdef_t L1_Params[] = L1PARAMS_DESC;
  paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};

185
  if (RC.eNB == NULL) {
186
    RC.eNB                       = (PHY_VARS_eNB ** *)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
187
    LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
Thomas Laurent's avatar
Thomas Laurent committed
188
    memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
189 190
    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
  }
191

Cedric Roux's avatar
Cedric Roux committed
192
  config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
Thomas Laurent's avatar
Thomas Laurent committed
193

194 195 196 197 198
  if (L1_ParamList.numelt > 0) {
    for (j = 0; j < RC.nb_L1_inst; j++) {
      RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);

      if (RC.eNB[j] == NULL) {
Thomas Laurent's avatar
Thomas Laurent committed
199 200 201
        RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *));
        LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
        memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *));
202 203
      }

Thomas Laurent's avatar
Thomas Laurent committed
204
      for (i=0; i<RC.nb_L1_CC[j]; i++) {
205 206
        if (RC.eNB[j][i] == NULL) {
          RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
Thomas Laurent's avatar
Thomas Laurent committed
207
          memset((void *)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
208 209 210 211
          LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
          RC.eNB[j][i]->Mod_id  = j;
          RC.eNB[j][i]->CC_id   = i;
        }
212 213 214
      }

      if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
215
        sf_ahead = 4; // Need 4 subframe gap between RX and TX
Thomas Laurent's avatar
Thomas Laurent committed
216
      } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
217
        RC.eNB[j][0]->eth_params_n.local_if_name            = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
Thomas Laurent's avatar
Thomas Laurent committed
218 219 220 221 222 223 224
        RC.eNB[j][0]->eth_params_n.my_addr                  = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
        RC.eNB[j][0]->eth_params_n.remote_addr              = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
        RC.eNB[j][0]->eth_params_n.my_portc                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.remote_portc             = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.my_portd                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.remote_portd             = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.transp_preference        = ETH_UDP_MODE;
225 226 227 228 229 230 231 232 233
        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
        RC.nb_macrlc_inst = 1;  // This is used by mac_top_init_eNB()
        // This is used by init_eNB_afterRU()
        RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
        RC.nb_CC[0]=1;
        RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
Robert Schmidt's avatar
Robert Schmidt committed
234
        //mac_top_init_eNB();
235 236
        configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd,
                            RC.eNB[j][0]->eth_params_n     .remote_portd);
Thomas Laurent's avatar
Thomas Laurent committed
237
      } else { // other midhaul
238 239
      }
    }// j=0..num_inst
Thomas Laurent's avatar
Thomas Laurent committed
240

241
    LOG_I(ENB_APP,"Initializing northbound interface for L1\n");
242 243
    l1_north_init_eNB();
  } else {
Thomas Laurent's avatar
Thomas Laurent committed
244
    LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
245 246 247 248 249 250
    // DJP need to create some structures for VNF
    j = 0;
    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); // DJP - 1 lot then???
    RC.nb_L1_CC[j]=1; // DJP - hmmm

    if (RC.eNB[j] == NULL) {
Thomas Laurent's avatar
Thomas Laurent committed
251
      RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB **));
252
      LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
253
      memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB ** *));
254 255
    }

Thomas Laurent's avatar
Thomas Laurent committed
256
    for (i=0; i<RC.nb_L1_CC[j]; i++) {
257 258
      if (RC.eNB[j][i] == NULL) {
        RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
Thomas Laurent's avatar
Thomas Laurent committed
259
        memset((void *)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
260 261 262 263 264
        LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
        RC.eNB[j][i]->Mod_id  = j;
        RC.eNB[j][i]->CC_id   = i;
      }
    }
265 266 267 268 269 270 271
  }
}

void RCconfig_macrlc() {
  int               j;
  paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
  paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
Thomas Laurent's avatar
Thomas Laurent committed
272
  config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
273 274

  if ( MacRLC_ParamList.numelt > 0) {
Thomas Laurent's avatar
Thomas Laurent committed
275 276 277
    RC.nb_macrlc_inst=MacRLC_ParamList.numelt;
    mac_top_init_eNB();
    RC.nb_mac_CC = (int *)malloc(RC.nb_macrlc_inst*sizeof(int));
278

Thomas Laurent's avatar
Thomas Laurent committed
279
    for (j=0; j<RC.nb_macrlc_inst; j++) {
Cedric Roux's avatar
Cedric Roux committed
280 281
      RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr);
      RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr);
knopp's avatar
knopp committed
282
      RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
knopp's avatar
knopp committed
283 284
      //RC.mac[j]->phy_test = *(MacRLC_ParamList.paramarray[j][MACRLC_PHY_TEST_IDX].iptr);
      //printf("PHY_TEST = %d,%d\n", RC.mac[j]->phy_test, j);
285 286

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
287
        // check number of instances is same as RRC/PDCP
288
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
289 290 291 292 293 294 295 296
        RC.mac[j]->eth_params_n.local_if_name            = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
        RC.mac[j]->eth_params_n.my_addr                  = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_n.remote_addr              = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_n.my_portc                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_n.remote_portc             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_n.my_portd                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_n.remote_portd             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
        RC.mac[j]->eth_params_n.transp_preference        = ETH_UDP_MODE;
297
      } else { // other midhaul
Thomas Laurent's avatar
Thomas Laurent committed
298 299
        AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
      }
300 301 302

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
303 304 305 306 307 308 309 310
        RC.mac[j]->eth_params_s.local_if_name            = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
        RC.mac[j]->eth_params_s.my_addr                  = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_s.remote_addr              = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_s.my_portc                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_s.remote_portc             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_s.my_portd                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_s.remote_portd             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_s.transp_preference        = ETH_UDP_MODE;
311
        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
312
        LOG_I(ENB_APP,"**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
313
        configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
314
        LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
315
      } else { // other midhaul
Thomas Laurent's avatar
Thomas Laurent committed
316
        AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
317
      }
Thomas Laurent's avatar
Thomas Laurent committed
318 319 320

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0) {
        global_scheduler_mode=SCHED_MODE_DEFAULT;
321
        LOG_I(ENB_APP,"sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
Thomas Laurent's avatar
Thomas Laurent committed
322 323 324 325 326 327
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0) {
        global_scheduler_mode=SCHED_MODE_FAIR_RR;
        printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
      } else {
        global_scheduler_mode=SCHED_MODE_DEFAULT;
        printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
328
      }
329 330
    }// j=0..num_inst
  } else {// MacRLC_ParamList.numelt > 0
Thomas Laurent's avatar
Thomas Laurent committed
331 332
    AssertFatal (0,
                 "No " CONFIG_STRING_MACRLC_LIST " configuration found");
333 334
  }
}
oai's avatar
oai committed
335

Thomas Laurent's avatar
Thomas Laurent committed
336
int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
337 338
  int               num_enbs                      = 0;
  int               j,k                           = 0;
knopp's avatar
knopp committed
339
  int32_t           enb_id                        = 0;
340
  int               nb_cc                         = 0;
knopp's avatar
knopp committed
341 342 343
  ccparams_lte_t ccparams_lte;
  ccparams_sidelink_t SLconfig;
  ccparams_eMTC_t eMTCconfig;
344 345 346
  memset((void *)&ccparams_lte,0,sizeof(ccparams_lte_t));
  memset((void *)&SLconfig,0,sizeof(ccparams_sidelink_t));
  memset((void *)&eMTCconfig,0,sizeof(ccparams_eMTC_t));
347 348
  paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
  paramdef_t ENBParams[]  = ENBPARAMS_DESC;
Thomas Laurent's avatar
Thomas Laurent committed
349
  paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};
350
  checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
knopp's avatar
knopp committed
351
  paramdef_t CCsParams[] = CCPARAMS_DESC(ccparams_lte);
352
  paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0};
353 354
  paramdef_t eMTCParams[]              = EMTCPARAMS_DESC((&eMTCconfig));
  checkedparam_t config_check_eMTCparams[] = EMTCPARAMS_CHECK;
knopp's avatar
knopp committed
355
  srb1_params_t srb1_params;
356
  memset((void *)&srb1_params,0,sizeof(srb1_params_t));
knopp's avatar
knopp committed
357 358 359
  paramdef_t SRB1Params[] = SRB1PARAMS_DESC(srb1_params);
  paramdef_t SLParams[]              = CCPARAMS_SIDELINK_DESC(SLconfig);

Thomas Laurent's avatar
Thomas Laurent committed
360
  /* map parameter checking array instances to parameter definition array instances */
361
  for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t)  ) ; I++) {
Thomas Laurent's avatar
Thomas Laurent committed
362
    CCsParams[I].chkPptr = &(config_check_CCparams[I]);
363
  }
364

365 366 367 368
  for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
    eMTCParams[I].chkPptr = &(config_check_eMTCparams[I]);
  }

Thomas Laurent's avatar
Thomas Laurent committed
369 370
  /* get global parameters, defined outside any section in the config file */
  config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
371 372
  num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
  AssertFatal (i<num_enbs,
Thomas Laurent's avatar
Thomas Laurent committed
373
               "Failed to parse config file no %ith element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS);
374 375 376

  if (num_enbs>0) {
    // Output a list of all eNBs.
Thomas Laurent's avatar
Thomas Laurent committed
377 378 379 380 381 382 383 384
    config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL);

    if (ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr == NULL) {
      // Calculate a default eNB ID
      if (EPC_MODE_ENABLED) {
        uint32_t hash;
        hash = s1ap_generate_eNB_id ();
        enb_id = i + (hash & 0xFFFF8);
385
      } else {
Thomas Laurent's avatar
Thomas Laurent committed
386
        enb_id = i;
387
      }
Thomas Laurent's avatar
Thomas Laurent committed
388 389 390
    } else {
      enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
    }
391

392
    LOG_I(ENB_APP,"RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr));
Thomas Laurent's avatar
Thomas Laurent committed
393 394 395 396 397 398 399 400 401 402 403 404 405

    if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {
    } else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
      rrc->eth_params_s.local_if_name            = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr));
      rrc->eth_params_s.my_addr                  = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_ADDRESS_IDX].strptr));
      rrc->eth_params_s.remote_addr              = strdup(*(ENBParamList.paramarray[i][ENB_REMOTE_S_ADDRESS_IDX].strptr));
      rrc->eth_params_s.my_portc                 = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTC_IDX].uptr);
      rrc->eth_params_s.remote_portc             = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTC_IDX].uptr);
      rrc->eth_params_s.my_portd                 = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTD_IDX].uptr);
      rrc->eth_params_s.remote_portd             = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTD_IDX].uptr);
      rrc->eth_params_s.transp_preference        = ETH_UDP_MODE;
    } else { // other midhaul
    }
406

Thomas Laurent's avatar
Thomas Laurent committed
407 408 409
    // search if in active list

    for (k=0; k <num_enbs ; k++) {
410
      if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr)) == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
411
        char enbpath[MAX_OPTNAME_SIZE + 8];
Raphael Defosseux's avatar
Raphael Defosseux committed
412 413 414 415 416 417 418 419 420
        sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
        paramdef_t PLMNParams[] = PLMNPARAMS_DESC;
        paramlist_def_t PLMNParamList = {ENB_CONFIG_STRING_PLMN_LIST, NULL, 0};
        /* map parameter checking array instances to parameter definition array instances */
        checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;

        for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
          PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);

Louis Adrien Dufrene's avatar
Louis Adrien Dufrene committed
421
        RRC_CONFIGURATION_REQ (msg_p).rrc_inactivity_timer_thres = RRC_INACTIVITY_THRESH; // set to 0 to deactivate
Thomas Laurent's avatar
Thomas Laurent committed
422
        RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id;
423
        RRC_CONFIGURATION_REQ (msg_p).tac = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr;
Raphael Defosseux's avatar
Raphael Defosseux committed
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
        AssertFatal(!ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
                    && !ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
                    "It seems that you use an old configuration file. Please change the existing\n"
                    "    tracking_area_code  =  \"1\";\n"
                    "    mobile_country_code =  \"208\";\n"
                    "    mobile_network_code =  \"93\";\n"
                    "to\n"
                    "    tracking_area_code  =  1; // no string!!\n"
                    "    plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
        config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), enbpath);

        if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
          AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
                      PLMNParamList.numelt);

        RRC_CONFIGURATION_REQ(msg_p).num_plmn = PLMNParamList.numelt;

        for (int l = 0; l < PLMNParamList.numelt; ++l) {
          RRC_CONFIGURATION_REQ(msg_p).mcc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_COUNTRY_CODE_IDX].uptr;
          RRC_CONFIGURATION_REQ(msg_p).mnc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_NETWORK_CODE_IDX].uptr;
          RRC_CONFIGURATION_REQ(msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][ENB_MNC_DIGIT_LENGTH].u8ptr;
          AssertFatal(RRC_CONFIGURATION_REQ(msg_p).mnc_digit_length[l] == 3
                      || RRC_CONFIGURATION_REQ(msg_p).mnc[l] < 100,
                      "MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
                      RRC_CONFIGURATION_REQ(msg_p).mnc[l]);
        }
450

Thomas Laurent's avatar
Thomas Laurent committed
451
        // Parse optional physical parameters
Raphael Defosseux's avatar
Raphael Defosseux committed
452
        config_getlist( &CCsParamList,NULL,0,enbpath);
Thomas Laurent's avatar
Thomas Laurent committed
453 454 455 456 457 458 459 460 461 462 463
        LOG_I(RRC,"num component carriers %d \n",CCsParamList.numelt);

        if ( CCsParamList.numelt> 0) {
          char ccspath[MAX_OPTNAME_SIZE*2 + 16];

          for (j = 0; j < CCsParamList.numelt ; j++) {
            sprintf(ccspath,"%s.%s.[%i]",enbpath,ENB_CONFIG_STRING_COMPONENT_CARRIERS,j);
            LOG_I(RRC, "enb_config::RCconfig_RRC() parameter number: %d, total number of parameters: %zd, ccspath: %s \n \n", j, sizeof(CCsParams)/sizeof(paramdef_t), ccspath);
            config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath);
            //printf("Component carrier %d\n",component_carrier);
            nb_cc++;
knopp's avatar
knopp committed
464
            RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = ccparams_lte.tdd_config;
465
            AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6,
Thomas Laurent's avatar
Thomas Laurent committed
466
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
467
                         RC.config_file_name, i, ccparams_lte.tdd_config, LTE_TDD_Config__subframeAssignment_sa6);
knopp's avatar
knopp committed
468
            RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = ccparams_lte.tdd_config_s;
469
            AssertFatal (ccparams_lte.tdd_config_s <= LTE_TDD_Config__specialSubframePatterns_ssp8,
Thomas Laurent's avatar
Thomas Laurent committed
470
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
471
                         RC.config_file_name, i, ccparams_lte.tdd_config_s, LTE_TDD_Config__specialSubframePatterns_ssp8);
472

knopp's avatar
knopp committed
473
            if (!ccparams_lte.prefix_type)
Thomas Laurent's avatar
Thomas Laurent committed
474 475 476
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE);
knopp's avatar
knopp committed
477
            else if (strcmp(ccparams_lte.prefix_type, "NORMAL") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
478
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL;
knopp's avatar
knopp committed
479
            } else  if (strcmp(ccparams_lte.prefix_type, "EXTENDED") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
480 481 482 483
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n",
knopp's avatar
knopp committed
484
                           RC.config_file_name, i, ccparams_lte.prefix_type);
Thomas Laurent's avatar
Thomas Laurent committed
485
            }
486

487
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
Thomas Laurent's avatar
Thomas Laurent committed
488

knopp's avatar
knopp committed
489
            if (!ccparams_lte.pbch_repetition)
Thomas Laurent's avatar
Thomas Laurent committed
490 491 492
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION);
knopp's avatar
knopp committed
493
            else if (strcmp(ccparams_lte.pbch_repetition, "TRUE") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
494
              RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1;
knopp's avatar
knopp committed
495
            } else  if (strcmp(ccparams_lte.pbch_repetition, "FALSE") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
496 497 498 499
              RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n",
knopp's avatar
knopp committed
500
                           RC.config_file_name, i, ccparams_lte.pbch_repetition);
Thomas Laurent's avatar
Thomas Laurent committed
501
            }
502

503
#endif
knopp's avatar
knopp committed
504 505 506 507
            RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = ccparams_lte.eutra_band;
            RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) ccparams_lte.downlink_frequency;
            RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) ccparams_lte.uplink_frequency_offset;
            RRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= ccparams_lte.Nid_cell;
508

knopp's avatar
knopp committed
509
            if (ccparams_lte.Nid_cell>503) {
Thomas Laurent's avatar
Thomas Laurent committed
510 511
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n",
knopp's avatar
knopp committed
512
                           RC.config_file_name, i, ccparams_lte.Nid_cell);
Thomas Laurent's avatar
Thomas Laurent committed
513
            }
514

knopp's avatar
knopp committed
515
            RRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= ccparams_lte.N_RB_DL;
516

517 518 519 520 521 522
            if ((ccparams_lte.N_RB_DL!=6) &&
                (ccparams_lte.N_RB_DL!=15) &&
                (ccparams_lte.N_RB_DL!=25) &&
                (ccparams_lte.N_RB_DL!=50) &&
                (ccparams_lte.N_RB_DL!=75) &&
                (ccparams_lte.N_RB_DL!=100)) {
Thomas Laurent's avatar
Thomas Laurent committed
523 524
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n",
knopp's avatar
knopp committed
525
                           RC.config_file_name, i, ccparams_lte.N_RB_DL);
Thomas Laurent's avatar
Thomas Laurent committed
526
            }
527

knopp's avatar
knopp committed
528
            if (strcmp(ccparams_lte.frame_type, "FDD") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
529
              RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD;
knopp's avatar
knopp committed
530
            } else  if (strcmp(ccparams_lte.frame_type, "TDD") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
531 532 533 534
              RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n",
knopp's avatar
knopp committed
535
                           RC.config_file_name, i, ccparams_lte.frame_type);
Thomas Laurent's avatar
Thomas Laurent committed
536
            }
537

Thomas Laurent's avatar
Thomas Laurent committed
538 539 540 541 542 543 544
            if (config_check_band_frequencies(j,
                                              RRC_CONFIGURATION_REQ (msg_p).eutra_band[j],
                                              RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j],
                                              RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j],
                                              RRC_CONFIGURATION_REQ (msg_p).frame_type[j])) {
              AssertFatal(0, "error calling enb_check_band_frequencies\n");
            }
545

knopp's avatar
knopp committed
546
            if ((ccparams_lte.nb_antenna_ports <1) || (ccparams_lte.nb_antenna_ports > 2))
Thomas Laurent's avatar
Thomas Laurent committed
547 548
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n",
knopp's avatar
knopp committed
549
                           RC.config_file_name, i, ccparams_lte.nb_antenna_ports);
Thomas Laurent's avatar
Thomas Laurent committed
550

knopp's avatar
knopp committed
551
            RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = ccparams_lte.nb_antenna_ports;
552
            // Radio Resource Configuration (SIB2)
knopp's avatar
knopp committed
553
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_root =  ccparams_lte.prach_root;
Thomas Laurent's avatar
Thomas Laurent committed
554

knopp's avatar
knopp committed
555
            if ((ccparams_lte.prach_root <0) || (ccparams_lte.prach_root > 1023))
Thomas Laurent's avatar
Thomas Laurent committed
556 557
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n",
knopp's avatar
knopp committed
558
                           RC.config_file_name, i, ccparams_lte.prach_root);
559

knopp's avatar
knopp committed
560
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_config_index = ccparams_lte.prach_config_index;
561

knopp's avatar
knopp committed
562
            if ((ccparams_lte.prach_config_index <0) || (ccparams_lte.prach_config_index > 63))
Thomas Laurent's avatar
Thomas Laurent committed
563 564
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n",
knopp's avatar
knopp committed
565
                           RC.config_file_name, i, ccparams_lte.prach_config_index);
566

knopp's avatar
knopp committed
567
            if (!ccparams_lte.prach_high_speed)
Thomas Laurent's avatar
Thomas Laurent committed
568 569 570
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED);
knopp's avatar
knopp committed
571
            else if (strcmp(ccparams_lte.prach_high_speed, "ENABLE") == 0) {
572
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_high_speed = TRUE;
knopp's avatar
knopp committed
573
            } else if (strcmp(ccparams_lte.prach_high_speed, "DISABLE") == 0) {
574
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_high_speed = FALSE;
Thomas Laurent's avatar
Thomas Laurent committed
575 576 577
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n",
knopp's avatar
knopp committed
578
                           RC.config_file_name, i, ccparams_lte.prach_high_speed);
579

knopp's avatar
knopp committed
580
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_zero_correlation = ccparams_lte.prach_zero_correlation;
581

582 583
            if ((ccparams_lte.prach_zero_correlation <0) ||
                (ccparams_lte.prach_zero_correlation > 15))
Thomas Laurent's avatar
Thomas Laurent committed
584 585
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n",
knopp's avatar
knopp committed
586
                           RC.config_file_name, i, ccparams_lte.prach_zero_correlation);
587

knopp's avatar
knopp committed
588
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_freq_offset = ccparams_lte.prach_freq_offset;
589

590 591
            if ((ccparams_lte.prach_freq_offset <0) ||
                (ccparams_lte.prach_freq_offset > 94))
Thomas Laurent's avatar
Thomas Laurent committed
592 593
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n",
knopp's avatar
knopp committed
594
                           RC.config_file_name, i, ccparams_lte.prach_freq_offset);
595

knopp's avatar
knopp committed
596
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_delta_shift = ccparams_lte.pucch_delta_shift-1;
597

598 599
            if ((ccparams_lte.pucch_delta_shift <1) ||
                (ccparams_lte.pucch_delta_shift > 3))
Thomas Laurent's avatar
Thomas Laurent committed
600 601
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n",
knopp's avatar
knopp committed
602
                           RC.config_file_name, i, ccparams_lte.pucch_delta_shift);
603

knopp's avatar
knopp committed
604
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_nRB_CQI = ccparams_lte.pucch_nRB_CQI;
605

606 607
            if ((ccparams_lte.pucch_nRB_CQI <0) ||
                (ccparams_lte.pucch_nRB_CQI > 98))
Thomas Laurent's avatar
Thomas Laurent committed
608 609
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n",
knopp's avatar
knopp committed
610
                           RC.config_file_name, i, ccparams_lte.pucch_nRB_CQI);
611

knopp's avatar
knopp committed
612
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_nCS_AN = ccparams_lte.pucch_nCS_AN;
613

614 615
            if ((ccparams_lte.pucch_nCS_AN <0) ||
                (ccparams_lte.pucch_nCS_AN > 7))
Thomas Laurent's avatar
Thomas Laurent committed
616 617
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n",
knopp's avatar
knopp committed
618
                           RC.config_file_name, i, ccparams_lte.pucch_nCS_AN);
Thomas Laurent's avatar
Thomas Laurent committed
619

620
            //#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0))
knopp's avatar
knopp committed
621
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_n1_AN = ccparams_lte.pucch_n1_AN;
622

623 624
            if ((ccparams_lte.pucch_n1_AN <0) ||
                (ccparams_lte.pucch_n1_AN > 2047))
Thomas Laurent's avatar
Thomas Laurent committed
625 626
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n",
knopp's avatar
knopp committed
627
                           RC.config_file_name, i, ccparams_lte.pucch_n1_AN);
628

Thomas Laurent's avatar
Thomas Laurent committed
629
            //#endif
knopp's avatar
knopp committed
630
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pdsch_referenceSignalPower = ccparams_lte.pdsch_referenceSignalPower;
631

632 633
            if ((ccparams_lte.pdsch_referenceSignalPower <-60) ||
                (ccparams_lte.pdsch_referenceSignalPower > 50))
Thomas Laurent's avatar
Thomas Laurent committed
634 635
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n",
knopp's avatar
knopp committed
636
                           RC.config_file_name, i, ccparams_lte.pdsch_referenceSignalPower);
637

knopp's avatar
knopp committed
638
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pdsch_p_b = ccparams_lte.pdsch_p_b;
639

640 641
            if ((ccparams_lte.pdsch_p_b <0) ||
                (ccparams_lte.pdsch_p_b > 3))
Thomas Laurent's avatar
Thomas Laurent committed
642 643
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n",
knopp's avatar
knopp committed
644
                           RC.config_file_name, i, ccparams_lte.pdsch_p_b);
645

knopp's avatar
knopp committed
646
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_n_SB = ccparams_lte.pusch_n_SB;
647

648 649
            if ((ccparams_lte.pusch_n_SB <1) ||
                (ccparams_lte.pusch_n_SB > 4))
Thomas Laurent's avatar
Thomas Laurent committed
650 651
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n",
knopp's avatar
knopp committed
652
                           RC.config_file_name, i, ccparams_lte.pusch_n_SB);
653

knopp's avatar
knopp committed
654
            if (!ccparams_lte.pusch_hoppingMode)
Thomas Laurent's avatar
Thomas Laurent committed
655 656 657
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE);
knopp's avatar
knopp committed
658
            else if (strcmp(ccparams_lte.pusch_hoppingMode,"interSubFrame")==0) {
659
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingMode = LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame;
660
            } else if (strcmp(ccparams_lte.pusch_hoppingMode,"intraAndInterSubFrame")==0) {
661
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingMode = LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame;
Thomas Laurent's avatar
Thomas Laurent committed
662 663 664
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n",
knopp's avatar
knopp committed
665
                           RC.config_file_name, i, ccparams_lte.pusch_hoppingMode);
666

knopp's avatar
knopp committed
667
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingOffset = ccparams_lte.pusch_hoppingOffset;
668

669 670
            if ((ccparams_lte.pusch_hoppingOffset<0) ||
                (ccparams_lte.pusch_hoppingOffset>98))
Thomas Laurent's avatar
Thomas Laurent committed
671 672
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n",
knopp's avatar
knopp committed
673
                           RC.config_file_name, i, ccparams_lte.pusch_hoppingMode);
674

knopp's avatar
knopp committed
675
            if (!ccparams_lte.pusch_enable64QAM)
Thomas Laurent's avatar
Thomas Laurent committed
676 677 678
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM);
knopp's avatar
knopp committed
679
            else if (strcmp(ccparams_lte.pusch_enable64QAM, "ENABLE") == 0) {
680
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_enable64QAM = TRUE;
681
            } else if (strcmp(ccparams_lte.pusch_enable64QAM, "DISABLE") == 0) {
682
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_enable64QAM = FALSE;
683
            } else
Thomas Laurent's avatar
Thomas Laurent committed
684 685
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n",
knopp's avatar
knopp committed
686
                           RC.config_file_name, i, ccparams_lte.pusch_enable64QAM);
687

knopp's avatar
knopp committed
688
            if (!ccparams_lte.pusch_groupHoppingEnabled)
Thomas Laurent's avatar
Thomas Laurent committed
689 690 691
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN);
knopp's avatar
knopp committed
692
            else if (strcmp(ccparams_lte.pusch_groupHoppingEnabled, "ENABLE") == 0) {
693
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupHoppingEnabled = TRUE;
694
            } else if (strcmp(ccparams_lte.pusch_groupHoppingEnabled, "DISABLE") == 0) {
695
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupHoppingEnabled= FALSE;
696
            } else
Thomas Laurent's avatar
Thomas Laurent committed
697 698
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n",
knopp's avatar
knopp committed
699
                           RC.config_file_name, i, ccparams_lte.pusch_groupHoppingEnabled);
700

knopp's avatar
knopp committed
701
            RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupAssignment = ccparams_lte.pusch_groupAssignment;
oai's avatar
oai committed
702

knopp's avatar
knopp committed
703
            if ((ccparams_lte.pusch_groupAssignment<0)||
704
                (ccparams_lte.pusch_groupAssignment>29))
Thomas Laurent's avatar
Thomas Laurent committed
705 706
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n",
knopp's avatar
knopp committed
707
                           RC.config_file_name, i, ccparams_lte.pusch_groupAssignment);
708

knopp's avatar
knopp committed
709
            if (!ccparams_lte.pusch_sequenceHoppingEnabled)
Thomas Laurent's avatar
Thomas Laurent committed
710 711 712
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN);
knopp's avatar
knopp committed
713
            else if (strcmp(ccparams_lte.pusch_sequenceHoppingEnabled, "ENABLE") == 0) {
714
              RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_sequenceHoppingEnabled = TRUE;
715
            } else if (strcmp(ccparams_lte.pusch_sequenceHoppingEnabled, "DISABLE") == 0) {
knopp's avatar