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
68 #define RLC_MAC_SAP_CFG 2
69 #define RLC_UDX_SAP_CFG 4
75 #define DU_RLC_UL_CONFIGURED (RLC_GEN_CFG | \
76 RLC_MAC_SAP_CFG | RLC_UDX_SAP_CFG)
77 #define DU_RLC_DL_CONFIGURED DU_RLC_UL_CONFIGURED
79 #define MAC_CONFIGURED (MAC_GEN_CFG | MAC_SAP_CFG)
81 #define DU_SET_ZERO(_buf, _size) \
82 cmMemset((U8 *)(_buf), 0, _size);
84 /* allocate and zero out a static buffer */
85 #define DU_ALLOC(_datPtr, _size) \
88 _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, \
89 (Data **)&_datPtr, _size); \
91 cmMemset((U8*)_datPtr, 0, _size); \
96 /* free a static buffer */
97 #define DU_FREE(_datPtr, _size) \
99 SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \
100 (Data *)_datPtr, _size);
102 /* Allocate shared memory to be used for LWLC
103 * during inter-layer communication */
104 #define DU_ALLOC_SHRABL_BUF(_buf, _size) \
106 if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL, \
107 (Data **)&_buf, (Size) _size, 0) == ROK) \
109 cmMemset((U8 *)(_buf), 0, _size); \
117 /* Free shared memory, received through LWLC */
118 #define DU_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \
122 (Void) SPutStaticBuffer(_region, _pool, \
123 (Data *) _buf, (Size) _size, 0); \
132 ACTIVATION_IN_PROGRESS,
143 typedef struct cellCfgParams
145 NrEcgi nrEcgi; /* ECGI */
147 U16 fiveGsTac; /* 5gSTac */
148 Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */
149 U32 maxUe; /* max UE per slot */
152 typedef struct duUeCb
154 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
155 uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
160 typedef struct duCellCb
162 uint16_t cellId; /* Internal cell Id */
163 CellCfgParams cellInfo; /* Cell info */
164 Bool firstSlotIndRcvd;
165 CellStatus cellStatus; /* Cell status */
166 uint32_t numActvUes; /* Total Active UEs */
167 DuUeCb ueCb[DU_MAX_UE]; /* UE CONTEXT */
170 typedef struct duLSapCb
183 typedef struct ueCcchCtxt
185 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
186 uint16_t crnti; /* CRNTI */
187 uint16_t cellId; /* Cell Id */
194 Mem mem; /* Memory configs */
195 TskInit init; /* DU Init */
196 //DuLSapCb **macSap; /* MAC SAP */
197 Bool f1Status; /* Status of F1 connection */
198 Bool e2Status; /* Status of E2 connection */
199 DuCellCb* cfgCellLst[DU_MAX_CELLS]; /* List of cells at DU APP of type DuCellCb */
200 DuCellCb* actvCellLst[DU_MAX_CELLS]; /* List of cells activated/to be activated of type DuCellCb */
201 /* pointer to store the address of macCellCfg params used to send du-app to MAC */
202 MacCellCfg *duMacCellCfg; /* pointer to store params while sending DU-APP to MAC */
203 uint32_t numUe; /* current number of UEs */
204 UeCcchCtxt ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
208 typedef struct duLSapCfg
226 /* global variables */
228 //DuCfgParams duCfgParam;
230 /* DU Cell Functions */
231 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason);
232 S16 duActvTsk(Pst *pst, Buffer *mBuf);
233 S16 duSendRlcUlCfg();
234 S16 duSendRlcDlCfg();
235 S16 duBuildRlcCfg(Inst inst);
236 S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst);
237 S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst);
238 S16 duHdlRlcCfgComplete(Pst *pst, KwMngmt *cfm);
239 S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cfm);
240 S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm);
241 S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm);
243 S16 duBuildMacGenCfg();
244 S16 duBuildMacUsapCfg(SpId sapId);
245 S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
246 S16 duBindUnbindRlcToMacSap(U8 inst, U8 action);
247 S16 duProcCfgComplete();
249 S16 duSctpStartReq();
250 S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
252 S16 duBuildEgtpCfgReq();
253 S16 duHdlEgtpCfgComplete(CmStatus cfm);
254 S16 duSendEgtpSrvOpenReq();
255 S16 duHdlEgtpSrvOpenComplete(CmStatus cfm);
256 S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid);
257 S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm);
258 S16 duSendEgtpTestData();
259 S16 duSendEgtpDatInd(Buffer *mBuf);
260 S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
261 uint16_t duBuildAndSendMacCellStartReq();
262 uint16_t duBuildAndSendMacCellStopReq();
266 /**********************************************************************
268 **********************************************************************/