1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /* This file contains message handling functionality for DU cell management */
24 /* Memory related configs */
25 #define DU_APP_MEM_REGION 0
26 #define RLC_UL_MEM_REGION 1
27 #define RLC_DL_MEM_REGION 4
28 #define MAC_MEM_REGION 4
37 #define EVENT_CU_DATA 2
38 #define EVENT_SCTP_NTFY 3
39 #define EVTSRVOPENREQ 4
40 #define EVTSRVOPENCFM 5
41 #define EVTTNLMGMTREQ 6
42 #define EVTTNLMGMTCFM 7
44 #define EVTSTARTPOLL 9
45 #define EVENT_RIC_DATA 10
57 #define DU_SAP_UNBOUND 1
58 #define DU_SAP_BINDING 2
59 #define DU_SAP_BOUND 3
63 #define DU_UE_START_CRNTI 100
70 #define RLC_MAC_SAP_CFG 2
71 #define RLC_UDX_SAP_CFG 4
77 #define DU_RLC_UL_CONFIGURED (RLC_GEN_CFG | \
78 RLC_MAC_SAP_CFG | RLC_UDX_SAP_CFG)
79 #define DU_RLC_DL_CONFIGURED DU_RLC_UL_CONFIGURED
81 #define MAC_CONFIGURED (MAC_GEN_CFG | MAC_SAP_CFG)
83 #define DU_SET_ZERO(_buf, _size) \
84 cmMemset((U8 *)(_buf), 0, _size);
86 /* allocate and zero out a static buffer */
87 #define DU_ALLOC(_datPtr, _size) \
90 _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \
91 (Data **)&_datPtr, _size); \
93 cmMemset((U8*)_datPtr, 0, _size); \
98 /* free a static buffer */
99 #define DU_FREE(_datPtr, _size) \
101 SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \
102 (Data *)_datPtr, _size);
104 /* Allocate shared memory to be used for LWLC
105 * during inter-layer communication */
106 #define DU_ALLOC_SHRABL_BUF(_buf, _size) \
108 if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL, \
109 (Data **)&_buf, (Size) _size, 0) == ROK) \
111 cmMemset((U8 *)(_buf), 0, _size); \
119 /* Free shared memory, received through LWLC */
120 #define DU_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \
124 (Void) SPutStaticBuffer(_region, _pool, \
125 (Data *) _buf, (Size) _size, 0); \
134 ACTIVATION_IN_PROGRESS,
145 typedef struct cellCfgParams
147 NrEcgi nrEcgi; /* ECGI */
149 U16 fiveGsTac; /* 5gSTac */
150 Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */
151 U32 maxUe; /* max UE per slot */
154 typedef struct duUeCb
156 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
157 uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
162 typedef struct duCellCb
164 uint16_t cellId; /* Internal cell Id */
165 CellCfgParams cellInfo; /* Cell info */
166 Bool firstSlotIndRcvd;
167 CellStatus cellStatus; /* Cell status */
168 uint32_t numActvUes; /* Total Active UEs */
169 DuUeCb ueCb[DU_MAX_UE]; /* UE CONTEXT */
172 typedef struct duLSapCb
185 typedef struct ueCcchCtxt
187 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
188 uint16_t crnti; /* CRNTI */
189 uint16_t cellId; /* Cell Id */
196 Mem mem; /* Memory configs */
197 TskInit init; /* DU Init */
198 //DuLSapCb **macSap; /* MAC SAP */
199 Bool f1Status; /* Status of F1 connection */
200 Bool e2Status; /* Status of E2 connection */
201 DuCellCb* cfgCellLst[DU_MAX_CELLS]; /* List of cells at DU APP of type DuCellCb */
202 DuCellCb* actvCellLst[DU_MAX_CELLS]; /* List of cells activated/to be activated of type DuCellCb */
203 /* pointer to store the address of macCellCfg params used to send du-app to MAC */
204 MacCellCfg *duMacCellCfg; /* pointer to store params while sending DU-APP to MAC */
205 uint32_t numUe; /* current number of UEs */
206 UeCcchCtxt ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
210 typedef struct duLSapCfg
228 /* global variables */
230 //DuCfgParams duCfgParam;
232 /* DU Cell Functions */
233 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason);
234 S16 duActvTsk(Pst *pst, Buffer *mBuf);
235 S16 duSendRlcUlCfg();
236 S16 duSendRlcDlCfg();
237 S16 duBuildRlcCfg(Inst inst);
238 S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst);
239 S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst);
240 S16 duHdlRlcCfgComplete(Pst *pst, KwMngmt *cfm);
241 S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cfm);
242 S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm);
243 S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm);
245 S16 duBuildMacGenCfg();
246 S16 duBuildMacUsapCfg(SpId sapId);
247 S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
248 S16 duBindUnbindRlcToMacSap(U8 inst, U8 action);
249 S16 duProcCfgComplete();
251 S16 duSctpStartReq();
252 S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
254 S16 duBuildEgtpCfgReq();
255 S16 duHdlEgtpCfgComplete(CmStatus cfm);
256 S16 duSendEgtpSrvOpenReq();
257 S16 duHdlEgtpSrvOpenComplete(CmStatus cfm);
258 S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid);
259 S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm);
260 S16 duSendEgtpTestData();
261 S16 duSendEgtpDatInd(Buffer *mBuf);
262 S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
263 uint16_t duBuildAndSendMacCellStartReq();
264 uint16_t duBuildAndSendMacCellStopReq();
268 /**********************************************************************
270 **********************************************************************/