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);
60 /*Refer Spec 38.331 Annexure A: maxNrofPageRec : 32 [Maximum number of page records]*/
61 #define MAX_PAGING_UE_RECORDS 32
65 SLICE_INFO_NOT_AVAILABLE,
73 ACTIVATION_IN_PROGRESS,
82 UE_HANDIN_IN_PROGRESS,
83 UE_DELETION_IN_PROGRESS
91 UE_CTXT_RRC_RECFG_COMPLETE,
97 typedef struct f1setupRsp
99 uint32_t transId; /* Uniquely identify transaction */
100 char cuName[CU_DU_NAME_LEN_MAX]; /* CU Name */
101 F1RrcVersion rrcVersion; /* RRC version */
104 typedef struct f1DlRrcMsg
106 uint32_t gnbDuUeF1apId;
107 uint32_t gnbCuUeF1apId;
110 bool deliveryStatRpt;
115 typedef struct gtpTnlCfg
117 uint32_t ulTnlAddress; /* remote Address */
118 uint32_t dlTnlAddress; /* local Address */
122 typedef struct upTnlCfg
124 ConfigType configType;
128 GtpTnlCfg *tnlCfg1; /* Tunnel 1 */
129 GtpTnlCfg *tnlCfg2; /* Tunnel 2 */
132 typedef struct duUeCfg
135 void *ueNrCapability;
136 uint8_t numRlcLcs; /* Rlc Ue Cfg */
137 RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
138 uint8_t numMacLcs; /* Mac Ue Cfg */
139 LcCfg macLcCfg[MAX_NUM_LC];
142 UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/
143 uint8_t numDrbSetupMod; /*No. of DRB Added during Modification*/
144 MacUeCfg copyOfmacUeCfg;
145 DataTransmissionAction dataTransmissionAction;
148 typedef struct f1UeContextSetup
150 UeCtxtActionType actionType;
154 F1DlRrcMsg *dlRrcMsg;
157 typedef struct cellCfgParams
159 NrEcgi nrEcgi; /* ECGI */
160 uint16_t nrPci; /* PCI */
161 uint16_t fiveGsTac; /* 5gSTac */
162 Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */
163 uint32_t maxUe; /* max UE per slot */
166 typedef struct duUeCb
168 F1UeContextSetupDb *f1UeDb;
170 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
171 uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
172 uint32_t drbBitMap; /* Drb Bit Map */
173 UeState ueState; /* UE Active/ Ue Inactive state */
174 MacCfraResource cfraResource; /* CF-RA resource assigned by MAC/SCH */
175 MacUeCfg macUeCfg; /* Mac Ue Cfg */
176 RlcUeCfg rlcUeCfg; /* Rlc Ue Cfg */
179 typedef struct slotInfo
185 typedef struct pagingMsg
187 /*Note: Paging UEID is extracted from 5gSTMSI as per Spec 38.304, Sec 7.1.
188 *This is not same as DU-UE_F1AP_ID or CU_UE_F1AP_ID*/
189 uint16_t pagUeId; /* UE Identifier from CU*/
191 /*TODO: When RAN Inititated Paging will be supported then I-RNTI will be
192 * added as a choice for UE Identity along with S-TMSI*/
193 uint64_t sTmsi; /* UE Paging Identity: S-TMSI */
194 bool pagingDrxPres; /* flag to indicate paging drx present or not */
195 uint16_t pagingDrx; /* UE specific paging drx */
196 uint8_t pagPriority; /* Paging priority */
197 uint16_t pagingFrame; /* paging frame */
198 uint16_t pagingFrameOffset; /* paging offset */
199 uint8_t i_s; /* Index points to PO from the sub-frame pattern */
200 uint16_t T; /* T is DRX cycle of the UE */
203 typedef struct duPagUeRecord
205 uint16_t pagUeId; /*UEID calculated from 5gsTMSI as per Spec 38.304*/
206 uint64_t sTmsi; /* UE Paging Identity: S-TMSI */
209 typedef struct duPagInfo
211 uint8_t i_s; /*Index of PO*/
212 CmLListCp pagUeList; /*List of UEs to be paged in this Paging Frame/Paging Occ*/
215 typedef struct duPagInfoMap
217 uint16_t pf; /* Paging Frame*/
218 CmLListCp pagInfoList; /* Master List of Paging Identified by PF and i_s*/
221 typedef struct duCellCb
223 uint16_t cellId; /* Internal cell Id */
224 CellCfgParams cellInfo; /* Cell info */
225 /* pointer to store the address of macCellCfg params used to send du-app to MAC */
226 MacCellCfg *duMacCellCfg;
227 CellStatus cellStatus; /* Cell status */
228 uint32_t numActvUes; /* Total Active UEs */
229 DuUeCb ueCb[MAX_NUM_UE]; /* Stores UE context */
230 SlotInfo currSlotInfo;
231 DuPagingMsg tmpPagingInfoOfUe; /* UE paging information */
232 CmHashListCp pagingInfoMap; /*Paging Map between PF and PagingInfoList*/
235 typedef struct duLSapCb
248 typedef struct ueCcchCtxt
250 uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
251 uint16_t crnti; /* CRNTI */
252 uint16_t cellId; /* Cell Id */
255 /* This structure is added to store the information about the F1AP pdu and
256 * transId so that It can be used in future */
257 typedef struct reservedF1apPduInfo
259 uint8_t transId; /* trans Id */
260 void *f1apMsg; /* msg structure */
261 }ReservedF1apPduInfo;
266 Mem mem; /* Memory configs */
267 TskInit init; /* DU Init */
268 bool f1Status; /* Status of F1 connection */
269 bool e2Status; /* Status of E2 connection */
270 uint8_t numCfgCells; /* number of configured cells */
271 DuCellCb* cfgCellLst[MAX_NUM_CELL]; /* List of cells at DU APP of type DuCellCb */
272 uint8_t numActvCells; /* Number of active cells */
273 DuCellCb* actvCellLst[MAX_NUM_CELL]; /* List of cells activated/to be activated of type DuCellCb */
274 uint32_t gnbDuUeF1apIdGenerator; /* Generating Du Ue F1ap Id */
275 uint32_t numUe; /* current number of UEs */
276 UeCcchCtxt ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
277 uint8_t numTeId; /* current number of TEIDs configured in the system*/
278 UpTnlCfg* upTnlCfg[MAX_TEID]; /* tunnel info for every Drb */
279 CmLListCp reservedF1apPduList; /*storing F1AP pdu infomation and transId */
280 SliceCfgState sliceState;
281 F1SetupMsg f1SetupReqAndRspMsg;
285 typedef struct duLSapCfg
303 /* global variables */
305 //DuCfgParams duCfgParam;
307 /* DU Cell Functions */
308 uint8_t duActvInit(Ent entity, Inst inst, Region region, Reason reason);
309 uint8_t duActvTsk(Pst *pst, Buffer *mBuf);
310 uint8_t duSendRlcUlCfg();
311 uint8_t duSendRlcDlCfg();
312 uint8_t duBuildRlcCfg(Inst inst);
313 uint8_t duBuildRlcLsapCfg(Ent ent, Inst inst, uint8_t lsapInst);
314 uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst);
315 uint8_t DuHdlRlcCfgComplete(Pst *pst, RlcMngmt *cfm);
316 uint8_t duHdlRlcCntrlCfgComplete(Pst *pst, RlcMngmt *cfm);
317 uint8_t duProcRlcUlCfgComplete(Pst *pst, RlcMngmt *cfm);
318 uint8_t duProcRlcDlCfgComplete(Pst *pst, RlcMngmt *cfm);
319 uint8_t duSendMacCfg();
320 uint8_t duBuildMacGenCfg();
321 uint8_t duBuildMacUsapCfg(SpId sapId);
322 uint8_t duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm);
323 uint8_t duBindUnbindRlcToMacSap(uint8_t inst, uint8_t action);
324 uint8_t duProcCfgComplete();
325 uint8_t duSendSchCfg();
326 uint8_t duSctpStartReq();
327 uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy);
329 uint8_t duBuildEgtpCfgReq();
330 uint8_t duHdlEgtpCfgComplete(CmStatus cfm);
331 uint8_t duSendEgtpSrvOpenReq();
332 uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm);
333 uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInfo);
334 uint8_t duSendEgtpDatInd(Buffer *mBuf);
335 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
336 uint8_t duBuildAndSendMacCellStart();
337 uint8_t duBuildAndSendMacCellStop(uint16_t cellId);
341 /**********************************************************************
343 **********************************************************************/