Configured cell list changes
[o-du/l2.git] / src / du_app / du_cfg.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 #ifndef __DU_CONFIG_H_
20 #define __DU_CONFIG_H__
21
22 #include "stdbool.h"
23 #include "du_app_mac_inf.h"
24 #include "du_log.h"
25 #include "BIT_STRING.h"
26
27 /* MACROS */
28 #define DU_INST 0
29 #define DU_ID 1
30 #define DU_IP_V4_ADDR "10.0.2.20"
31 #define CU_IP_V4_ADDR "10.0.2.25"
32 #define RIC_IP_V4_ADDR "10.0.2.30"
33 #define DU_PORT 38472
34 #define CU_PORT 38472
35 #define RIC_PORT 38482
36 #define DU_EGTP_PORT  39001
37 #define CU_EGTP_PORT  39002
38 #define NR_PCI 1
39 #define NR_CELL_ID 1
40 #define DU_NAME "ORAN_OAM_DU"
41 #define CELL_TYPE SMALL
42 #define DUPLEX_MODE DUP_MODE_TDD
43 #define DU_TAC 1
44 #define PLMN_MCC0 3
45 #define PLMN_MCC1 1
46 #define PLMN_MCC2 1
47 #define PLMN_MNC0 4
48 #define PLMN_MNC1 8
49 #define PLMN_MNC2 0
50 #define NR_ARFCN  2079427
51 #define SUL_ARFCN 100
52 #define NR_FREQ_BAND 257
53 #define SUL_BAND 2
54 #define TIME_CFG 0
55 #define CARRIER_IDX 1
56 #define NUM_TX_ANT 2
57 #define NUM_RX_ANT 2
58 #define FREQ_SHIFT_7P5KHZ FALSE
59 #define SSB_PBCH_PWR 0
60 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
61 #define SUBCARRIER_SPACING 3
62 #define PRB_OFFSET 0
63 #define BETA_PSS BETA_PSS_0DB
64 #define SSB_PERIODICITTY SSB_PRDCTY_MS_20
65 #define SSB_SUBCARRIER_OFFSET 0
66 #define SSB_MULT_CARRIER_BAND FALSE
67 #define MULT_CELL_CARRIER FALSE
68
69 #define PRACH_SEQ_LEN SHORT_SEQUENCE
70 #define PRACH_SUBCARRIER_SPACING 3
71 #define PRACH_RESTRICTED_SET_CFG UNRESTRICTED
72 #define NUM_PRACH_FDM 1
73 #define ROOT_SEQ_IDX 0
74 #define NUM_ROOT_SEQ 1
75 #define ZERO_CORRELATION_ZONE_CFG 2
76 #define NUM_UNUSED_ROOT_SEQ 1
77 #define UNUSED_ROOT_SEQ 1
78 #define SSB_PER_RACH 3
79 #define PRACH_MULT_CARRIER_BAND FALSE
80 #define TDD_PERIODICITY TX_PRDCTY_MS_2P5
81 #define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
82
83 #define DU_PROC  0
84 #define DU_INST 0
85 #define DU_POOL  1
86 #define MAX_DU_PORT 2
87 #define F1_INTERFACE 0
88 #define E2_INTERFACE 1
89
90 #define SCTP_INST 0
91 #define EGTP_INST 0
92
93 /* Events */
94 #define EVTCFG 0
95
96 /* Selector */
97 #define DU_SELECTOR_LC   0
98 #define DU_SELECTOR_TC   1
99 #define DU_SELECTOR_LWLC 2
100
101 #ifdef EGTP_TEST
102 /* Macro definitions for EGTP procedures */
103 #define EGTP_LCL_TEID 1     /* EGTP local tunnel id */
104 #define EGTP_REM_TEID 10    /* EGTP remote tinnel id */
105 #endif
106
107
108 /* Macro definitions for F1 procedures */
109 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
110 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
111 #define DU_MAX_CELLS       1      /* Max num of cells served by gNB-DU */
112 #define MAX_PLMN           6        /* Max num of broadcast PLMN ids */
113 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
114 #define MAXNRCELLBANDS     2       /* Maximum number of frequency bands */
115 #define MAX_NUM_OF_SLICE_ITEMS 1024     /* Maximum number of signalled slice support items */
116 #define MAXBPLMNNRMINUS1   1       /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */
117 #define MAXNUMOFSIBTYPES   32       /* Maximum number of SIB types */
118 #define MAX_UEID           512      /* Maximum number of UE Ids */
119 #define MAX_TNL_ASSOC      32       /* Max num of TNL Assoc between CU and DU */
120 #define MAXCELLINENB       256      /* Max num of cells served by eNB */
121 #define MAX_NUM_OF_UE_ID       65536    /* Max num of UEs served by DU */
122 #define MAXNUMOFUACPLMN    12       /* Maximum number of PLMN ids*/
123 #define MAXNUMOFUACPERPLMN 64       /* Maximum number of signalled categories per PLMN */
124 #define NR_RANAC           150      /* RANAC */
125 #define DEFAULT_CELLS      1        /* Max num of broadcast PLMN ids */
126
127
128 /* Macro definitions for MIB/SIB1 */
129 #define SYS_FRAME_NUM 0
130 #define SPARE 0
131 #define SSB_SC_OFFSET 8
132 #define CORESET_ZERO 1
133 #define SEARCH_SPACE_ZERO 8
134 #define DU_RANAC 1
135 #define CELL_IDENTITY 32
136
137 #ifdef EGTP_TEST
138 #define UE_ID 1
139 #define RB_ID 1
140 #define LC_ID 1
141 #endif
142
143 typedef enum
144 {
145    GNBDU,
146    GNBCU 
147 }F1Entity;
148
149 typedef enum
150 {
151    UNSPECIFIED,
152    RL_FAILURE_RLC,
153    INVALID_CU_UE_F1AP_ID,
154    INVALID_DU_UE_F1AP_ID,
155    INTERACTION_WITH_OTHER_PROC,
156    INVALID_QCI_VALUE,
157    RADIO_RELATED_REASON,
158    INSUFFICIENT_RADIO_RESOURCE,
159    PROCEDURE_CANCELLED,
160    NORMAL_RELEASE,
161    UNAVAILABLE_CELL,
162    RL_FAILURE_OTHERS,
163    UE_ACCESS_REJECTED,
164    SLICE_RESOURCE_UNAVAILABLE,
165    AMF_ABNORMAL_RELEASE,
166    INVALID_PLMN
167 }RadioNwCause;
168
169 typedef enum
170 {
171    TRANS_CAUSE_UNSPECIFIED,
172    TRANSPORT_RESOURCE_UNAVAIL
173 }TransLayerCause;
174
175 typedef enum
176 {
177    TRANSFER_SYNTAX_ERR,
178    ABSTRACT_SYNTAX_ERR_REJECT,
179    ABSTRACT_SYNTAX_ERR_NOTIFY,
180    INCOMPATIBLE_MESSAGE,
181    SEMANTIC_ERROR,
182    ABSTRACT_SYNTAX_ERR_MSG_CONSTRUCT,
183    PROTOCOL_CAUSE_UNSPECIFIED
184 }ProtocolCause;
185
186 typedef enum
187 {
188    CONTROL_PROC_OVERLOAD,
189    INSUFF_USER_PLANE_RESOURCE,
190    HARDWARE_FAILURE,
191    O_AND_M_INTERVENTION,
192    MISC_CAUSE_UNSPECIFIED
193 }MiscCause;
194
195 typedef enum
196 {
197   ALL
198 }F1ResetAll;
199
200 typedef enum 
201 {
202   IN_SERVICE,
203   OUT_OF_SERVICE
204 }SrvState;
205
206 typedef enum
207 {
208    INITIATING_MSG,
209    SUCCESSFUL_OUTCOME,
210    UNSUCCESSFUL_OUTCOME
211 }F1TriggMsgVal;
212
213 typedef enum
214 {
215    CRIT_REJECT,
216    CRIT_IGNORE,
217    CRIT_NOTIFY
218 }F1ProcCritVal;
219
220 typedef enum
221 {
222    NOT_UNDERSTOOD,
223    MISSING_IE
224 }F1ErrorType;
225
226 typedef enum
227 {
228    SCS_15,
229    SCS_30,
230    SCS_60,
231    SCS_120
232 }F1NrScs;
233
234 typedef enum
235 {
236    NRB_11,
237    NRB_18,
238    NRB_24,
239    NRB_25,
240    NRB_31,
241    NRB_32,
242    NRB_38,
243    NRB_51,
244    NRB_52,
245    NRB_65,
246    NRB_66,
247    NRB_78,
248    NRB_79,
249    NRB_93,
250    NRB_106,
251    NRB_107,
252    NRB_121,
253    NRB_132,
254    NRB_133,
255    NRB_135,
256    NRB_160,
257    NRB_162,
258    NRB_189,
259    NRB_216,
260    NRB_217,
261    NRB_245,
262    NRB_264,
263    NRB_270,
264    NRB_273
265 }F1Nrb;
266
267 typedef enum
268 {
269    VERY_SMALL,
270    SMALL,
271    MEDIUM,
272    LARGE
273 }F1CellType;
274
275 typedef enum
276 {
277    DL,
278    UL,
279    DL_UL
280 }F1CellDir;
281
282 typedef enum
283 {
284    UE_USAGE,
285    NON_UE_USAGE,
286    BOTH
287 }F1AssocUsage;
288
289 typedef enum
290 {
291    BARRED,
292    NOT_BARRED
293 }CellBarred;
294
295 typedef enum
296 {
297    OFFER,
298    EXECUTION
299 }F1ReqType;
300
301 typedef enum
302 {
303    IGNORE_YES,
304    IGNORE_NO
305 }F1IgnoreReq;
306
307 typedef enum
308 {
309    OVERLOADED,
310    NOT_OVERLOADED
311 }F1GnbDuOvrloadInfo;
312
313 typedef enum
314 {
315    REJECT_RRC_CONN_NON_EMERG_MODT,
316    REJECT_RRC_CONN_SIGNALLING,
317    PERMIT_EMERG_SESSION_AND_MOBILE_TERM_SERVICE,
318    PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE
319 }F1UacStandardAction;
320
321 typedef struct f1RrcVersion
322 {
323    char    rrcVer[30];     /* Latest RRC Version */
324    uint32_t   extRrcVer;  /* Latest RRC version extended */
325 }F1RrcVersion;
326
327 typedef struct f1FailCause
328 {
329    union
330    {
331       RadioNwCause      radioNwCause;     /* Radio Network Layer Cause */
332       TransLayerCause   transLayerCause;  /* Transport Layer Cause */
333       ProtocolCause     protCause;        /* Protocol Cause */
334       MiscCause         miscCause;        /* Miscellaneous Cause */
335    }cause;
336 }F1FailCause;
337
338 typedef struct f1ProcCode
339 {
340    bool   pres;
341    uint8_t     value;
342 }F1ProcCode;
343
344 typedef struct f1TriggMsg
345 {
346    bool   pres;
347    F1TriggMsgVal   value;
348 }F1TriggMsg;
349
350 typedef struct f1ProcCrit
351 {
352    bool   pres;
353    F1ProcCritVal   value;
354 }F1ProcCrit;
355
356 typedef struct f1CritDignosIE
357 {
358    F1ProcCritVal   ieCritVal;
359    uint16_t             ieId;
360    F1ErrorType       type;
361 }F1CritDignosIE;
362
363 typedef struct f1CritDiagnostic
364 {
365    bool         pres;
366    F1ProcCode   procCode;      /* Procedure Code */
367    F1TriggMsg   triggeringMsg; /* Triggering Message */
368    F1ProcCrit   procCrit;      /* Criticality of Triggering msg/proc */
369    uint32_t          transId;
370    F1CritDignosIE diagnosIE;
371 }F1CritDiagnostic;
372
373 typedef struct f1FailureIE
374 {
375    uint32_t                transId;        /* Uniquely identify transaction */
376    F1FailCause        cause;          /* Failure cause */
377    uint8_t                 timeToWait;     /* Seconds to be waited before retry */
378    F1CritDiagnostic   critDiagnostic; /* Critical diagnostics */
379 }F1FailureIE;
380
381 typedef struct f1LogicalConnUeAssoc
382 {
383    uint32_t   gnbCuUeF1apId;
384    uint32_t   gnbDuUeF1apId;
385 }F1LogicalConnUeAssoc;
386
387 typedef struct f1ResetType
388 {
389    union
390    {
391       F1ResetAll             resetAll; /* Reset All */
392       F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* In case of Partial Reset : UE associated logical F1 conn list*/
393    }type;
394 }F1ResetType;
395
396 typedef struct f1PLMN
397 {
398   uint8_t mcc[3];
399   uint8_t mnc[3];
400 }PlmnId;
401
402 typedef struct nrEcgi
403 {
404   PlmnId  plmn;
405   uint16_t     cellId;
406 }NrEcgi;
407
408 typedef struct f1SibType
409 {
410    uint8_t   sibType;
411    uint8_t   sibMsg;
412    uint8_t   value;
413 }F1SibType;
414
415 typedef struct f1TxBw
416 {
417    F1NrScs   nrScs; /* NR subcarrier spacing */
418    F1Nrb     nrb;   /* Transmission bandwidth expressed in units of RBs */
419 }F1TxBw;
420
421 typedef struct f1SulInfo
422 {
423    uint32_t      sulArfcn; /* SUL ARFCN */
424    F1TxBw   sulTxBw;  /* SUL transmission bandwidth */ 
425 }F1SulInfo;
426
427 typedef struct f1FreqBand
428 {
429   uint16_t   nrFreqBand;
430   uint16_t   sulBand[MAXNRCELLBANDS];
431 }F1FreqBand;
432
433 typedef struct f1NrFreqInfo
434 {
435    uint32_t        nrArfcn;
436    F1SulInfo  sulInfo;
437    F1FreqBand freqBand[MAXNRCELLBANDS];
438 }F1NrFreqInfo;
439
440 typedef struct f1NrFddInfo
441 {
442    F1NrFreqInfo   ulNrFreqInfo;  /* UL NR Frequency Info */
443    F1NrFreqInfo   dlNrFreqInfo;  /* DL NR Frequency Info */
444    F1TxBw         ulTxBw;        /* UL Transmission bandwidth */
445    F1TxBw         dlTxBw;        /* DL Transmission bandwidth */
446 }F1NrFddInfo;
447
448 typedef struct f1NrTddInfo
449 {
450    F1NrFreqInfo   nrFreqInfo;   /* NR Frequency Info */
451    F1TxBw       nrTxBw;       /* NR Transmission Bandwidth */
452 }F1NrTddInfo;
453
454 typedef struct f1NrModeInfo
455 {
456    union
457    {
458       F1NrFddInfo  fdd;
459       F1NrTddInfo  tdd;
460    }mode;
461 }NrModeInfo;
462
463 typedef struct f1EutraFddInfo
464 {
465    uint16_t   ulOffset;   /* UL offset to Point A */
466    uint16_t   dlOffset;   /* DL offset to Point A */
467 }F1EutraFDDInfo;
468
469 typedef struct f1EutraTddInfo
470 {
471    uint16_t   tddOffset;  /* Offset to Point A */
472 }F1EutraTDDInfo;
473
474 typedef struct f1EutraModeInfo
475 {
476    union
477    {
478       F1EutraFDDInfo  fdd;
479       F1EutraTDDInfo  tdd;
480    }mode;
481 }F1EutraModeInfo;
482
483 typedef struct f1Snsaai
484 {
485    uint8_t   sst;
486    uint32_t  sd;
487 }F1Snsaai;
488
489 typedef struct epIpAddr
490 {
491    char transportAddr[20]; /* Transport Layer Address */
492 }EpIpAddr;
493
494 typedef struct epIpAddrPort
495 {
496     EpIpAddr epIpAddr;
497     char   port[2];
498 }EpIpAddrPort;
499
500 typedef struct f1TaiSliceSuppLst
501 {
502    bool       pres;
503    F1Snsaai   snssai[MAX_NUM_OF_SLICE_ITEMS];   
504 }F1TaiSliceSuppLst;
505
506 typedef struct f1SrvdPlmn
507 {
508    PlmnId              plmn;
509    F1TaiSliceSuppLst   taiSliceSuppLst;
510 }F1SrvdPlmn;
511
512 typedef struct f1BrdcstPlmnInfo
513 {
514    PlmnId   plmn[MAX_PLMN];     /* PLMN id list */
515    PlmnId   extPlmn[MAX_PLMN];   /* Extended PLMN id list */
516    uint16_t      tac;                     /* 5GS-TAC */
517    uint32_t      nrCellId;                /* NR Cell id */
518    uint8_t       ranac;                   /* RAN Area code */
519 }F1BrdcstPlmnInfo;
520
521 typedef struct f1CellInfo
522 {
523    NrEcgi   nrCgi;                   /* Cell global Identity */
524    uint32_t      nrPci;                   /* Physical Cell Identity */
525    PlmnId   plmn[MAX_PLMN];     /* Available PLMN list */
526    PlmnId   extPlmn[MAX_PLMN];  /* Extended available PLMN list */
527 }F1CellInfo;
528
529 typedef struct f1DuCellInfo
530 {
531    F1CellInfo         cellInfo;     /* cell info */
532    uint16_t                tac;          /* tracking area code */
533    uint16_t                epsTac;       /* Configured EPS TAC */
534    NrModeInfo         f1Mode;       /* NR mode info : FDD/TDD */
535    uint8_t                 measTimeCfg;  /* Measurement timing configuration */
536    F1CellDir          cellDir;      /* Cell Direction */
537    F1CellType         cellType;     /* Cell Type */
538    F1BrdcstPlmnInfo   brdcstPlmnInfo[MAXBPLMNNRMINUS1]; /* Broadcast PLMN Identity Info List */
539 }F1DuCellInfo;
540
541 typedef struct f1DuSysInfo
542 {
543    uint8_t   *mibMsg;   /* MIB message */
544    uint8_t   *sib1Msg;  /* SIB1 message */
545 }F1DuSysInfo;
546
547 typedef struct f1CuSysInfo
548 {
549    F1SibType   sibTypeToUpd[MAXNUMOFSIBTYPES];   /* SIB types to be updated */
550 }F1CuSysInfo;
551
552 typedef struct f1DuSrvdCellInfo
553 {
554    F1DuCellInfo   duCellInfo;   /* gNB-DU served cell info */
555    F1DuSysInfo    duSysInfo;    /* gNB-DU System Information */
556 }F1DuSrvdCellInfo;
557
558 typedef struct f1DuSrvdCellToDel
559 {
560    NrEcgi             oldNrCgi;     /* Old NR CGI */
561    F1DuSrvdCellInfo   srvdCellInfo; /* Info of served cell to be deleted */ 
562 }F1DuSrvdCellToDel;
563
564 typedef struct f1CuActCellInfo
565 {
566    F1CellInfo    cuCellInfo;   /* gNB-CU available cell info */
567    F1CuSysInfo   cuSysInfo;    /* gNB-CU System Information */
568 }F1CuActCellInfo;
569
570 typedef struct f1ActCellFail
571 {
572    NrEcgi        nrCgi;
573    F1FailCause   cause;
574 }F1ActCellFail;
575
576 typedef struct srvStatus
577 {
578   SrvState    state;
579   bool        switchOffOngoing;
580 }SrvStatus;
581
582 typedef struct f1CellStatus
583 {
584    NrEcgi      nrEcgi;
585    SrvStatus   status;   /* Service status */
586 }F1CellStatus;
587
588 typedef struct f1DedSIDelUE
589 {
590    uint32_t      gnbCuUeF1apId;
591    NrEcgi   nrEcgi;
592 }F1DedSIDelUE;
593
594 typedef struct tnlAssocInfo
595 {
596    bool           pres;
597    EpIpAddr       epIpAddr;      /* Endpoint-IP Address */
598    EpIpAddrPort   epIpAddrport;  /* Endpoint-IP Address and Port */
599 }F1TnlAssocAddr;
600
601 typedef struct f1TnlAssocUsage
602 {
603     bool           pres;
604     F1AssocUsage   usage;
605 }F1TnlAssocUsage;
606
607 typedef struct f1TnlAssoc
608 {
609    F1TnlAssocAddr   assocInfo;    /* TNL Assoc Transport Layer Info */
610    F1TnlAssocUsage  assocUsage;   /* TNL Assoc usage */
611 }F1TnlAssoc;
612
613 typedef struct f1TnlAssocToRmv
614 {
615    F1TnlAssocAddr   assocInfoCu;   /* TNL Assoc Transport Layer Info of CU */
616    F1TnlAssocAddr   assocInfoDu;   /* TNL Assoc Transport Layer Info of DU */
617 }F1TnlAssocToRmv;
618
619 typedef struct f1TnlAssocSetupFail
620 {
621    F1TnlAssocAddr   assocInfo;
622    F1FailCause      cause;
623 }F1TnlAssocSetupFail;
624
625
626 typedef struct f1CellBarred
627 {
628    NrEcgi       nrcgi;
629    CellBarred   cellBarred;
630 }F1CellBarred;
631
632 typedef struct f1EutraCell
633 {
634    uint32_t                eutraCellId; /* EUTRA cell id */
635    F1EutraModeInfo    mode;        /* EUTRA mode info : FDD/TDD */
636    uint8_t                 rsrcInd;     /* Protected EUTRA resource Indication */
637 }F1EutraCell;
638
639 typedef struct f1ProtectEUTRARsrc
640 {
641    uint32_t           specShareGrpId;               /* Spectrum sharing group id */
642    F1EutraCell   eutraCellList[MAXCELLINENB];  /* EUTRA cells list */
643 }F1ProtectEUTRARsrc;
644
645 typedef struct f1UacOperatorDefined
646 {
647    uint8_t   accessCategory;
648    uint8_t   accessId; 
649 }F1UacOperatorDefined;
650
651 typedef struct f1UacCategoryType
652 {
653    union
654    {
655       F1UacStandardAction    action;      /* UAC standardized action */
656       F1UacOperatorDefined   operatorDef; /* UAC operator defined */
657    }type;
658 }F1UacCategoryType;
659
660 typedef struct f1UacType
661 {
662    uint8_t                  uacReducInd;     /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */
663    F1UacCategoryType   uacCategoryType; /* UAC Category type */
664 }F1UacType;
665
666 /* Unified Access Class Assistance Information */
667 typedef struct f1UacAssistInfo
668 {
669    PlmnId      plmn[MAXNUMOFUACPLMN];        /* UAC PLMN list */
670    F1UacType   uacType[MAXNUMOFUACPERPLMN];  /* UAC Type list */
671 }F1UacAssistInfo;
672
673 /* F1 setup related structures */
674
675 typedef struct f1SetupReq
676 {
677   uint32_t                transId;                       /* Uniquely identify transaction */
678   uint32_t                duId;                          /* DU ID */ 
679   char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
680   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
681   F1RrcVersion       rrcVersion;                    /* RRC version */
682 }F1SetupReq;
683
684 typedef struct f1setupRsp
685 {
686   uint32_t               transId;                      /* Uniquely identify transaction */
687   char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
688   F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
689   F1RrcVersion      rrcVersion;                   /* RRC version */
690 }F1SetupRsp;
691
692 typedef struct f1SetupFail
693 {
694    F1FailureIE   setupFail;
695 }F1SetupFail;
696
697 /* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 
698  * and radio resources related to the UE association(s) indicated explicitly or implicitly in 
699  * the RESET message and remove the indicated UE contexts including F1AP ID. */
700 typedef struct f1Reset
701 {
702   uint32_t              transId;   /* Uniquely identify transaction */
703   F1FailCause      cause;     /* Failure cause */
704   F1ResetType      resetType; /* type of reset */
705 }F1Reset;
706
707 /* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated
708  * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface,
709  *  the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */
710 typedef struct f1ResetAck
711 {
712   uint32_t                    transId;         /* Uniquely identify transaction */
713   F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
714   F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
715 }F1ResetAck;
716
717 typedef struct f1ErrorInd
718 {
719   uint32_t                transId;         /* Uniquely identify transaction */
720   F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
721   F1FailCause        cause;           /* Failure cause */
722 /* If failure is due to Ue related message. */
723   uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
724   uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
725   F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
726 }F1ErrorInd;
727
728 typedef struct f1GnbDuCfgUpd
729 {
730   uint32_t                 transId;                             /* Uniquely identify transaction */
731   F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
732   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
733   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
734   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
735   F1DedSIDelUE        ueLst[MAX_UEID];                     /* Ue list that requires dedicated SI delivery */
736   uint32_t            gnbDuId;
737   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
738 }F1GnbDuCfgUpd;
739
740 typedef struct f1GnbDuCfgUpdAck
741 {
742    uint32_t           transId;                      /* Uniquely identify transaction */
743    F1CuActCellInfo    cellLstAct[DU_MAX_CELLS];    /* List of cells to be activated */   
744    F1CritDiagnostic   critDiagnostic;               /* Critical diagnostics */
745    NrEcgi             cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */
746 }F1GnbDuCfgUpdAck;
747
748 typedef struct f1GnbDuCfgUpdFail
749 {
750    F1FailureIE   gnbDuCfgUpdFail;
751 }F1GnbDuCfgUpdFail;
752
753 /* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */
754 typedef struct f1GnbCuCfgUpd
755 {
756     uint32_t            transId;                            /* Uniquely identifies transaction */
757     F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
758     NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
759     F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
760     F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
761     F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
762     F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
763     F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
764 }F1GnbCuCfgUpd;
765
766 /* Sent by a gNB-DU to a gNB-CU to acknowledge update of information
767  * associated to an F1-C interface instance */
768 typedef struct f1GnbCuCfgUpdAck
769 {
770     uint32_t              transId;                              /* Uniquely identify transaction */
771     F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
772     F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
773     F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
774     F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
775     F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
776 }F1GnbCuCfgUpdAck;
777
778 typedef struct f1GnbCuCfgUpdFail
779 {
780     F1FailureIE   gnbCuCfgUpdFail;
781 }F1GnbCuCfgUpdFail;
782
783 /* This procedure enables coordination of radio resource allocation between a gNB-CU and
784  * a gNB-DU. Coordination request is sent by CU to DU */
785 typedef struct f1GnbDuRsrcCoordReq
786 {
787    uint32_t      transId;              /* Uniquely identifies transaction */
788    F1ReqType     reqType;              /* Request type */
789    uint8_t       cellResCoordReqCont;  /* Container for X2AP E-UTRA - NR cell resource coordination request */
790    F1IgnoreReq   ignoreReq;            /* Ignore coordination request */
791 }F1GnbDuRsrcCoordReq;
792
793 /* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation
794  * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */
795 typedef struct f1GnbDuRsrcCoordRsp
796 {
797     uint32_t   transId;               /* Uniquely identifies transaction */
798     uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
799 }F1GnbDuRsrcCoordRsp;
800
801 /* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */
802 typedef struct f1GnbDuStatusInd
803 {
804    uint32_t                  transId;      /* Uniquely identifies transaction */
805    F1GnbDuOvrloadInfo   ovrloadInfo;  /* gNB-DU overloaded information */
806 }F1GnbDuStatusInd;
807
808 /* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal
809  * of the interface instance and the related resources */
810 typedef struct f1RmvReq
811 {
812    uint32_t   transId; /* Uniquely identifies transaction */
813 }F1RmvReq;
814
815 /* This message acknowledges the initiation of removal of the interface
816  * instance and the related resources */
817 typedef struct f1RmvRsp
818 {
819    uint32_t           transId;     /* Uniquely identifies transaction */
820    F1CritDiagnostic   critDiagnos; /* Crititcality diagnostics */
821 }F1RmvRsp;
822
823 /* This message indicates that removing the interface instance and the related
824  * resources cannot be accepted */
825 typedef struct f1RmvFail
826 {
827    uint32_t           transId;         /* Uniquely identifies transaction */
828    F1FailCause        cause;          /* Failure cause */
829    F1CritDiagnostic   critDiagnostic; /* Criticality diagnostics */
830 }F1RmvFail;
831
832 /* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce
833  * the rate at which UEs access the network. */
834 typedef struct f1NwkAccessRateRed
835 {
836    uint32_t          transId;        /* Uniquely identifies transaction */
837    F1UacAssistInfo   uacAssistInfo;  /* UAC Assistance Information */
838 }F1NwkAccessRateRed;
839
840 typedef struct f1Ipaddr
841 {
842  bool ipV4Pres;
843  uint32_t  ipV4Addr; 
844 }F1IpAddr;
845
846 typedef struct sctpParams
847 {
848    F1IpAddr  duIpAddr;
849    U16       duPort[MAX_DU_PORT];
850    F1IpAddr  cuIpAddr;
851    U16       cuPort;
852    F1IpAddr  ricIpAddr;
853    U16       ricPort;
854 }SctpParams;
855
856 typedef struct f1EgtpParams
857 {
858    F1IpAddr  localIp;      /* Ip address of local node */
859    uint16_t  localPort;    /* Sender Port at local node */
860    F1IpAddr  destIp;       /* Ip address of peer node */
861    uint16_t  destPort;     /* Sender port at peer node */
862    uint32_t  minTunnelId;
863    uint32_t  maxTunnelId;
864 }F1EgtpParams;
865
866 typedef struct schedulerCfg
867 {
868    uint8_t         numTxAntPorts;    /*!< Number of Tx antenna ports */
869    uint8_t         ulSchdType;     /*!< Indicates which UL scheduler to use, range
870                                * is 0..(number of schedulers - 1) */
871    uint8_t         dlSchdType;     /*!< Indicates which DL scheduler to use, range
872                                * is 0..(number of schedulers - 1) */
873    uint8_t         numCells;       /*!< Max number of cells */
874    uint8_t         maxUlUePerTti;  /*!< Max number of UE in UL per TTI */
875    uint8_t         maxDlUePerTti;  /*!< Max number of UE in DL per TTI */
876 }SchedulerCfg;
877
878 typedef struct mibParams
879 {
880         uint8_t sysFrmNum;
881         long    subCarrierSpacingCommon;
882         long    ssb_SubcarrierOffset;
883         long    dmrs_TypeA_Position;
884         long    controlResourceSetZero;
885         long    searchSpaceZero;
886         long    cellBarred;
887         long    intraFreqReselection;
888 }MibParams;
889
890 typedef struct sib1Params
891 {
892         PlmnId    plmn;
893         uint8_t   tac;
894         long      ranac;
895         uint8_t   cellIdentity;
896         long      cellResvdForOpUse;
897 }Sib1Params;
898
899 typedef struct duCfgParams
900 {
901    SctpParams         sctpParams;                    /* SCTP Params */
902    F1EgtpParams       egtpParams;                    /* EGTP Params */
903    uint32_t           maxUe;
904    uint32_t           duId;
905    uint8_t            duName[CU_DU_NAME_LEN_MAX];
906    SchedulerCfg       schedCfg;
907    F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list *///TODO: this must be removed eventually
908    F1RrcVersion       rrcVersion;                    /* RRC version */
909
910    MacCellCfg         macCellCfg;       /* MAC cell configuration */
911    MibParams          mibParams;                     /* MIB Params */
912         Sib1Params         sib1Params;                    /* SIB1 Params */
913 }DuCfgParams;
914
915 /*function declarations */
916 void FillSlotConfig();
917 S16 readClCfg();
918 S16 readCfg();
919 S16 duReadCfg(); 
920 S16 bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
921
922 #endif /* __DU_CONFIG_H__ */
923
924 /**********************************************************************
925          End of file
926 **********************************************************************/