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);
62 SLICE_INFO_NOT_AVAILABLE,
70 ACTIVATION_IN_PROGRESS,
79 UE_HANDIN_IN_PROGRESS,
80 UE_DELETION_IN_PROGRESS
88 UE_CTXT_RRC_RECFG_COMPLETE,
94 typedef struct f1setupRsp
96 uint32_t transId; /* Uniquely identify transaction */
97 char cuName[CU_DU_NAME_LEN_MAX]; /* CU Name */
98 F1RrcVersion rrcVersion; /* RRC version */
101 typedef struct f1DlRrcMsg
103 uint32_t gnbDuUeF1apId;
104 uint32_t gnbCuUeF1apId;
107 bool deliveryStatRpt;
112 typedef struct gtpTnlCfg
114 uint32_t ulTnlAddress; /* remote Address */
115 uint32_t dlTnlAddress; /* local Address */
119 typedef struct upTnlCfg
121 ConfigType configType;
125 GtpTnlCfg *tnlCfg1; /* Tunnel 1 */
126 GtpTnlCfg *tnlCfg2; /* Tunnel 2 */
129 typedef struct duUeCfg
132 void *ueNrCapability;
133 uint8_t numRlcLcs; /* Rlc Ue Cfg */
134 RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
135 uint8_t numMacLcs; /* Mac Ue Cfg */
136 LcCfg macLcCfg[MAX_NUM_LC];
139 UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/
140 uint8_t numDrbSetupMod; /*No. of DRB Added during Modification*/
141 MacUeCfg copyOfmacUeCfg;
142 DataTransmissionAction dataTransmissionAction;
145 typedef struct f1UeContextSetup
147 UeCtxtActionType actionType;
151 F1DlRrcMsg *dlRrcMsg;
154 typedef struct cellCfgParams
156 NrEcgi nrEcgi; /* ECGI */
157 uint16_t nrPci; /* PCI */
158 uint16_t fiveGsTac; /* 5gSTac */
159 Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */
160 uint32_t maxUe; /* max UE per slot */
163 typedef struct duUeCb
165 F1UeContextSetupDb *f1UeDb;
167 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
168 uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
169 uint32_t drbBitMap; /* Drb Bit Map */
170 UeState ueState; /* UE Active/ Ue Inactive state */
171 MacUeCfg macUeCfg; /* Mac Ue Cfg */
172 RlcUeCfg rlcUeCfg; /* Rlc Ue Cfg */
175 typedef struct slotInfo
181 typedef struct pagingMsg
183 /*Note: Paging UEID is extracted from 5gSTMSI as per Spec 38.304, Sec 7.1.
184 *This is not same as DU-UE_F1AP_ID or CU_UE_F1AP_ID*/
185 uint16_t ueId; /* UE Identifier from CU*/
187 /*TODO: When RAN Inititated Paging will be supported then I-RNTI will be
188 * added as a choice for UE Identity along with S-TMSI*/
189 uint64_t sTmsi; /* UE Paging Identity: S-TMSI */
190 bool pagingDrxPres; /* flag to indicate paging drx present or not */
191 uint16_t pagingDrx; /* UE specific paging drx */
192 uint8_t pagPriority; /* Paging priority */
193 uint16_t pagingFrame; /* paging frame */
194 uint16_t pagingFrameOffset; /* paging offset */
195 uint8_t i_s; /* Index points to PO from the sub-frame pattern */
196 uint16_t T; /* T is DRX cycle of the UE */
199 typedef struct duCellCb
201 uint16_t cellId; /* Internal cell Id */
202 CellCfgParams cellInfo; /* Cell info */
203 /* pointer to store the address of macCellCfg params used to send du-app to MAC */
204 MacCellCfg *duMacCellCfg;
205 CellStatus cellStatus; /* Cell status */
206 uint32_t numActvUes; /* Total Active UEs */
207 DuUeCb ueCb[MAX_NUM_UE]; /* Stores UE context */
208 SlotInfo currSlotInfo;
209 DuPagingMsg tmpPagingInfoOfUe; /* UE paging information */
212 typedef struct duLSapCb
225 typedef struct ueCcchCtxt
227 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
228 uint16_t crnti; /* CRNTI */
229 uint16_t cellId; /* Cell Id */
232 /* This structure is added to store the information about the F1AP pdu and
233 * transId so that It can be used in future */
234 typedef struct reservedF1apPduInfo
236 uint8_t transId; /* trans Id */
237 void *f1apMsg; /* msg structure */
238 }ReservedF1apPduInfo;
243 Mem mem; /* Memory configs */
244 TskInit init; /* DU Init */
245 bool f1Status; /* Status of F1 connection */
246 bool e2Status; /* Status of E2 connection */
247 uint8_t numCfgCells; /* number of configured cells */
248 DuCellCb* cfgCellLst[MAX_NUM_CELL]; /* List of cells at DU APP of type DuCellCb */
249 uint8_t numActvCells; /* Number of active cells */
250 DuCellCb* actvCellLst[MAX_NUM_CELL]; /* List of cells activated/to be activated of type DuCellCb */
251 uint32_t gnbDuUeF1apIdGenerator; /* Generating Du Ue F1ap Id */
252 uint32_t numUe; /* current number of UEs */
253 UeCcchCtxt ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
254 uint8_t numTeId; /* current number of TEIDs configured in the system*/
255 UpTnlCfg* upTnlCfg[MAX_TEID]; /* tunnel info for every Drb */
256 CmLListCp reservedF1apPduList; /*storing F1AP pdu infomation and transId */
257 SliceCfgState sliceState;
258 F1SetupMsg f1SetupReqAndRspMsg;
262 typedef struct duLSapCfg
280 /* global variables */
282 //DuCfgParams duCfgParam;
284 /* DU Cell Functions */
285 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason);
286 uint8_t duActvTsk(Pst *pst, Buffer *mBuf);
287 uint8_t duSendRlcUlCfg();
288 uint8_t duSendRlcDlCfg();
289 uint8_t duBuildRlcCfg(Inst inst);
290 uint8_t duBuildRlcLsapCfg(Ent ent, Inst inst, uint8_t lsapInst);
291 uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst);
292 uint8_t DuHdlRlcCfgComplete(Pst *pst, RlcMngmt *cfm);
293 uint8_t duHdlRlcCntrlCfgComplete(Pst *pst, RlcMngmt *cfm);
294 uint8_t duProcRlcUlCfgComplete(Pst *pst, RlcMngmt *cfm);
295 uint8_t duProcRlcDlCfgComplete(Pst *pst, RlcMngmt *cfm);
296 uint8_t duSendMacCfg();
297 uint8_t duBuildMacGenCfg();
298 uint8_t duBuildMacUsapCfg(SpId sapId);
299 uint8_t duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
300 uint8_t duBindUnbindRlcToMacSap(uint8_t inst, uint8_t action);
301 uint8_t duProcCfgComplete();
302 uint8_t duSendSchCfg();
303 uint8_t duSctpStartReq();
304 uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
306 uint8_t duBuildEgtpCfgReq();
307 uint8_t duHdlEgtpCfgComplete(CmStatus cfm);
308 uint8_t duSendEgtpSrvOpenReq();
309 uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm);
310 uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInfo);
311 uint8_t duSendEgtpDatInd(Buffer *mBuf);
312 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
313 uint8_t duBuildAndSendMacCellStart();
314 uint8_t duBuildAndSendMacCellStop(uint16_t cellId);
317 /**********************************************************************
319 **********************************************************************/