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