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 */
33 #define DU_SAP_UNBOUND 1
34 #define DU_SAP_BINDING 2
35 #define DU_SAP_BOUND 3
44 #define RLC_MAC_SAP_CFG 2
45 #define RLC_UDX_SAP_CFG 4
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
55 #define MAC_CONFIGURED (MAC_GEN_CFG | MAC_SAP_CFG)
57 #define DU_SET_ZERO(_buf, _size) \
58 memset((_buf), 0, _size);
63 ACTIVATION_IN_PROGRESS,
72 UE_DELETION_IN_PROGRESS
84 typedef struct f1setupRsp
86 uint32_t transId; /* Uniquely identify transaction */
87 char cuName[CU_DU_NAME_LEN_MAX]; /* CU Name */
88 F1RrcVersion rrcVersion; /* RRC version */
91 typedef struct f1DlRrcMsg
93 uint32_t gnbDuUeF1apId;
94 uint32_t gnbCuUeF1apId;
102 typedef struct gtpTnlCfg
104 uint32_t ulTnlAddress; /* remote Address */
105 uint32_t dlTnlAddress; /* local Address */
109 typedef struct upTnlCfg
111 ConfigType configType;
115 GtpTnlCfg *tnlCfg1; /* Tunnel 1 */
116 GtpTnlCfg *tnlCfg2; /* Tunnel 2 */
119 typedef struct duUeCfg
122 void *ueNrCapability;
123 uint8_t numRlcLcs; /* Rlc Ue Cfg */
124 RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
125 uint8_t numMacLcs; /* Mac Ue Cfg */
126 LcCfg macLcCfg[MAX_NUM_LC];
129 UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/
132 typedef struct f1UeContextSetup
134 UeCtxtActionType actionType;
138 F1DlRrcMsg *dlRrcMsg;
141 typedef struct cellCfgParams
143 NrEcgi nrEcgi; /* ECGI */
144 uint16_t nrPci; /* PCI */
145 uint16_t fiveGsTac; /* 5gSTac */
146 Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */
147 uint32_t maxUe; /* max UE per slot */
150 typedef struct duUeCb
152 F1UeContextSetupDb *f1UeDb;
154 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
155 uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
156 uint32_t drbBitMap; /* Drb Bit Map */
157 UeState ueState; /* UE Active/ Ue Inactive state */
158 MacUeCfg macUeCfg; /* Mac Ue Cfg */
159 RlcUeCfg rlcUeCfg; /* Rlc Ue Cfg */
162 typedef struct duCellCb
164 uint16_t cellId; /* Internal cell Id */
165 CellCfgParams cellInfo; /* Cell info */
166 /* pointer to store the address of macCellCfg params used to send du-app to MAC */
167 MacCellCfg *duMacCellCfg;
168 CellStatus cellStatus; /* Cell status */
169 uint32_t gnbDuUeF1apIdGenerator; /* Generating Du Ue F1ap Id */
170 uint32_t numActvUes; /* Total Active UEs */
171 DuUeCb ueCb[MAX_NUM_UE]; /* UE CONTEXT */
174 typedef struct duLSapCb
187 typedef struct ueCcchCtxt
189 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
190 uint16_t crnti; /* CRNTI */
191 uint16_t cellId; /* Cell Id */
194 /* This structure is added to store the information about the F1AP pdu and
195 * transId so that It can be used in future */
196 typedef struct reservedF1apPduInfo
198 uint8_t transId; /* trans Id */
199 void *f1apMsg; /* msg structure */
200 }ReservedF1apPduInfo;
205 Mem mem; /* Memory configs */
206 TskInit init; /* DU Init */
207 bool f1Status; /* Status of F1 connection */
208 bool e2Status; /* Status of E2 connection */
209 uint8_t numCfgCells; /* number of configured cells */
210 DuCellCb* cfgCellLst[MAX_NUM_CELL]; /* List of cells at DU APP of type DuCellCb */
211 uint8_t numActvCells; /* Number of active cells */
212 DuCellCb* actvCellLst[MAX_NUM_CELL]; /* List of cells activated/to be activated of type DuCellCb */
213 uint32_t numUe; /* current number of UEs */
214 UeCcchCtxt ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
215 uint8_t numDrb; /* current number of DRbs*/
216 UpTnlCfg* upTnlCfg[MAX_NUM_DRB]; /* tunnel info for every Drb */
217 CmLListCp reservedF1apPduList; /*storing F1AP pdu infomation and transId */
221 typedef struct duLSapCfg
239 /* global variables */
241 //DuCfgParams duCfgParam;
243 /* DU Cell Functions */
244 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason);
245 uint8_t duActvTsk(Pst *pst, Buffer *mBuf);
246 uint8_t duSendRlcUlCfg();
247 uint8_t duSendRlcDlCfg();
248 uint8_t duBuildRlcCfg(Inst inst);
249 uint8_t duBuildRlcLsapCfg(Ent ent, Inst inst, uint8_t lsapInst);
250 uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst);
251 uint8_t DuHdlRlcCfgComplete(Pst *pst, RlcMngmt *cfm);
252 uint8_t duHdlRlcCntrlCfgComplete(Pst *pst, RlcMngmt *cfm);
253 uint8_t duProcRlcUlCfgComplete(Pst *pst, RlcMngmt *cfm);
254 uint8_t duProcRlcDlCfgComplete(Pst *pst, RlcMngmt *cfm);
255 uint8_t duSendMacCfg();
256 uint8_t duBuildMacGenCfg();
257 uint8_t duBuildMacUsapCfg(SpId sapId);
258 uint8_t duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
259 uint8_t duBindUnbindRlcToMacSap(uint8_t inst, uint8_t action);
260 uint8_t duProcCfgComplete();
261 uint8_t duSendSchCfg();
262 uint8_t duSctpStartReq();
263 uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
265 uint8_t duBuildEgtpCfgReq();
266 uint8_t duHdlEgtpCfgComplete(CmStatus cfm);
267 uint8_t duSendEgtpSrvOpenReq();
268 uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm);
269 uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInfo);
270 uint8_t duSendEgtpDatInd(Buffer *mBuf);
271 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
272 uint8_t duBuildAndSendMacCellStart();
273 uint8_t duBuildAndSendMacCellStop(uint16_t cellId);
276 /**********************************************************************
278 **********************************************************************/