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 handles the cell configurtaion for MAC CL */
34 EXTERN S16 rgClBldAndSndFAPICfgReq ARGS((ClCellCb *cellCb));
36 /*******************************************************************
38 * @brief Validates CL cell configuration
42 * Function : rgClVldtCellCfg
45 * - Validates all PHY cell configuration patameters
47 * @params[in] cell config
48 * @return ROK - success
51 * ****************************************************************/
52 PRIVATE S16 rgClVldtCellCfg
61 /*******************************************************************
63 * @brief Cell configuration handler at MAC CL
67 * Function : RgClCellCfgReq
70 * -Handler for new cell addition request from du_app
72 * @params[in] cell cfg
73 * @return ROK - success
76 * ****************************************************************/
77 PUBLIC U16 RgClCellCfgReq
82 ClCellCb *cellCb = NULLP;
84 printf("\nReceived cell configuration request. Adding cellId[%d] phyCellId[%d]", cellCfg->cellId, cellCfg->phyCellId);
86 if(clGlobalCp.numOfCells >= MAX_NUM_CELL_SUPP)
88 printf("\nMaximum number of cells [%d] already configured", MAX_NUM_CELL_SUPP);
89 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
92 if(rgClVldtCellCfg(cellCfg) != ROK)
94 printf("\nCell configuration failure. Cell Id [%d]", cellCfg->cellId);
95 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
98 if((cellCb = (ClCellCb *)rgClUtlGetCellCb(cellCfg->cellId)) == NULLP)
100 if((SGetSBuf(clGlobalCp.region, clGlobalCp.pool, (Data **)&cellCb, sizeof(ClCellCb)) != ROK) || (cellCb == NULLP))
102 printf("\nFailed to allocate memory for new cell");
103 RETVALUE(LCM_REASON_MEM_NOAVAIL);
105 cmMemset((U8 *)cellCb, 0, sizeof(ClCellCb));
106 cellCb->cellId = cellCfg->cellId;
107 cellCb->phyState = PHY_STATE_IDLE;
109 if((cmHashListInsert(&(clGlobalCp.cellCbLst), (PTR)cellCb, (U8 *)&cellCb->cellId, sizeof(U16))) != ROK)
111 printf("\nFailed to insert cell into list.");
115 clGlobalCp.numOfCells++;
118 cmMemcpy((U8 *)&cellCb->cellCfg, (U8 *)cellCfg, sizeof(ClCellCfg));
120 /* Build and send CONFIG request to PHY */
121 if(rgClBldAndSndFAPICfgReq(cellCb) != ROK )
123 printf("\nrgClBldAndSndPhyCfgReq failed");
124 RETVALUE(LCM_REASON_NEG_CFM);
127 RETVALUE(LCM_REASON_NOT_APPL);
130 /**********************************************************************
132 **********************************************************************/