RLC UeCb Changes
[o-du/l2.git] / src / du_app / du_mgr.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 /* This file contains message handling functionality for DU cell management */
20 #ifndef __DU_MGR_H__
21 #define __DU_MGR_H__
22 #define DU_PROC  0
23
24 /* SAP IDs */
25 #define DU_MAC_SUID 0
26 #define DU_MAC_SPID 0
27
28 /* Instance */
29 #define RLC_UL_INST 0
30 #define RLC_DL_INST 1
31
32 /* SAP state */
33 #define DU_SAP_UNBOUND 1
34 #define DU_SAP_BINDING 2
35 #define DU_SAP_BOUND   3
36
37 #define DU_ZERO_VAL 0
38
39 /* Macros */
40 #define ADD 0
41 #define DEL 1
42
43 #define RLC_GEN_CFG      1
44 #define RLC_MAC_SAP_CFG  2
45 #define RLC_UDX_SAP_CFG  4
46
47 #define MAC_GEN_CFG   1
48 #define MAC_SAP_CFG   2
49 #define MAX_MAC_SAP   2
50
51 #define DU_RLC_UL_CONFIGURED  (RLC_GEN_CFG |  \
52       RLC_MAC_SAP_CFG | RLC_UDX_SAP_CFG)
53 #define DU_RLC_DL_CONFIGURED DU_RLC_UL_CONFIGURED
54
55 #define MAC_CONFIGURED (MAC_GEN_CFG | MAC_SAP_CFG)
56
57 #define DU_SET_ZERO(_buf, _size)   \
58    cmMemset((U8 *)(_buf), 0, _size);
59
60 typedef enum
61 {
62    CELL_OUT_OF_SERVICE,
63    ACTIVATION_IN_PROGRESS,
64    ACTIVATED,
65    DELETION_IN_PROGRESS
66 }CellStatus;
67
68 typedef enum
69 {
70    UE_INACTIVE,
71    UE_ACTIVE
72 }UeState;
73
74 typedef struct cellCfgParams
75 {
76    NrEcgi      nrEcgi;         /* ECGI */
77    U16         nrPci;          /* PCI */
78    U16         fiveGsTac;         /* 5gSTac */
79    Plmn      plmn[MAX_PLMN]; /* List of serving PLMN IDs */
80    U32         maxUe;          /* max UE per slot */
81 }CellCfgParams;
82
83 typedef struct duUeCb
84 {
85    uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
86    uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
87    UeState  ueState;
88    MacUeCfg macUeCfg;
89    RlcUeCfg rlcUeCfg;
90 }DuUeCb;
91
92 typedef struct duCellCb
93 {
94    uint16_t       cellId;           /* Internal cell Id */
95    CellCfgParams  cellInfo;         /* Cell info */
96    Bool           firstSlotIndRcvd;
97    CellStatus     cellStatus;       /* Cell status */
98    uint32_t       numActvUes;       /* Total Active UEs */
99    DuUeCb         ueCb[MAX_NUM_UE];  /* UE CONTEXT */
100 }DuCellCb;
101
102 typedef struct duLSapCb
103 {
104    Pst pst;
105    SuId        suId;
106    SpId        spId;
107    State       sapState;
108    Mem         mem;
109    CmTimer     timer;
110    U8          bndRetryCnt;
111    U8          maxBndRetry;
112    TmrCfg      bndTmr;
113 }DuLSapCb;
114
115 typedef struct ueCcchCtxt
116 {
117    uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
118    uint16_t crnti;         /* CRNTI */
119    uint16_t cellId;        /* Cell Id */
120 }UeCcchCtxt;
121
122
123 /* DU APP DB */
124 typedef struct duCb
125 {
126    Mem           mem;    /* Memory configs */
127    TskInit       init;   /* DU Init */
128    //DuLSapCb      **macSap;  /* MAC SAP */
129    Bool          f1Status; /* Status of F1 connection */
130    Bool          e2Status; /* Status of E2 connection */
131    uint8_t       numCfgCells; 
132    DuCellCb*     cfgCellLst[MAX_NUM_CELL];     /* List of cells at DU APP of type DuCellCb */
133    uint8_t       numActvCells;
134    DuCellCb*     actvCellLst[MAX_NUM_CELL];    /* List of cells activated/to be activated of type DuCellCb */
135    /* pointer to store the address of macCellCfg params used to send du-app to MAC */
136    MacCellCfg    *duMacCellCfg;         /* pointer to store params while sending DU-APP to MAC */
137    uint32_t       numUe;            /* current number of UEs */
138    UeCcchCtxt     ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
139 }DuCb;
140
141
142 typedef struct duLSapCfg
143 {
144    SuId        suId;
145    SpId        spId;
146    Ent         srcEnt;
147    Inst        srcInst;
148    ProcId      dstProcId;
149    Ent         dstEnt;
150    Inst        dstInst;
151    Priority    dstPrior;
152    Route       dstRoute;
153    Selector    dstSel;
154    Mem         mem;
155    U8          maxBndRetry;
156    TmrCfg      bndTmr;
157    TmrCfg      connTmr;
158 }DuLSapCfg;
159
160 /* global variables */
161 DuCb duCb;
162 //DuCfgParams duCfgParam;
163
164 /* DU Cell Functions */
165 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason);
166 S16 duActvTsk(Pst *pst, Buffer *mBuf);
167 S16 duSendRlcUlCfg();
168 S16 duSendRlcDlCfg();
169 S16 duBuildRlcCfg(Inst inst);
170 S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst);
171 S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst);
172 S16 DuHdlRlcCfgComplete(Pst *pst, KwMngmt *cfm);
173 S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cfm);
174 S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm);
175 S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm);
176 S16 duSendMacCfg();
177 S16 duBuildMacGenCfg();
178 S16 duBuildMacUsapCfg(SpId sapId);
179 S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
180 S16 duBindUnbindRlcToMacSap(U8 inst, U8 action);
181 S16 duProcCfgComplete();
182 S16 duSendSchCfg();
183 S16 duSctpStartReq();
184 S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
185
186 S16 duBuildEgtpCfgReq();
187 S16 duHdlEgtpCfgComplete(CmStatus cfm);
188 S16 duSendEgtpSrvOpenReq();
189 S16 duHdlEgtpSrvOpenComplete(CmStatus cfm);
190 S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid);
191 S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm);
192 S16 duSendEgtpTestData();
193 S16 duSendEgtpDatInd(Buffer *mBuf);
194 S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
195 uint8_t duBuildAndSendMacCellStartReq();
196 uint8_t duBuildAndSendMacCellStopReq();
197 #endif
198
199 /**********************************************************************
200   End of file
201  **********************************************************************/