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 *******************************************************************************/
18 /* This file stores handler for MAC and SCH configuration requests */
19 /* header include files (.h) */
20 #include "common_def.h"
23 #include "du_app_mac_inf.h"
24 #include "mac_sch_interface.h"
25 #include "lwr_mac_upr_inf.h"
27 #include "rlc_mac_inf.h"
28 #include "mac_upr_inf_api.h"
30 #include "lwr_mac_fsm.h"
31 #include "mac_utils.h"
32 #include "lwr_mac_phy.h"
34 uint8_t ssbPeriodicity[6] = {5, 10, 20, 40, 80, 160};
36 uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
38 packMacCellCfgConfirm packMacCellCfmOpts[] =
40 packMacCellCfgCfm, /* packing for loosely coupled */
41 duHandleMacCellCfgCfm, /* packing for tightly coupled */
42 packMacCellCfgCfm, /* packing for light weight loosly coupled */
45 MacDuCellDeleteRspFunc macDuCellDeleteRspOpts[] =
47 packDuMacCellDeleteRsp, /* packing for loosely coupled */
48 DuProcMacCellDeleteRsp, /* packing for tightly coupled */
49 packDuMacCellDeleteRsp /* packing for light weight loosly coupled */
52 MacDuSliceCfgRspFunc macDuSliceCfgRspOpts[] =
54 packDuMacSliceCfgRsp, /* packing for loosely coupled */
55 DuProcMacSliceCfgRsp, /* packing for tightly coupled */
56 packDuMacSliceCfgRsp /* packing for light weight loosly coupled */
59 MacDuSliceRecfgRspFunc macDuSliceRecfgRspOpts[] =
61 packDuMacSliceRecfgRsp, /* packing for loosely coupled */
62 DuProcMacSliceRecfgRsp, /* packing for tightly coupled */
63 packDuMacSliceRecfgRsp /* packing for light weight loosly coupled */
66 MacDuStatsRspFunc macDuStatsRspOpts[] =
68 packDuMacStatsRsp, /* packing for loosely coupled */
69 DuProcMacStatsRsp, /* packing for tightly coupled */
70 packDuMacStatsRsp /* packing for light weight loosly coupled */
73 MacDuStatsDeleteRspFunc macDuStatsDeleteRspOpts[] =
75 packDuMacStatsDeleteRsp, /* packing for loosely coupled */
76 DuProcMacStatsDeleteRsp, /* packing for tightly coupled */
77 packDuMacStatsDeleteRsp /* packing for light weight loosly coupled */
80 MacDuStatsModificationRspFunc macDuStatsModificationRspOpts[] =
82 packDuMacStatsModificationRsp, /* packing for loosely coupled */
83 DuProcMacStatsModificationRsp, /* packing for tightly coupled */
84 packDuMacStatsModificationRsp /* packing for light weight loosly coupled */
88 * @brief Layer Manager Configuration request handler for Scheduler
92 * Function : MacSchGenCfgReq
94 * This function receives general configurations for Scheduler
95 * from DU APP and forwards to Scheduler.
97 * @param[in] Pst *pst, the post structure
98 * @param[in] RgMngmt *cfg, the configuration parameter's structure
102 uint8_t MacSchGenCfgReq(Pst *pst, RgMngmt *cfg)
106 DU_LOG("\nINFO --> MAC : Received Scheduler gen config at MAC");
107 memset(&schPst, 0, sizeof(Pst));
108 FILL_PST_MAC_TO_SCH(schPst, EVENT_SCH_GEN_CFG);
110 return(SchMessageRouter(&schPst, (void *)cfg));
114 * @brief Layer Manager Configuration response from Scheduler
118 * Function : SchSendCfgCfm
120 * This function sends general configurations response from
121 * Scheduler to DU APP.
123 * @param[in] Pst *pst, the post structure
124 * @param[in] RgMngmt *cfm, the configuration confirm structure
128 uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm)
130 DU_LOG("\nDEBUG --> MAC : Sending Scheduler config confirm to DU APP");
131 pst->dstEnt = ENTDUAPP;
134 pst->selector = ODU_SELECTOR_LC;
135 RgMiLrgSchCfgCfm(pst, cfm);
141 * @brief Layer Manager Configuration request handler.
145 * Function : MacProcCellCfgReq
147 * This function handles the gNB and cell configuration
148 * request received from DU APP.
149 * This API unapcks and forwards the config towards SCH
151 * @param[in] Pst *pst
152 * @param[in] MacCellCfg *macCellCfg
156 uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
159 uint16_t cellIdx, scsInKhz = 0;
160 uint8_t ret = ROK, plmnIdx = 0,sliceIdx = 0;
161 MacCellCb *macCellCb;
163 memset((uint8_t *)&cfmPst, 0, sizeof(Pst));
165 MAC_ALLOC(macCellCb, sizeof(MacCellCb));
166 if(macCellCb == NULLP)
168 DU_LOG("\nERROR --> MAC : macCellCb is NULL at handling of macCellCfg\n");
171 memset(macCellCb, 0, sizeof(MacCellCb));
173 GET_CELL_IDX(macCellCfg->cellId, cellIdx);
174 macCb.macCell[cellIdx] = macCellCb;
175 macCb.macCell[cellIdx]->cellId = macCellCfg->cellId;
176 scsInKhz = convertScsEnumValToScsVal(macCellCfg->cellCfg.subCarrSpacing);
178 /*Ref : 3GPP 38.211 Table 4.2-1: SCS = (2 ^ numerology * 15kHz)*/
179 macCb.macCell[cellIdx]->numerology = log2(scsInKhz/BASE_SCS);
180 macCb.macCell[cellIdx]->numOfSlots = 10 * (1 << (macCb.macCell[cellIdx]->numerology));
181 memcpy(&macCb.macCell[cellIdx]->macCellCfg, macCellCfg, sizeof(MacCellCfg));
183 MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, \
184 macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
185 if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu == NULLP)
187 DU_LOG("\nERROR --> MAC : macCellCb is NULL at handling of sib1Pdu of macCellCfg\n");
190 memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, macCellCfg->cellCfg.sib1Cfg.sib1Pdu, \
191 macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
193 for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
195 macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices;
196 MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices\
198 if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP)
200 DU_LOG("\nERROR --> MAC: Memory allocation failed at MacProcCellCfgReq");
204 if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai)
206 for(sliceIdx=0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++)
208 if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx])
210 MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
211 if(!macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx])
213 DU_LOG("\nERROR --> MAC: Memory allocation failed at MacProcCellCfgReq");
216 memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx],\
222 /* Send cell cfg to scheduler */
223 ret = MacSchCellCfgReq(pst, macCellCfg);
226 MacCellCfgCfm macCellCfgCfm;
227 macCellCfgCfm.rsp = RSP_NOK;
228 macCellCfgCfm.cellId = macCellCfg->cellId;
230 FILL_PST_MAC_TO_DUAPP(cfmPst, EVENT_MAC_CELL_CONFIG_CFM);
231 cfmPst.selector = ODU_SELECTOR_LC;
233 ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
237 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg ,sizeof(MacCellCfg));
240 } /* end of MacProcCellCfgReq */
243 * @brief Layer Manager Configuration request handler.
247 * Function : MacSchCellCfgReq
249 * This function sends cell configuration to SCH
251 * @param[in] Pst *pst
252 * @param[in] MacCellCfg *macCellCfg
256 uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
258 SchCellCfg schCellCfg;
260 uint8_t ssbMaskIdx = 0, rsrcListIdx = 0, sliceIdx=0, plmnIdx = 0;
262 memset(&cfgPst, 0, sizeof(Pst));
263 memset(&schCellCfg, 0, sizeof(SchCellCfg));
264 schCellCfg.cellId = macCellCfg->cellId;
265 schCellCfg.phyCellId = macCellCfg->cellCfg.phyCellId;
267 for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
269 schCellCfg.plmnInfoList[plmnIdx].plmn = macCellCfg->cellCfg.plmnInfoList[plmnIdx].plmn;
270 if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai)
272 schCellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices;
273 MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, schCellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices * sizeof(Snssai*));
274 if(!schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai)
276 DU_LOG("\nERROR --> MAC: Memory allocation failed at MacSchCellCfgReq");
279 for(sliceIdx=0; sliceIdx<schCellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++)
281 if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx])
283 MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
284 if(!schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx])
286 DU_LOG("\nERROR --> MAC: Memory allocation failed at MacSchCellCfgReq");
289 memcpy(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
295 schCellCfg.dupMode = macCellCfg->cellCfg.dupType;
296 schCellCfg.dlBandwidth = macCellCfg->carrCfg.dlBw;
297 schCellCfg.ulBandwidth = macCellCfg->carrCfg.ulBw;
299 schCellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
300 schCellCfg.dlCfgCommon.schFreqInfoDlSib.schSpcCarrier[0].subCarrierSpacing = macCellCfg->ssbCfg.scsCmn;
302 /* fill initial DL BWP */
303 schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->cellCfg.initialDlBwp.bwp.firstPrb;
304 schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->cellCfg.initialDlBwp.bwp.numPrb;
305 schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.scs = macCellCfg->cellCfg.initialDlBwp.bwp.scs;
306 schCellCfg.dlCfgCommon.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->cellCfg.initialDlBwp.bwp.cyclicPrefix;
308 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
309 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
310 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
311 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
312 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
313 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
314 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
315 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration;
316 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
317 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
318 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
319 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
320 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
321 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
322 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
323 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
324 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
325 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
326 schCellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
327 macCellCfg->cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
329 schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.numTimeDomAlloc = macCellCfg->cellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc;
330 for(rsrcListIdx = 0; rsrcListIdx<macCellCfg->cellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc; rsrcListIdx++)
332 schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].k0 =
333 macCellCfg->cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].k0;
334 schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
335 macCellCfg->cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType;
336 schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
337 macCellCfg->cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol;
338 schCellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].lengthSymbol =
339 macCellCfg->cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[rsrcListIdx].lengthSymbol;
342 /* fill SIB1 scheduler parameters */
343 schCellCfg.dlCfgCommon.schPcchCfg.numPO = macCellCfg->cellCfg.sib1Cfg.pagingCfg.numPO;
344 schCellCfg.dlCfgCommon.schPcchCfg.poPresent = macCellCfg->cellCfg.sib1Cfg.pagingCfg.poPresent;
345 if(schCellCfg.dlCfgCommon.schPcchCfg.poPresent)
347 memcpy(schCellCfg.dlCfgCommon.schPcchCfg.pagingOcc, macCellCfg->cellCfg.sib1Cfg.pagingCfg.pagingOcc, MAX_PO_PER_PF);
350 /* fill initial UL BWP */
351 schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->cellCfg.initialUlBwp.bwp.firstPrb;
352 schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->cellCfg.initialUlBwp.bwp.numPrb;
353 schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.scs = macCellCfg->cellCfg.initialUlBwp.bwp.scs;
354 schCellCfg.ulCfgCommon.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->cellCfg.initialUlBwp.bwp.cyclicPrefix;
355 /* fill RACH config params */
356 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
357 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1Fdm = macCellCfg->prachCfg.msg1Fdm;
358 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
359 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.zeroCorrZoneCfg = macCellCfg->prachCfg.fdm[0].zeroCorrZoneCfg;
360 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.prachCfgGeneric.raRspWindow = macCellCfg->prachCfg.raRspWindow;
362 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.totalNumRaPreamble = macCellCfg->prachCfg.totalNumRaPreamble;
363 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.ssbPerRach = macCellCfg->prachCfg.ssbPerRach;
364 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.numCbPreamblePerSsb = macCellCfg->prachCfg.numCbPreamblePerSsb;
365 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr;
366 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
367 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.rootSeqIdx = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
368 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.numRootSeq = macCellCfg->prachCfg.fdm[0].numRootSeq;
369 schCellCfg.ulCfgCommon.schInitialUlBwp.schRachCfg.msg1SubcSpacing = \
370 macCellCfg->prachCfg.prachSubcSpacing;
372 schCellCfg.ulCfgCommon.schInitialUlBwp.pucchCommon.pucchResourceCommon = \
373 macCellCfg->cellCfg.initialUlBwp.pucchCommon.pucchResourceCommon;
374 schCellCfg.ulCfgCommon.schInitialUlBwp.pucchCommon.pucchGroupHopping = \
375 macCellCfg->cellCfg.initialUlBwp.pucchCommon.pucchGroupHopping;
376 schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc = \
377 macCellCfg->cellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc;
378 for(rsrcListIdx = 0; rsrcListIdx < macCellCfg->cellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc; rsrcListIdx++)
380 schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].k2 =
381 macCellCfg->cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].k2;
382 schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType =
383 macCellCfg->cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].mappingType;
384 schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol =
385 macCellCfg->cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].startSymbol;
386 schCellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength =
387 macCellCfg->cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength;
391 memcpy(&schCellCfg.tddCfg, &macCellCfg->tddCfg, sizeof(TDDCfg));
394 /* fill ssb scheduler parameters */
395 for(ssbMaskIdx=0; ssbMaskIdx<SSB_MASK_SIZE; ssbMaskIdx++)
397 schCellCfg.ssbPosInBurst[ssbMaskIdx] = macCellCfg->ssbCfg.ssbMask[ssbMaskIdx];
399 schCellCfg.ssbPeriod = ssbPeriodicity[macCellCfg->ssbCfg.ssbPeriod];
400 schCellCfg.ssbFrequency = macCellCfg->cellCfg.ssbFreq;
401 schCellCfg.dmrsTypeAPos = macCellCfg->ssbCfg.dmrsTypeAPos;
402 schCellCfg.ssbScs = macCellCfg->cellCfg.subCarrSpacing;
403 schCellCfg.pdcchCfgSib1.coresetZeroIndex = macCellCfg->cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex;
404 schCellCfg.pdcchCfgSib1.searchSpaceZeroIndex = macCellCfg->cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex;
405 schCellCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
406 schCellCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
407 schCellCfg.sib1PduLen = macCellCfg->cellCfg.sib1Cfg.sib1PduLen;
409 FILL_PST_MAC_TO_SCH(cfgPst, EVENT_SCH_CELL_CFG);
411 return(SchMessageRouter(&cfgPst, (void *)&schCellCfg));
412 } /* end of MacSchCellCfgReq */
415 /*******************************************************************
417 * @brief Sends Cell config confirm to DU APP
421 * Function : MacSendCellCfgCfm
424 * Sends Cell config confirm to DU APP
426 * @params[in] Response status
429 * ****************************************************************/
430 void MacSendCellCfgCfm(uint16_t cellId, uint8_t response)
434 MacCellCfgCfm macCellCfgCfm;
436 memset(&pst, 0, sizeof(Pst));
438 GET_CELL_IDX(cellId, cellIdx);
439 macCellCfgCfm.cellId = macCb.macCell[cellIdx]->macCellCfg.cellId;
440 macCellCfgCfm.rsp = response;
443 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_CELL_CONFIG_CFM);
444 pst.selector = ODU_SELECTOR_LC;
446 (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
451 * @brief Layer Manager Configuration response handler.
455 * Function : MacProcSchCellCfgCfm
457 * This function processes cell configuration to SCH
459 * @param[in] Pst *pst
460 * @param[in] SchCellCfgCfm *schCellCfgCfm
464 uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm)
466 uint16_t *cellId = NULLP;
468 #ifdef CALL_FLOW_DEBUG_LOG
469 DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_SCH_CELL_CFG_CFM\n");
472 if(schCellCfgCfm->rsp == RSP_OK)
474 cellId = &schCellCfgCfm->cellId;
475 #ifdef INTEL_TIMER_MODE
476 sendToLowerMac(UL_IQ_SAMPLE, 0, (void *)cellId);
478 sendToLowerMac(CONFIG_REQUEST, 0, (void *)cellId);
483 MacSendCellCfgCfm(schCellCfgCfm->cellId, RSP_NOK);
488 /*******************************************************************
490 * @brief MAC handler for config response from PHY
494 * Function : fapiMacConfigRsp
497 * Processes config response from PHY and sends cell config
503 * ****************************************************************/
504 void fapiMacConfigRsp(uint16_t cellId)
506 /* TODO : Processing of config response from PHY */
508 /* Send cell config cfm to DU APP */
509 MacSendCellCfgCfm(cellId, RSP_OK);
512 /*******************************************************************
514 * @brief Fill and Send Cell Delete response from MAC to DU APP
518 * Function : MacSendCellDeleteRsp
520 * Functionality: Fill and Send Cell Delete response from MAC to DUAPP
522 * @params[in] MAC Cell delete result
523 * SCH Cell delete response
524 * @return ROK - success
527 * ****************************************************************/
528 uint8_t MacSendCellDeleteRsp(CauseOfResult status, uint8_t cellId)
530 MacCellDeleteRsp *deleteRsp=NULLP;
533 MAC_ALLOC_SHRABL_BUF(deleteRsp, sizeof(MacCellDeleteRsp));
536 DU_LOG("\nERROR --> MAC : MacSendCellDeleteRsp(): Memory allocation for Cell delete response failed");
540 /* Filling CELL delete response */
542 memset(deleteRsp, 0, sizeof(MacCellDeleteRsp));
543 deleteRsp->cellId = cellId;
544 deleteRsp->status = status;
546 /* Fill Post structure and send CELL delete response*/
547 memset(&rspPst, 0, sizeof(Pst));
548 FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_CELL_DELETE_RSP);
549 return (*macDuCellDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp);
552 /*******************************************************************
554 * @brief Processes CELL delete response from scheduler
558 * Function : MacProcSchCellDeleteRsp
561 * Processes CELL delete from scheduler
563 * @params[in] Pst : Post structure
564 * schCellDelRsp : Scheduler CELL delete respons
565 * @return ROK - success
568 * * ****************************************************************/
569 uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
571 uint8_t ret = ROK, sliceIdx = 0, plmnIdx = 0;
575 #ifdef CALL_FLOW_DEBUG_LOG
576 DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_CELL_DELETE_RSP_TO_MAC\n");
581 if(schCellDelRsp->rsp == RSP_OK)
583 DU_LOG("\nINFO --> MAC : SCH CELL Delete response for cellId[%d] is successful ", \
584 schCellDelRsp->cellId);
585 GET_CELL_IDX(schCellDelRsp->cellId, cellIdx);
586 if(macCb.macCell[cellIdx])
588 if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId)
591 for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
593 if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai)
595 for(sliceIdx = 0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++)
597 MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
599 MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].\
600 suppSliceList.numSupportedSlices * sizeof(Snssai*));
603 MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, \
604 macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1PduLen);
605 MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb));
609 DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
610 cause = CELLID_INVALID;
616 DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
617 cause = CELLID_INVALID;
623 DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
624 cause = CELLID_INVALID;
627 if(MacSendCellDeleteRsp(cause, schCellDelRsp->cellId) != ROK)
629 DU_LOG("\nERROR --> MAC: MacProcSchCellDeleteRsp(): Failed to send CELL delete response");
636 DU_LOG("\nERROR --> MAC: MacProcSchCellDeleteRsp(): schCellDelRsp is NULL");
642 /*******************************************************************
644 * @brief Sends Cell delete req to Scheduler
648 * Function : sendCellDelReqToSch
650 * Functionality: sends Cell delete req to Scheduler
652 * @params[in] SchCellDelete *schCellDel
653 * @return ROK - success
656 * ****************************************************************/
658 uint8_t sendCellDelReqToSch(SchCellDeleteReq *schCellDelReq)
661 FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH);
662 return(SchMessageRouter(&schPst, (void *)schCellDelReq));
665 /*******************************************************************
667 * @brief Handles CELL Delete requst from DU APP
671 * Function : MacProcCellDeleteReq
673 * Functionality: Handles CELL Delete requst from DU APP
675 * @params[in] Pst *pst, MacCellDelete *cellDelete
676 * @return ROK - success
680 * ****************************************************************/
681 uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete)
683 uint8_t ret = ROK, cellIdx=0;
684 SchCellDeleteReq schCellDelete;
686 DU_LOG("\nINFO --> MAC : Cell Delete Request received for cellId[%d]", cellDelete->cellId);
690 GET_CELL_IDX(cellDelete->cellId, cellIdx);
691 if(macCb.macCell[cellIdx])
693 if(macCb.macCell[cellIdx]->cellId == cellDelete->cellId)
695 memset(&schCellDelete, 0, sizeof(SchCellDeleteReq ));
696 schCellDelete.cellId = cellDelete->cellId;
697 ret = sendCellDelReqToSch(&schCellDelete);
700 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to send UE Delete Request to SCH");
706 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
713 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
720 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Sending failure response to DU");
721 if(MacSendCellDeleteRsp(CELLID_INVALID, cellDelete->cellId) != ROK)
723 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): failed to send cell delete rsp for cellID[%d]",\
728 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDeleteReq));
732 DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Received MacCellDelete is NULL");
739 * @brief free the temporary slice cfg stored in macCb.
743 * Function : freeMacSliceCfgReq
745 * free the temporary slice cfg stored in macCb
751 void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst)
753 uint8_t policyIdx = 0, memberListIdx=0;
755 if(cfgReq->numOfRrmPolicy)
757 if(cfgReq->listOfRrmPolicy)
759 for(policyIdx = 0; policyIdx<cfgReq->numOfRrmPolicy; policyIdx++)
761 if(cfgReq->listOfRrmPolicy[policyIdx])
763 if(cfgReq->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
765 if(cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
767 for(memberListIdx = 0; memberListIdx<cfgReq->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
769 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
771 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
772 cfgReq->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
775 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
778 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq->listOfRrmPolicy, cfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
781 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cfgReq, sizeof(MacSliceCfgReq));
786 * @brief send slice cfg response to duapp.
790 * Function : MacSendSliceConfigRsp
792 * sends slice cfg response to duapp
794 * @param[in] MacSliceCfgRsp macSliceCfgRsp
798 uint8_t MacSendSliceConfigRsp(MacSliceCfgRsp *macSliceCfgRsp)
802 memset(&rspPst, 0, sizeof(Pst));
803 FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_SLICE_CFG_RSP);
804 return (*macDuSliceCfgRspOpts[rspPst.selector])(&rspPst, macSliceCfgRsp);
809 * @brief Mac process the slice cfg rsp received from sch.
813 * Function : MacProcSchSliceCfgRsp
815 * This function process the slice cfg rsp received from sch
817 * @param[in] Pst *pst
818 * @param[in] SchSliceCfgRsp *sliceCfgrsp
823 uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceCfgRsp)
825 MacSliceCfgRsp *macSliceCfgRsp = NULLP;
829 MAC_ALLOC_SHRABL_BUF(macSliceCfgRsp, sizeof(MacSliceCfgRsp));
830 if(macSliceCfgRsp == NULLP)
832 DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchSliceCfgRsp");
835 macSliceCfgRsp->snssai = schSliceCfgRsp->snssai;
836 if(schSliceCfgRsp->rsp == RSP_OK)
837 macSliceCfgRsp->rsp = MAC_DU_APP_RSP_OK;
840 macSliceCfgRsp->rsp = MAC_DU_APP_RSP_NOK;
842 macSliceCfgRsp->cause = schSliceCfgRsp->cause;
843 MacSendSliceConfigRsp(macSliceCfgRsp);
849 * @brief send slice cfg response to duapp.
853 * Function : MacSendSliceReconfigRsp
855 * sends slice cfg response to duapp
857 * @param[in] MacSliceRecfgRsp macSliceRecfgRsp
861 uint8_t MacSendSliceReconfigRsp(MacSliceRecfgRsp *macSliceRecfgRsp)
865 memset(&rspPst, 0, sizeof(Pst));
866 FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_SLICE_RECFG_RSP);
867 return (*macDuSliceRecfgRspOpts[rspPst.selector])(&rspPst, macSliceRecfgRsp);
872 * @brief Mac process the slice cfg rsp received from sch.
876 * Function : MacProcSchSliceRecfgRsp
878 * This function process the slice cfg rsp received from sch
880 * @param[in] Pst *pst
881 * @param[in] SchSliceCfgRsp *schSliceRecfgRsp
885 uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *schSliceRecfgRsp)
887 MacSliceRecfgRsp *macSliceRecfgRsp = NULLP;
891 MAC_ALLOC_SHRABL_BUF(macSliceRecfgRsp, sizeof(MacSliceRecfgRsp));
892 if(macSliceRecfgRsp == NULLP)
894 DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchSliceRecfgRsp");
898 macSliceRecfgRsp->snssai = schSliceRecfgRsp->snssai;
899 if(schSliceRecfgRsp->rsp == RSP_OK)
900 macSliceRecfgRsp->rsp = MAC_DU_APP_RSP_OK;
903 macSliceRecfgRsp->rsp = MAC_DU_APP_RSP_NOK;
905 macSliceRecfgRsp->cause = schSliceRecfgRsp->cause;
906 MacSendSliceReconfigRsp(macSliceRecfgRsp);
912 * @brief Mac process the downlink pcch indication received from DUAPP
916 * Function : MacProcDlPcchInd
918 * This function process the downlink pcch indication received from DUAPP
920 * @param[in] Pst *pst
921 * @param[in] DlPcchInd *pcchInd
925 uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd)
927 uint8_t ret = RFAILED;
928 uint16_t cellIdx = 0;
930 SchPageInd *schPageInd = NULLP;
934 DU_LOG("\nINFO --> MAC : Received DL PCCH IND from DU_APP for cellId[%d]", pcchInd->cellId);
936 GET_CELL_IDX(pcchInd->cellId, cellIdx);
938 if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != pcchInd->cellId)
940 DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): CellId[%d] does not exist", pcchInd->cellId);
944 if((pcchInd->pcchPdu == NULLP) || (pcchInd->pduLen <= 0))
946 DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Pcch pdu is null");
950 MAC_ALLOC(schPageInd, sizeof(SchPageInd));
951 if(schPageInd == NULLP)
953 DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory");
957 schPageInd->cellId = pcchInd->cellId;
958 schPageInd->pf = pcchInd->pf;
959 schPageInd->i_s = pcchInd->i_s;
960 schPageInd->pduLen = pcchInd->pduLen;
962 MAC_ALLOC(schPageInd->pagePdu, pcchInd->pduLen);
963 if(schPageInd->pagePdu == NULLP)
965 DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory");
966 MAC_FREE(schPageInd, sizeof(SchPageInd));
970 memcpy(schPageInd->pagePdu, pcchInd->pcchPdu, pcchInd->pduLen);
972 FILL_PST_MAC_TO_SCH(schPst, EVENT_PAGING_IND_TO_SCH);
973 ret = SchMessageRouter(&schPst, (void *)schPageInd);
978 if((pcchInd->pcchPdu) && (pcchInd->pduLen > 0))
980 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd->pcchPdu, pcchInd->pduLen);
982 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd, sizeof(DlPcchInd));
986 DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Null pointer");
992 * @brief Mac process the downlink Broadcast Req received from DUAPP
996 * Function : MacProcDlBroadcastReq
998 * This function process the downlink Broadcast Req received from DUAPP
1000 * @param[in] Pst *pst
1001 * @param[in] DlBroadcastReq *dlBroadcastReq
1005 uint8_t MacProcDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq)
1007 uint8_t ret = ROK, idx=0;
1008 uint16_t cellIdx = 0;
1012 DU_LOG("\nINFO --> MAC : Received DL braodcast req from DU_APP for cellId[%d]", dlBroadcastReq->cellId);
1014 GET_CELL_IDX(dlBroadcastReq->cellId, cellIdx);
1016 if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != dlBroadcastReq->cellId)
1019 DU_LOG("\nERROR --> MAC : MacProcDlBroadcastReq(): CellId[%d] does not exist", dlBroadcastReq->cellId);
1023 /*TODO - Complete the processing of DL Broadcast Request*/
1025 for(idx = 0; idx<dlBroadcastReq->numSiBlock; idx++)
1027 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx]->siAreaID, sizeof(uint8_t));
1028 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx], sizeof(SiSchedulingInfo));
1030 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq, sizeof(MacDlBroadcastReq));
1035 DU_LOG("\nERROR --> MAC : MacProcDlBroadcastReq(): Received Null pointer");
1041 * @brief Fill and send statistics response to DU APP
1045 * Function : MacSendStatsRspToDuApp
1047 * Fill and send statistics response to DU APP
1049 * @param[in] Response
1050 * @param[in] Cause of response
1054 uint8_t MacSendStatsRspToDuApp(MacStatsRsp *statsRsp)
1058 MacStatsRsp *macStatsRsp = NULLP;
1060 DU_LOG("\nINFO --> MAC : MacSendStatsRspToDuApp: Sending Statistics Response to DU APP");
1062 MAC_ALLOC_SHRABL_BUF(macStatsRsp, sizeof(MacStatsRsp));
1063 if(macStatsRsp == NULLP)
1065 DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsRsp");
1070 memcpy(macStatsRsp, statsRsp, sizeof(MacStatsRsp));
1071 memset(statsRsp, 0, sizeof(MacStatsRsp));
1073 memset(&pst, 0, sizeof(Pst));
1074 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STATISTICS_RSP);
1075 if(((*macDuStatsRspOpts[pst.selector])(&pst, macStatsRsp))!= ROK)
1077 DU_LOG("\nERROR --> MAC : Failed to send statistics response to DU APP");
1078 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsRsp, sizeof(MacStatsRsp));
1086 /*******************************************************************
1088 * @brief Rejects all statistics group requested by DU APP
1092 * Function : MacRejectAllStats
1094 * Functionality: Add all statistics group received in statistics
1095 * request from DU APP, to Reject-Stats-Group-List in statistics
1096 * response to DU APP
1098 * @params[in] Statistics request from DU APP
1099 * Cause of rejection
1100 * @return ROK - success
1103 * ****************************************************************/
1104 uint8_t MacRejectAllStats(MacStatsReq *macStatsReq, CauseOfResult cause)
1107 MacStatsRsp macStatsRsp;
1109 memset(&macStatsRsp, 0, sizeof(MacStatsRsp));
1111 /* Copying all stats group from stats request to stats response */
1112 macStatsRsp.subscriptionId = macStatsReq->subscriptionId;
1113 for(grpIdx = 0; grpIdx < macStatsReq->numStatsGroup; grpIdx++)
1115 macStatsRsp.statsGrpRejectedList[grpIdx].groupId = macStatsReq->statsGrpList[grpIdx].groupId;
1116 macStatsRsp.statsGrpRejectedList[grpIdx].cause = cause;
1118 macStatsRsp.numGrpRejected = macStatsReq->numStatsGroup;
1120 return MacSendStatsRspToDuApp(&macStatsRsp);
1124 * @brief Mac process the statistics Req received from DUAPP
1128 * Function : MacProcStatsReq
1130 * This function process the statistics request from duapp:
1131 * [Step 1] Basic validation. If fails, all stats group in stats request are
1133 * [Step 2] If basic validations passed, traverse all stats group and
1134 * validate each measurement types in each group.
1135 * [Step 3] If any measurement type validation fails in a group, that group
1136 * is not configured and it is added to stats-group-rejected-list in
1137 * mac-stats-response message.
1138 * [Step 4] Even if one group passes all validation, it is sent to SCH in
1139 * statistics request. The mac-stats-response message is added to
1140 * pending-response list. This will be sent to DU APP after stats response
1141 * is received from SCH.
1142 * [Step 5] If none of the groups passes all validation, mac-stats-response
1143 * is sent to du app with all group as part of stats-group-rejected-list.
1145 * @param[in] Pst *pst
1146 * @param[in] StatsReq *statsReq
1150 uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *macStatsReq)
1152 uint8_t macStatsGrpIdx = 0, macStatsIdx = 0, schStatsGrpIdx = 0, schStatsIdx = 0;
1153 uint8_t ret = RFAILED;
1154 bool measTypeInvalid = false;
1156 MacStatsGrpInfo *macStatsGrp = NULLP;
1157 SchStatsReq *schStatsReq = NULLP;
1158 MacStatsRsp *macStatsRsp = NULLP;
1160 DU_LOG("\nINFO --> MAC : Received Statistics Request from DU_APP");
1162 if(macStatsReq == NULLP)
1164 DU_LOG("\nERROR --> MAC : MacProcStatsReq(): Received Null pointer");
1168 /* [Step 1] Basic validation. If fails, statistics response is sent to DU APP
1169 * that rejectes all stats */
1171 /* If number of statistics request for which response is still pending
1172 * towards DU APP has reached its maximum limit */
1173 if(macCb.statistics.numPendingStatsRsp >= MAX_PENDING_STATS_RSP)
1175 DU_LOG("\nERROR --> MAC : MacProcStatsReq: Maximum number of statistics response is pending. \
1176 Cannot process new request.");
1177 MacRejectAllStats(macStatsReq, RESOURCE_UNAVAILABLE);
1178 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsReq, sizeof(MacStatsReq));
1182 /* If memory resources are unavailable */
1183 MAC_ALLOC(schStatsReq, sizeof(SchStatsReq));
1184 if(schStatsReq == NULLP)
1186 DU_LOG("\nERROR --> MAC : MacProcStatsReq: Failed to allocate memory");
1187 MacRejectAllStats(macStatsReq, RESOURCE_UNAVAILABLE);
1188 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsReq, sizeof(MacStatsReq));
1192 /* Add stats response to pending response list */
1193 macStatsRsp = &macCb.statistics.pendingStatsRsp[macCb.statistics.numPendingStatsRsp];
1194 memset(macStatsRsp, 0, sizeof(MacStatsRsp));
1196 /* [Step 2] Traverse all stats group and validate each measurement types in each group */
1197 schStatsReq->subscriptionId = macStatsReq->subscriptionId;
1198 schStatsReq->numStatsGroup = 0;
1199 for(macStatsGrpIdx = 0; macStatsGrpIdx < macStatsReq->numStatsGroup; macStatsGrpIdx++)
1201 measTypeInvalid = false;
1203 macStatsGrp = &macStatsReq->statsGrpList[macStatsGrpIdx];
1205 for(macStatsIdx=0; macStatsIdx < macStatsGrp->numStats; macStatsIdx++)
1207 /* Validate each measurement type */
1208 switch(macStatsGrp->statsList[macStatsIdx])
1210 case MAC_DL_TOTAL_PRB_USAGE:
1212 schStatsReq->statsGrpList[schStatsGrpIdx].statsList[schStatsIdx] = SCH_DL_TOTAL_PRB_USAGE;
1215 case MAC_UL_TOTAL_PRB_USAGE:
1217 schStatsReq->statsGrpList[schStatsGrpIdx].statsList[schStatsIdx] = SCH_UL_TOTAL_PRB_USAGE;
1222 DU_LOG("\nERROR --> MAC : MacProcStatsReq: Invalid measurement type [%d]", \
1223 macStatsGrp->statsList[macStatsIdx]);
1224 measTypeInvalid = true;
1228 /* Even if one measurement type is invalid, this group is rejected */
1231 memset(&schStatsReq->statsGrpList[schStatsGrpIdx], 0, sizeof(SchStatsGrpInfo));
1238 /* If all measurement type is valid, add group info to send to SCH */
1239 if(!measTypeInvalid)
1241 schStatsReq->statsGrpList[schStatsGrpIdx].groupId = macStatsGrp->groupId;
1242 schStatsReq->statsGrpList[schStatsGrpIdx].periodicity = macStatsGrp->periodicity;
1243 schStatsReq->statsGrpList[schStatsGrpIdx].numStats = schStatsIdx;
1248 /* [Step 3] If any measurement type validation fails in a group, that group
1249 * is not configured and it is added to stats-group-rejected-list in
1250 * mac-stats-response message */
1251 macStatsRsp->statsGrpRejectedList[macStatsRsp->numGrpRejected].groupId = macStatsGrp->groupId;
1252 macStatsRsp->statsGrpRejectedList[macStatsRsp->numGrpRejected].cause = PARAM_INVALID;
1253 macStatsRsp->numGrpRejected++;
1256 schStatsReq->numStatsGroup = schStatsGrpIdx;
1258 macStatsRsp->subscriptionId = macStatsReq->subscriptionId;
1260 if(schStatsReq->numStatsGroup)
1262 /* [Step 4] Even if one group passes all validation, it is sent to SCH in
1263 * statistics request. The mac-stats-response message is added to
1264 * pending-response list. */
1265 macCb.statistics.numPendingStatsRsp++;
1267 FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_REQ_TO_SCH);
1268 ret = SchMessageRouter(&schPst, (void *)schStatsReq);
1272 /* [Step 5] If none of the groups passes all validation, mac-stats-response
1273 * is sent to du app with all group as part of stats-group-rejected-list. */
1274 DU_LOG("\nERROR --> MAC : MacProcStatsReq: All statistics group found invalid");
1275 MAC_FREE(schStatsReq, sizeof(SchStatsReq));
1276 ret = MacSendStatsRspToDuApp(macStatsRsp);
1279 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsReq, sizeof(MacStatsReq));
1284 * @brief Mac process the statistics rsp received from sch.
1288 * Function : MacProcSchStatsRsp
1290 * This function process the statistics response received from sch
1292 * @param[in] Pst *pst
1293 * @param[in] SchStatsRsp *schStatsRsp
1297 uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp)
1299 uint8_t idx = 0, accptdIdx = 0, rjctdIdx = 0;
1300 uint8_t ret = RFAILED;
1301 MacStatsRsp *macStatsRsp = NULLP;
1305 /* Fetch pointer to statistics response from pending list saved at MAC
1306 * during processing statistics request from DU APP */
1307 for(idx = 0; idx < macCb.statistics.numPendingStatsRsp; idx++)
1309 if(macCb.statistics.pendingStatsRsp[idx].subscriptionId == schStatsRsp->subscriptionId)
1311 macStatsRsp = &macCb.statistics.pendingStatsRsp[idx];
1316 if(macStatsRsp == NULLP)
1318 MAC_FREE(schStatsRsp, sizeof(SchStatsRsp));
1322 /* Copy Stats-group-accpeted list received from SCH */
1323 for(accptdIdx = 0; accptdIdx<schStatsRsp->numGrpAccepted && macStatsRsp->numGrpAccepted<MAX_NUM_STATS_GRP; accptdIdx++)
1325 macStatsRsp->statsGrpAcceptedList[macStatsRsp->numGrpAccepted++] = schStatsRsp->statsGrpAcceptedList[accptdIdx];
1328 /* List together all stats group rejected by MAC and by SCH */
1329 for(rjctdIdx = 0; rjctdIdx < schStatsRsp->numGrpRejected && macStatsRsp->numGrpRejected<MAX_NUM_STATS_GRP; rjctdIdx++)
1331 macStatsRsp->statsGrpRejectedList[macStatsRsp->numGrpRejected].groupId = \
1332 schStatsRsp->statsGrpRejectedList[rjctdIdx].groupId;
1333 macStatsRsp->statsGrpRejectedList[macStatsRsp->numGrpRejected].cause = \
1334 schStatsRsp->statsGrpRejectedList[rjctdIdx].cause;
1335 macStatsRsp->numGrpRejected++;
1338 /* Send statistics response to DU APP */
1339 ret = MacSendStatsRspToDuApp(macStatsRsp);
1341 MAC_FREE(schStatsRsp, sizeof(SchStatsRsp));
1346 * @brief Fill and send statistics delete response to DU APP
1350 * Function : MacSendStatsDeleteRspToDuApp
1352 * Fill and send statistics delete response to DU APP
1353 * [Step-1] In SCH delete response is received, fill MAC stats delete
1354 * response with info from SCH stats delete response.
1355 * [Step-2] If a failure occurs while processing MAC stats delete request,
1356 * then fill MAC stats delete rsp with failure using info from MAC stats delete request.
1357 * [Step-3] Else if numStatsGroup > 0, then send stats delete response
1358 * with deletion status of each stats group.
1359 * [Step-4] If numStatsGroup = 0, send Stats delete response
1360 * for deletion of complete subscription.
1362 * @param[in] SchStatsDeleteRsp
1363 * @param[in] MacStatsDeleteReq
1367 uint8_t MacSendStatsDeleteRspToDuApp(SchStatsDeleteRsp *schStatsDeleteRsp, MacStatsDeleteReq *macStatsDeleteReq)
1370 uint8_t ret = ROK, idx=0;
1371 MacStatsDeleteRsp *macStatsDeleteRsp=NULLP;
1373 MAC_ALLOC_SHRABL_BUF(macStatsDeleteRsp, sizeof(MacStatsDeleteRsp));
1374 if(macStatsDeleteRsp == NULLP)
1376 DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsDeleteRsp");
1380 if(schStatsDeleteRsp)
1383 macStatsDeleteRsp->subscriptionId = schStatsDeleteRsp->subscriptionId;
1384 macStatsDeleteRsp->numStatsGroupDeleted = schStatsDeleteRsp->numStatsGroupDeleted;
1386 if(macStatsDeleteRsp->numStatsGroupDeleted)
1389 for(idx =0;idx<macStatsDeleteRsp->numStatsGroupDeleted; idx++)
1391 if(schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp == RSP_OK)
1393 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_OK;
1394 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause =schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause;
1398 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_NOK;
1399 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause =schStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause;
1406 if(schStatsDeleteRsp->subsDelRsp == RSP_OK)
1407 macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_OK;
1409 macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_NOK;
1410 macStatsDeleteRsp->subsDelCause = schStatsDeleteRsp->subsDelCause;
1416 macStatsDeleteRsp->subscriptionId = macStatsDeleteReq->subscriptionId;
1417 macStatsDeleteRsp->numStatsGroupDeleted= macStatsDeleteReq->numStatsGroupToBeDeleted;
1419 if(macStatsDeleteRsp->numStatsGroupDeleted)
1422 for(idx =0;idx<macStatsDeleteRsp->numStatsGroupDeleted; idx++)
1424 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp =MAC_DU_APP_RSP_NOK;
1425 macStatsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause = RESOURCE_UNAVAILABLE;
1431 macStatsDeleteRsp->subsDelRsp = MAC_DU_APP_RSP_NOK;
1432 macStatsDeleteRsp->subsDelCause = RESOURCE_UNAVAILABLE;
1436 DU_LOG("\nINFO --> MAC : MacSendStatsDeleteRspToDuApp: Sending Delete Statistics Response to DU APP");
1438 memset(&pst, 0, sizeof(Pst));
1439 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STATS_DELETE_RSP);
1440 if(((*macDuStatsDeleteRspOpts[pst.selector])(&pst, macStatsDeleteRsp))!= ROK)
1442 DU_LOG("\nERROR --> MAC : Failed to send statistics delete response to DU APP");
1443 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsDeleteRsp, sizeof(MacStatsDeleteRsp));
1451 * @brief Mac process the statistics delete rsp received from sch.
1455 * Function : MacProcSchStatsDeleteRsp
1457 * This function process the statistics delete response received from sch
1459 * @param[in] Pst *pst
1460 * @param[in] SchStatsDeleteRsp *schStatsDeleteRsp
1464 uint8_t MacProcSchStatsDeleteRsp(Pst *pst, SchStatsDeleteRsp *schStatsDeleteRsp)
1466 uint8_t ret = RFAILED;
1468 if(schStatsDeleteRsp)
1470 ret = MacSendStatsDeleteRspToDuApp(schStatsDeleteRsp, NULLP);
1471 MAC_FREE(schStatsDeleteRsp, sizeof(SchStatsDeleteRsp));
1477 * @brief Mac process the statistics delete Req received from DUAPP
1481 * Function : MacProcStatsDeleteReq
1483 * Functionality: Process the statistics delete request from duapp
1484 * @param[in] Pst *pst
1485 * @param[in] StatsDeleteReq *statsReq
1490 uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *macStatsDeleteReq)
1493 uint8_t ret = RFAILED;
1494 SchStatsDeleteReq *schStatsDeleteReq = NULLP;
1496 DU_LOG("\nINFO --> MAC : Received Statistics delete Request from DU_APP");
1498 if(macStatsDeleteReq == NULLP)
1500 DU_LOG("\nERROR --> MAC : MacProcStatsDeleteReq(): Received Null pointer");
1504 MAC_ALLOC(schStatsDeleteReq, sizeof(SchStatsDeleteReq));
1505 if(schStatsDeleteReq == NULLP)
1507 DU_LOG("\nERROR --> MAC : MacProcStatsDeleteReq: Failed to allocate memory");
1511 /* fill all the information in schStatsDeleteReq structure */
1512 schStatsDeleteReq->subscriptionId = macStatsDeleteReq->subscriptionId;
1513 schStatsDeleteReq->numStatsGroupToBeDeleted = macStatsDeleteReq->numStatsGroupToBeDeleted;
1514 memcpy(&schStatsDeleteReq->statsGrpIdToBeDelList, &macStatsDeleteReq->statsGrpIdToBeDelList, schStatsDeleteReq->numStatsGroupToBeDeleted*sizeof(uint8_t));
1515 FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_DELETE_REQ_TO_SCH);
1516 ret = SchMessageRouter(&schPst, (void *)schStatsDeleteReq);
1521 ret = MacSendStatsDeleteRspToDuApp(NULLP, macStatsDeleteReq);
1524 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsDeleteReq, sizeof(MacStatsDeleteReq));
1529 * @brief Fill and send statistics modification response to DU APP
1533 * Function : MacSendStatsModificationRspToDuApp
1535 * Fill and send statistics modification response to DU APP
1537 * @param[in] Stats modification Response
1541 uint8_t MacSendStatsModificationRspToDuApp(MacStatsModificationRsp *tmpMacStatsModRsp)
1545 MacStatsModificationRsp *macStatsModificationRsp = NULLP;
1547 DU_LOG("\nINFO --> MAC : MacSendStatsModificationRspToDuApp: Sending Statistics Modification Response to DU APP");
1550 MAC_ALLOC_SHRABL_BUF(macStatsModificationRsp, sizeof(MacStatsModificationRsp));
1551 if(macStatsModificationRsp == NULLP)
1553 DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsModificationRsp");
1558 memcpy(macStatsModificationRsp, tmpMacStatsModRsp, sizeof(MacStatsModificationRsp));
1559 memset(tmpMacStatsModRsp, 0, sizeof(MacStatsModificationRsp));
1561 memset(&pst, 0, sizeof(Pst));
1562 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STATISTICS_MODIFY_RSP);
1563 if(((*macDuStatsModificationRspOpts[pst.selector])(&pst, macStatsModificationRsp))!= ROK)
1565 DU_LOG("\nERROR --> MAC : Failed to send statistics modification response to DU APP");
1566 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsModificationRsp, sizeof(MacStatsModificationRsp));
1575 * @brief Mac process the statistics modification rsp received from sch.
1579 * Function : MacProcSchStatsModificationRsp
1581 * This function process the statistics modification response received from sch
1582 * [Step -1] Fetch pointer to statistics response from pending list saved at
1583 * MAC during processing statistics request from DU APP
1584 * [Step -2] Fill the list of accepted list
1585 * [Step -3] Fill the list of rejected list
1586 * [Step -4] Send statistics modification response to DU APP
1588 * @param[in] Pst *pst
1589 * @param[in] SchStatsModificationRsp *schStatsModificationRsp
1593 uint8_t MacProcSchStatsModificationRsp(Pst *pst, SchStatsModificationRsp *schStatsModificationRsp)
1595 uint8_t ret = RFAILED;
1596 uint8_t idx = 0, accptdIdx = 0, rjctdIdx = 0;
1597 MacStatsModificationRsp *macStatsModificationRsp = NULLP;
1599 if(schStatsModificationRsp)
1602 for(idx = 0; idx < macCb.statistics.numPendingStatsRsp; idx++)
1604 if(macCb.statistics.pendingStatsRsp[idx].subscriptionId == schStatsModificationRsp->subscriptionId)
1606 macStatsModificationRsp = &macCb.statistics.pendingStatsRsp[idx];
1611 if(macStatsModificationRsp == NULLP)
1613 MAC_FREE(schStatsModificationRsp, sizeof(SchStatsModificationRsp));
1618 for(accptdIdx = 0; accptdIdx<schStatsModificationRsp->numGrpAccepted && macStatsModificationRsp->numGrpAccepted<MAX_NUM_STATS_GRP; accptdIdx++)
1620 macStatsModificationRsp->statsGrpAcceptedList[macStatsModificationRsp->numGrpAccepted++] = schStatsModificationRsp->statsGrpAcceptedList[accptdIdx];
1624 for(rjctdIdx = 0; rjctdIdx < schStatsModificationRsp->numGrpRejected && macStatsModificationRsp->numGrpRejected<MAX_NUM_STATS_GRP; rjctdIdx++)
1626 macStatsModificationRsp->statsGrpRejectedList[macStatsModificationRsp->numGrpRejected].groupId = \
1627 schStatsModificationRsp->statsGrpRejectedList[rjctdIdx].groupId;
1628 macStatsModificationRsp->statsGrpRejectedList[macStatsModificationRsp->numGrpRejected].cause = \
1629 schStatsModificationRsp->statsGrpRejectedList[rjctdIdx].cause;
1630 macStatsModificationRsp->numGrpRejected++;
1634 ret = MacSendStatsModificationRspToDuApp(macStatsModificationRsp);
1636 MAC_FREE(schStatsModificationRsp, sizeof(SchStatsModificationRsp));
1640 /*******************************************************************
1642 * @brief Rejects all statistics modification group requested by DU APP
1646 * Function : MacRejectAllStatsModification
1648 * Functionality: Add all statistics modification group received in statistics
1649 * request from DU APP, to Reject-StatsModification-Group-List in statistics
1650 * response to DU APP
1652 * @params[in] Statistics request from DU APP
1653 * Cause of rejection
1654 * @return ROK - success
1657 * ****************************************************************/
1658 uint8_t MacRejectAllStatsModification(MacStatsModificationReq *macStatsModificationReq, CauseOfResult cause)
1661 MacStatsModificationRsp macStatsModificationRsp;
1663 memset(&macStatsModificationRsp, 0, sizeof(MacStatsModificationRsp));
1665 /* fill the subscriptionId and the rejected list in stats modification rsp */
1666 macStatsModificationRsp.subscriptionId = macStatsModificationReq->subscriptionId;
1667 for(grpIdx = 0; grpIdx < macStatsModificationReq->numStatsGroup; grpIdx++)
1669 macStatsModificationRsp.statsGrpRejectedList[grpIdx].groupId = macStatsModificationReq->statsGrpList[grpIdx].groupId;
1670 macStatsModificationRsp.statsGrpRejectedList[grpIdx].cause = cause;
1672 macStatsModificationRsp.numGrpRejected = macStatsModificationReq->numStatsGroup;
1674 return MacSendStatsModificationRspToDuApp(&macStatsModificationRsp);
1678 * @brief Mac process the statistics Modification Req received from DUAPP
1682 * Function : MacProcStatsModificationReq
1684 * This function process the statistics Modification request from duapp:
1685 * [Step 1] Basic validation. If fails, all stats group in stats request are
1687 * [Step 2] If basic validations passed, traverse all stats group and
1688 * validate each measurement types in each group.
1689 * [Step 3] If any measurement type validation fails in a group, that group
1690 * is not configured and it is added to stats-group-rejected-list in
1691 * mac-stats-response message.
1692 * [Step 4] Even if one group passes all validation, it is sent to SCH in
1693 * statistics request. The mac-stats-response message is added to
1694 * pending-response list. This will be sent to DU APP after stats response
1695 * is received from SCH.
1696 * [Step 5] If none of the groups passes all validation, mac-stats-response
1697 * is sent to du app with all group as part of stats-group-rejected-list.
1699 * @param[in] Pst *pst
1700 * @param[in] StatsModificationReq *statsModificationReq
1704 uint8_t MacProcStatsModificationReq(Pst *pst, MacStatsModificationReq *macStatsModificationReq)
1707 uint8_t ret = RFAILED;
1708 bool measTypeInvalid = false;
1709 uint8_t macStatsGrpIdx = 0, macStatsIdx = 0;
1710 uint8_t schStatsGrpIdx = 0, schStatsIdx = 0;
1711 MacStatsGrpInfo *macStatsGrp = NULLP;
1712 SchStatsModificationReq *schStatsModificationReq = NULLP;
1713 MacStatsModificationRsp *macStatsModificationRsp = NULLP;
1715 DU_LOG("\nINFO --> MAC : Received Statistics Modification Request from DU_APP");
1717 if(macStatsModificationReq == NULLP)
1719 DU_LOG("\nERROR --> MAC : MacProcStatsModificationReq(): Received Null pointer");
1724 if(macCb.statistics.numPendingStatsRsp >= MAX_PENDING_STATS_RSP)
1726 DU_LOG("\nERROR --> MAC : MacProcStatsModificationReq: Maximum number of statistics response is pending. \
1727 Cannot process new request.");
1728 MacRejectAllStatsModification(macStatsModificationReq, RESOURCE_UNAVAILABLE);
1729 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsModificationReq, sizeof(MacStatsModificationReq));
1733 MAC_ALLOC(schStatsModificationReq, sizeof(SchStatsModificationReq));
1734 if(schStatsModificationReq == NULLP)
1736 DU_LOG("\nERROR --> MAC : MacProcStatsModificationReq: Failed to allocate memory");
1737 MacRejectAllStatsModification(macStatsModificationReq, RESOURCE_UNAVAILABLE);
1738 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsModificationReq, sizeof(MacStatsModificationReq));
1742 macStatsModificationRsp = &macCb.statistics.pendingStatsRsp[macCb.statistics.numPendingStatsRsp];
1743 memset(macStatsModificationRsp, 0, sizeof(MacStatsModificationRsp));
1746 schStatsModificationReq->subscriptionId = macStatsModificationReq->subscriptionId;
1747 schStatsModificationReq->numStatsGroup = 0;
1748 for(macStatsGrpIdx = 0; macStatsGrpIdx < macStatsModificationReq->numStatsGroup; macStatsGrpIdx++)
1750 measTypeInvalid = false;
1752 macStatsGrp = &macStatsModificationReq->statsGrpList[macStatsGrpIdx];
1754 for(macStatsIdx=0; macStatsIdx < macStatsGrp->numStats; macStatsIdx++)
1756 switch(macStatsGrp->statsList[macStatsIdx])
1758 case MAC_DL_TOTAL_PRB_USAGE:
1760 schStatsModificationReq->statsGrpList[schStatsGrpIdx].statsList[schStatsIdx] = SCH_DL_TOTAL_PRB_USAGE;
1763 case MAC_UL_TOTAL_PRB_USAGE:
1765 schStatsModificationReq->statsGrpList[schStatsGrpIdx].statsList[schStatsIdx] = SCH_UL_TOTAL_PRB_USAGE;
1770 DU_LOG("\nERROR --> MAC : MacProcStatsModificationReq: Invalid measurement type [%d]", \
1771 macStatsGrp->statsList[macStatsIdx]);
1772 measTypeInvalid = true;
1778 memset(&schStatsModificationReq->statsGrpList[schStatsGrpIdx], 0, sizeof(SchStatsGrpInfo));
1785 if(!measTypeInvalid)
1787 schStatsModificationReq->statsGrpList[schStatsGrpIdx].groupId = macStatsGrp->groupId;
1788 schStatsModificationReq->statsGrpList[schStatsGrpIdx].periodicity = macStatsGrp->periodicity;
1789 schStatsModificationReq->statsGrpList[schStatsGrpIdx].numStats = schStatsIdx;
1795 macStatsModificationRsp->statsGrpRejectedList[macStatsModificationRsp->numGrpRejected].groupId = macStatsGrp->groupId;
1796 macStatsModificationRsp->statsGrpRejectedList[macStatsModificationRsp->numGrpRejected].cause = PARAM_INVALID;
1797 macStatsModificationRsp->numGrpRejected++;
1800 schStatsModificationReq->numStatsGroup = schStatsGrpIdx;
1802 macStatsModificationRsp->subscriptionId = macStatsModificationReq->subscriptionId;
1803 if(schStatsModificationReq->numStatsGroup)
1806 macCb.statistics.numPendingStatsRsp++;
1808 FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_MODIFY_REQ_TO_SCH);
1809 ret = SchMessageRouter(&schPst, (void *)schStatsModificationReq);
1814 DU_LOG("\nERROR --> MAC : MacProcStatsModificationReq: All statistics group found invalid");
1815 MAC_FREE(schStatsModificationReq, sizeof(SchStatsModificationReq));
1816 ret = MacSendStatsModificationRspToDuApp(macStatsModificationRsp);
1819 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsModificationReq, sizeof(MacStatsModificationReq));
1823 /**********************************************************************
1825 **********************************************************************/