1 /******************************************************************************
3 * Copyright (c) 2020 Intel.
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.
17 *******************************************************************************/
23 * @author Intel Corporation
27 #include <immintrin.h>
28 #include "rte_common.h"
33 #include <rte_ethdev.h>
35 #define MAX_LINE_SIZE 512
36 /* Configuration file maximum supported line length */
38 #define KEY_APP_MODE "appMode"
39 #define KEY_XRAN_MODE "xranMode"
40 #define KEY_XRAN_TECH "xranRanTech"
41 #define KEY_MU_NUMBER "mu"
42 #define KEY_NDLABSFREPOINTA "nDLAbsFrePointA"
43 #define KEY_NULABSFREPOINTA "nULAbsFrePointA"
44 #define KEY_NDLBANDWIDTH "nDLBandwidth"
45 #define KEY_NULBANDWIDTH "nULBandwidth"
46 #define KEY_NDLFFTSIZE "nDLFftSize"
47 #define KEY_NULFFTSIZE "nULFftSize"
49 #define KEY_DU_PORT_ID_BITWIDTH "DU_Port_ID_bitwidth"
50 #define KEY_BANDSECTOR_ID_BITWIDTH "BandSector_ID_bitwidth"
51 #define KEY_CC_ID_BITWIDTH "CC_ID_bitwidth"
52 #define KEY_RU_PORT_ID_BITWIDTH "RU_Port_ID_bitwidth"
54 #define KEY_NFRAMEDUPLEXTYPE "nFrameDuplexType"
55 #define KEY_NTDDPERIOD "nTddPeriod"
57 #define KEY_SSLOTCONFIG "sSlotConfig"
59 #define KEY_XU_NUM "oXuNum"
60 #define KEY_XU_ETH_LINK_SPD "oXuEthLinkSpeed"
61 #define KEY_XU_ETH_LINE_NUM "oXuLinesNumber"
62 #define KEY_XU_CP_ON_ONE_VF "oXuCPon1Vf"
63 #define KEY_XU_RXQ_VF "oXuRxqNumber"
64 #define KEY_OWDM_INIT_EN "oXuOwdmInitEn"
65 #define KEY_OWDM_MEAS_METH "oXuOwdmMeasMeth"
66 #define KEY_OWDM_NUM_SAMPS "oXuOwdmNumSamps"
67 #define KEY_OWDM_FLTR_TYPE "oXuOwdmFltrType"
68 #define KEY_OWDM_RSP_TO "oXuOwdmRespTimeOut"
69 #define KEY_OWDM_MEAS_ST "oXuOwdmMeasState"
70 #define KEY_OWDM_MEAS_ID "oXuOwdmMeasId"
71 #define KEY_OWDM_EN "oXuOwdmEnabled"
72 #define KEY_OWDM_PL_LENGTH "oXuOwdmPlLength"
73 #define KEY_CC_PER_PORT_NUM "ccNum"
74 #define KEY_ANT_NUM "antNum"
75 #define KEY_UL_ANT_NUM "antNumUL"
77 #define KEY_ANT_ELM_TRX_NUM "antElmTRx"
79 #define KEY_MU_MIMO_UES_NUM "muMimoUEs"
80 #define KEY_DLLAYERS_PER_UE "DlLayersPerUe"
81 #define KEY_ULLAYERS_PER_UE "UlLayersPerUe"
82 #define KEY_FILE_DLBFWUE "DlBfwUe"
83 #define KEY_FILE_ULBFWUE "UlBfwUe"
85 #define KEY_FILE_O_XU_CFG "oXuCfgFile"
86 #define KEY_O_XU_PCIE_BUS "PciBusAddoXu"
87 #define KEY_O_XU_REM_MAC "oXuRem"
89 #define KEY_FILE_ULSRS "antSrsC"
92 #define KEY_TTI_PERIOD "ttiPeriod"
94 #define KEY_MTU_SIZE "MTUSize"
95 #define KEY_MAIN_CORE "mainCore"
96 #define KEY_IO_CORE "ioCore"
97 #define KEY_IO_WORKER "ioWorker"
98 #define KEY_IO_WORKER_64_127 "ioWorker_64_127"
99 #define KEY_IO_SLEEP "ioSleep"
100 #define KEY_SYSTEM_CORE "systemCore"
101 #define KEY_IOVA_MODE "iovaMode"
102 #define KEY_DPDK_MEM_SZ "dpdkMemorySize"
104 #define KEY_INSTANCE_ID "instanceId"
106 #define KEY_DU_MAC "duMac"
107 #define KEY_RU_MAC "ruMac"
109 #define KEY_FILE_NUMSLOTS "numSlots"
110 #define KEY_FILE_AxC "antC"
111 #define KEY_FILE_PRACH_AxC "antPrachC"
113 #define KEY_FILE_SLOT_TX "SlotNumTx"
114 #define KEY_FILE_SLOT_RX "SlotNumRx"
116 #define KEY_PRACH_ENABLE "rachEanble"
117 #define KEY_SRS_ENABLE "srsEanble"
118 #define KEY_PUSCH_MASK_ENABLE "puschMaskEnable"
119 #define KEY_PUSCH_MASK_SLOT "puschMaskSlot"
121 #define KEY_PRACH_CFGIDX "prachConfigIndex"
122 #define KEY_SRS_SYM_IDX "srsSym"
124 #define KEY_MAX_FRAME_ID "maxFrameId"
127 #define KEY_IQ_SWAP "iqswap"
128 #define KEY_HTONS_SWAP "nebyteorderswap"
129 #define KEY_COMPRESSION "compression"
130 #define KEY_COMP_TYPE "compType"
131 #define KEY_PRACH_COMPMETH "prachCompMethod"
132 #define KEY_PRACH_IQ "prachiqWidth"
135 #define KEY_BFW_NUM "totalBFWeights"
137 #define KEY_TADV_CP_DL "Tadv_cp_dl"
138 #define KEY_T2A_MIN_CP_DL "T2a_min_cp_dl"
139 #define KEY_T2A_MAX_CP_DL "T2a_max_cp_dl"
140 #define KEY_T2A_MIN_CP_UL "T2a_min_cp_ul"
141 #define KEY_T2A_MAX_CP_UL "T2a_max_cp_ul"
142 #define KEY_T2A_MIN_UP "T2a_min_up"
143 #define KEY_T2A_MAX_UP "T2a_max_up"
144 #define KEY_TA3_MIN "Ta3_min"
145 #define KEY_TA3_MAX "Ta3_max"
146 #define KEY_T1A_MIN_CP_DL "T1a_min_cp_dl"
147 #define KEY_T1A_MAX_CP_DL "T1a_max_cp_dl"
148 #define KEY_T1A_MIN_CP_UL "T1a_min_cp_ul"
149 #define KEY_T1A_MAX_CP_UL "T1a_max_cp_ul"
150 #define KEY_T1A_MIN_UP "T1a_min_up"
151 #define KEY_T1A_MAX_UP "T1a_max_up"
152 #define KEY_TA4_MIN "Ta4_min"
153 #define KEY_TA4_MAX "Ta4_max"
156 #define KEY_CP_ENABLE "CPenable"
157 #define KEY_CP_VTAG "c_plane_vlan_tag"
158 #define KEY_UP_VTAG "u_plane_vlan_tag"
159 #define KEY_DEBUG_STOP "debugStop"
160 #define KEY_DEBUG_STOP_CNT "debugStopCount"
161 #define KEY_BBDEV_MODE "bbdevMode"
162 #define KEY_DYNA_SEC_ENA "DynamicSectionEna"
163 #define KEY_ALPHA "Gps_Alpha"
164 #define KEY_BETA "Gps_Beta"
166 #define KEY_NPRBELEM_DL "nPrbElemDl"
167 #define KEY_PRBELEM_DL "PrbElemDl"
168 #define KEY_PRBELEM_DL_CC_M "PrbElemDlCCMask"
169 #define KEY_PRBELEM_DL_ANT_M "PrbElemDlAntCMask"
170 #define KEY_EXTBFW_DL "ExtBfwDl"
172 #define KEY_NPRBELEM_UL "nPrbElemUl"
173 #define KEY_PRBELEM_UL "PrbElemUl"
174 #define KEY_PRBELEM_UL_CC_M "PrbElemUlCCMask"
175 #define KEY_PRBELEM_UL_ANT_M "PrbElemUlAntCMask"
176 #define KEY_EXTBFW_UL "ExtBfwUl"
177 #define KEY_NPRBELEM_SRS "nPrbElemSrs"
178 #define KEY_PRBELEM_SRS "PrbElemSrs"
179 #define KEY_MAX_SEC_SYM "max_sections_per_symbol"
180 #define KEY_MAX_SEC_SLOT "max_sections_per_slot"
182 typedef int (*fillConfigStruct_fn)(void* cbPram, const char *key, const char *value);
184 struct slot_cfg_to_pars {
185 RuntimeConfig *config;
191 * Set runtime configuration parameters to their defaults.
193 * @todo Initialize missing parameters.
195 static void init_config(RuntimeConfig* config)
197 memset(config , 0, sizeof(RuntimeConfig));
201 parseFileViaCb (char *filename, fillConfigStruct_fn cbFn, void* cbParm);
203 /** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - **/
205 static void trim(char* input)
208 for (i = 0; i<strlen(input); i++)
209 if (input[i] == ' ' || input[i] == '\n' || input[i] == '\t')
214 static int fillConfigStruct(RuntimeConfig *config, const char *key, const char *value)
216 int32_t parse_res = 0;
217 static uint32_t section_idx_dl = 0;
218 static uint32_t section_idx_ul = 0;
219 static uint32_t section_idx_srs = 0;
221 if (strcmp(key, KEY_APP_MODE) == 0){
222 config->appMode = atoi(value);
223 } else if (strcmp(key, KEY_XRAN_TECH) == 0) {
224 config->xranTech = atoi(value);
225 } else if (strcmp(key, KEY_XRAN_MODE) == 0) {
226 config->xranCat = atoi(value);
227 } else if (strcmp(key, KEY_CC_PER_PORT_NUM) == 0) {
228 config->numCC= atoi(value);
229 } else if (strcmp(key, KEY_MU_NUMBER) == 0) {
230 config->mu_number= atoi(value);
231 printf("mu_number: %d\n",config->mu_number);
232 } else if (strcmp(key, KEY_NDLABSFREPOINTA) == 0) {
233 config->nDLAbsFrePointA = atoi(value);
234 printf("nDLAbsFrePointA: %d\n",config->nDLAbsFrePointA);
235 } else if (strcmp(key, KEY_NULABSFREPOINTA) == 0) {
236 config->nULAbsFrePointA = atoi(value);
237 printf("nULAbsFrePointA: %d\n",config->nULAbsFrePointA);
238 } else if (strcmp(key, KEY_NDLBANDWIDTH) == 0) {
239 config->nDLBandwidth = atoi(value);
240 printf("nDLBandwidth: %d\n",config->nDLBandwidth);
241 } else if (strcmp(key, KEY_NULBANDWIDTH) == 0) {
242 config->nULBandwidth = atoi(value);
243 printf("nULBandwidth: %d\n",config->nULBandwidth);
244 } else if (strcmp(key, KEY_NDLFFTSIZE) == 0) {
245 config->nDLFftSize = atoi(value);
246 printf("nDLFftSize: %d\n",config->nDLFftSize);
247 } else if (strcmp(key, KEY_NULFFTSIZE) == 0) {
248 config->nULFftSize = atoi(value);
249 printf("nULFftSize: %d\n",config->nULFftSize);
250 } else if (strcmp(key, KEY_NFRAMEDUPLEXTYPE) == 0) {
251 config->nFrameDuplexType = atoi(value);
252 printf("nFrameDuplexType: %d\n",config->nFrameDuplexType);
253 } else if (strcmp(key, KEY_DU_PORT_ID_BITWIDTH) == 0) {
254 config->DU_Port_ID_bitwidth = atoi(value);
255 printf("DU_Port_ID_bitwidth: %d\n",config->DU_Port_ID_bitwidth);
256 } else if (strcmp(key, KEY_BANDSECTOR_ID_BITWIDTH) == 0) {
257 config->BandSector_ID_bitwidth = atoi(value);
258 printf("BandSector_ID_bitwidth: %d\n",config->BandSector_ID_bitwidth);
259 } else if (strcmp(key, KEY_CC_ID_BITWIDTH) == 0) {
260 config->CC_ID_bitwidth = atoi(value);
261 printf("CC_ID_bitwidth: %d\n",config->CC_ID_bitwidth);
262 } else if (strcmp(key, KEY_RU_PORT_ID_BITWIDTH) == 0) {
263 config->RU_Port_ID_bitwidth = atoi(value);
264 printf("RU_Port_ID_bitwidth: %d\n",config->RU_Port_ID_bitwidth);
265 } else if (strcmp(key, KEY_NTDDPERIOD) == 0) {
266 config->nTddPeriod = atoi(value);
267 printf("nTddPeriod: %d\n",config->nTddPeriod);
268 if (config->nTddPeriod > XRAN_MAX_TDD_PERIODICITY)
270 printf("nTddPeriod is larger than max allowed, invalid!\n");
271 config->nTddPeriod = XRAN_MAX_TDD_PERIODICITY;
273 } else if (strncmp(key, KEY_SSLOTCONFIG, strlen(KEY_SSLOTCONFIG)) == 0) {
274 unsigned int slot_num = 0;
276 sscanf(key,"sSlotConfig%u",&slot_num);
277 if (slot_num >= config->nTddPeriod){
278 printf("slot_num %d exceeds TddPeriod\n",slot_num);
281 sscanf(value, "%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx",
282 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[0],
283 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[1],
284 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[2],
285 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[3],
286 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[4],
287 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[5],
288 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[6],
289 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[7],
290 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[8],
291 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[9],
292 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[10],
293 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[11],
294 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[12],
295 (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[13]);
296 printf("sSlotConfig%d: ",slot_num);
297 for (i = 0; i< 14; i++){
298 printf("%d ",config->sSlotConfig[slot_num].nSymbolType[i]);
302 } else if (strcmp(key, KEY_ANT_NUM) == 0) {
303 config->numAxc = atoi(value);
304 } else if (strcmp(key, KEY_UL_ANT_NUM) == 0) {
305 config->numUlAxc = atoi(value);
306 }else if (strcmp(key, KEY_ANT_ELM_TRX_NUM) == 0) {
307 config->antElmTRx = atoi(value);
308 printf("antElmTRx %d\n", config->antElmTRx);
309 } else if (strcmp(key, KEY_MU_MIMO_UES_NUM) == 0) {
310 config->muMimoUEs = atoi(value);
311 } else if (strcmp(key, KEY_DLLAYERS_PER_UE) == 0) {
312 config->DlLayersPerUe = atoi(value);
313 } else if (strcmp(key, KEY_ULLAYERS_PER_UE) == 0) {
314 config->UlLayersPerUe = atoi(value);
315 } else if (strcmp(key, KEY_TTI_PERIOD) == 0) {
316 config->ttiPeriod = atoi(value);
317 } else if (strcmp(key, KEY_IQ_SWAP) == 0) {
318 config->iqswap = atoi(value);
319 } else if (strcmp(key, KEY_HTONS_SWAP) == 0) {
320 config->nebyteorderswap = atoi(value);
321 } else if (strcmp(key, KEY_COMPRESSION) == 0) {
322 config->compression = atoi(value);
323 } else if (strcmp(key, KEY_COMP_TYPE) == 0) {
324 config->CompHdrType = atoi(value);
325 } else if (strcmp(key, KEY_PRACH_COMPMETH) == 0) {
326 config->prachCompMethod = atoi(value);
327 } else if (strcmp(key, KEY_PRACH_IQ) == 0) {
328 config->prachiqWidth = atoi(value);
329 } else if (strcmp(key, KEY_MTU_SIZE) == 0) {
330 config->mtu = atoi(value);
331 printf("mtu %d\n", config->mtu);
332 } else if (strcmp(key, KEY_IO_SLEEP) == 0) {
333 config->io_sleep = atoi(value);
334 printf("io_sleep %d \n", config->io_sleep);
335 } else if (strcmp(key, KEY_IO_CORE) == 0) {
336 config->io_core = atoi(value);
337 printf("io_core %d [core id]\n", config->io_core);
338 } else if (strcmp(key, KEY_MAIN_CORE) == 0) {
339 config->io_core = atoi(value);
340 printf("io_core %d [core id]\n", config->io_core);
341 } else if (strcmp(key, KEY_IO_WORKER) == 0) {
342 config->io_worker = strtoll(value, NULL, 0);
343 printf("io_worker 0x%lx [mask]\n", config->io_worker);
344 } else if (strcmp(key, KEY_IO_WORKER_64_127) == 0) {
345 config->io_worker_64_127 = strtoll(value, NULL, 0);
346 printf("io_worker_64_127 0x%lx [mask]\n", config->io_worker_64_127);
347 } else if (strcmp(key, KEY_SYSTEM_CORE) == 0) {
348 config->system_core = atoi(value);
349 printf("system core %d [core id]\n", config->system_core);
350 } else if (strcmp(key, KEY_IOVA_MODE) == 0) {
351 config->iova_mode = atoi(value);
352 printf("iova_mode %d\n", config->iova_mode);
353 } else if (strcmp(key, KEY_INSTANCE_ID) == 0) {
354 config->instance_id = atoi(value);
355 printf("instance_id %d\n", config->instance_id);
356 } else if (strncmp(key, KEY_DU_MAC, strlen(KEY_DU_MAC)) == 0) {
357 unsigned int vf_num = 0;
358 sscanf(key,"duMac%02u",&vf_num);
359 if (vf_num >= XRAN_VF_MAX) {
360 printf("duMac%d exceeds max antenna supported\n",vf_num);
362 printf("duMac%d: %s\n",vf_num, value);
363 sscanf(value, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[0],
364 (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[1],
365 (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[2],
366 (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[3],
367 (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[4],
368 (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[5]);
370 printf("[vf %d]O-DU MAC address: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
372 config->o_du_addr[vf_num].addr_bytes[0],
373 config->o_du_addr[vf_num].addr_bytes[1],
374 config->o_du_addr[vf_num].addr_bytes[2],
375 config->o_du_addr[vf_num].addr_bytes[3],
376 config->o_du_addr[vf_num].addr_bytes[4],
377 config->o_du_addr[vf_num].addr_bytes[5]);
379 } else if (strncmp(key, KEY_RU_MAC, strlen(KEY_RU_MAC)) == 0) {
380 unsigned int vf_num = 0;
381 sscanf(key,"ruMac%02u",&vf_num);
382 if (vf_num >= XRAN_VF_MAX) {
383 printf("ruMac%d exceeds max antenna supported\n",vf_num);
385 printf("ruMac%d: %s\n",vf_num, value);
387 sscanf(value, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[0],
388 (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[1],
389 (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[2],
390 (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[3],
391 (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[4],
392 (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[5]);
394 printf("[vf %d]RU MAC address: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
396 config->o_ru_addr[vf_num].addr_bytes[0],
397 config->o_ru_addr[vf_num].addr_bytes[1],
398 config->o_ru_addr[vf_num].addr_bytes[2],
399 config->o_ru_addr[vf_num].addr_bytes[3],
400 config->o_ru_addr[vf_num].addr_bytes[4],
401 config->o_ru_addr[vf_num].addr_bytes[5]);
403 } else if (strcmp(key, KEY_FILE_NUMSLOTS) == 0) {
404 config->numSlots = atoi(value);
405 printf("numSlots: %d\n",config->numSlots);
406 }else if (strncmp(key, KEY_FILE_AxC, strlen(KEY_FILE_AxC)) == 0) {
407 unsigned int ant_num = 0;
408 sscanf(key,"antC%02u",&ant_num);
409 if (ant_num >= MAX_ANT_CARRIER_SUPPORTED) {
410 printf("antC%d exceeds max antenna supported\n",ant_num);
412 strncpy(&config->ant_file[ant_num][0], value, strlen(value));
413 printf("antC%d: %s\n",ant_num, config->ant_file[ant_num]);
415 } else if (strncmp(key, KEY_FILE_DLBFWUE, strlen(KEY_FILE_DLBFWUE)) == 0) {
416 unsigned int ue_num = 0;
417 sscanf(key,"DlBfwUe%02u",&ue_num);
418 if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) {
419 printf("DlBfwUe%d exceeds max streams supported\n",ue_num);
421 strncpy(&config->dl_bfw_file[ue_num][0], value, strlen(value));
422 printf("DlBfwUe%d: %s\n",ue_num, config->dl_bfw_file[ue_num]);
424 }else if (strncmp(key, KEY_FILE_ULBFWUE, strlen(KEY_FILE_ULBFWUE)) == 0) {
425 unsigned int ue_num = 0;
426 sscanf(key,"UlBfwUe%02u",&ue_num);
427 if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) {
428 printf("UlBfwUe%d exceeds max streams supported\n",ue_num);
430 strncpy(&config->ul_bfw_file[ue_num][0], value, strlen(value));
431 printf("UlBfwUe%d: %s\n",ue_num, config->ul_bfw_file[ue_num]);
433 }else if (strncmp(key, KEY_FILE_ULSRS, strlen(KEY_FILE_ULSRS)) == 0) {
434 unsigned int srs_ant = 0;
435 sscanf(key,"antSrsC%02u",&srs_ant);
436 if (srs_ant >= MAX_ANT_CARRIER_SUPPORTED_CAT_B) {
437 printf("antSrsC%d exceeds max ant elemnets supported [%d]\n", srs_ant, MAX_ANT_CARRIER_SUPPORTED_CAT_B);
439 strncpy(&config->ul_srs_file[srs_ant][0], value, strlen(value));
440 printf("antSrsC%d: %s\n",srs_ant, config->ul_srs_file[srs_ant]);
442 } else if (strncmp(key, KEY_FILE_SLOT_TX, strlen(KEY_FILE_SLOT_TX)) == 0) {
443 unsigned int slot_num = 0;
444 unsigned int direction = XRAN_DIR_DL;
445 sscanf(key,"SlotNumTx%02u",&slot_num);
446 if (slot_num >= XRAN_N_FE_BUF_LEN) {
447 printf("SlotNumTx%d exceeds max slots supported\n",slot_num);
449 config->SlotNum_fileEnabled = 1;
450 strncpy(&config->SlotNum_file[direction][slot_num][0], value, strlen(value));
451 printf("SlotNumTx%d: %s\n",slot_num, config->SlotNum_file[direction][slot_num]);
453 }else if (strncmp(key, KEY_FILE_SLOT_RX, strlen(KEY_FILE_SLOT_RX)) == 0) {
454 unsigned int slot_num = 0;
455 unsigned int direction = XRAN_DIR_UL;
456 sscanf(key,"SlotNumRx%02u",&slot_num);
457 if (slot_num >= XRAN_N_FE_BUF_LEN) {
458 printf("SlotNumRx%d exceeds max slots supported\n",slot_num);
460 config->SlotNum_fileEnabled = 1;
461 strncpy(&config->SlotNum_file[direction][slot_num][0], value, strlen(value));
462 printf("SlotNumRx%d: %s\n",slot_num, config->SlotNum_file[direction][slot_num]);
464 } else if (strcmp(key, KEY_PRACH_ENABLE) == 0) {
465 config->enablePrach = atoi(value);
466 printf("Prach enable: %d\n",config->enablePrach);
467 }else if (strcmp(key, KEY_MAX_FRAME_ID) == 0) {
468 config->maxFrameId = atoi(value);
469 printf("maxFrameId: %d\n",config->maxFrameId);
470 } else if (strcmp(key, KEY_SRS_ENABLE) == 0) {
471 config->enableSrs = atoi(value);
472 printf("Srs enable: %d\n",config->enableSrs);
473 } else if (strcmp(key, KEY_PUSCH_MASK_ENABLE) == 0) {
474 config->puschMaskEnable = atoi(value);
475 printf("PUSCH mask enable: %d\n",config->puschMaskEnable);
476 } else if (strcmp(key, KEY_PUSCH_MASK_SLOT) == 0) {
477 config->puschMaskSlot = atoi(value);
478 printf("PUSCH mask enable: %d\n",config->puschMaskSlot);
479 } else if (strcmp(key, KEY_PRACH_CFGIDX) == 0) {
480 config->prachConfigIndex = atoi(value);
481 printf("Prach config index: %d\n",config->prachConfigIndex);
482 } else if (strcmp(key, KEY_SRS_SYM_IDX) == 0) {
483 config->srsSymMask = atoi(value);
484 printf("Srs symbol [0-13]: %d\n",config->srsSymMask);
485 } else if (strncmp(key, KEY_FILE_PRACH_AxC, strlen(KEY_FILE_PRACH_AxC)) == 0) {
486 unsigned int ant_num = 0;
487 sscanf(key,"antPrachC%02u",&ant_num);
488 if (ant_num >= MAX_ANT_CARRIER_SUPPORTED)
490 printf("antC%d exceeds max antenna supported\n",ant_num);
493 strncpy(&config->prach_file[ant_num][0], value, strlen(value));
494 printf("antPrachC%d: %s\n",ant_num, config->prach_file[ant_num]);
496 } else if (strcmp(key, KEY_BFW_NUM) == 0) {
497 config->totalBfWeights = atoi(value);
498 printf("%s : %d\n",KEY_BFW_NUM, config->totalBfWeights);
500 } else if (strcmp(key, KEY_TADV_CP_DL ) == 0) {
501 config->Tadv_cp_dl = atoi(value);
502 printf("Tadv_cp_dl: %d\n",config->Tadv_cp_dl);
503 } else if (strcmp(key, KEY_T2A_MIN_CP_DL ) == 0) {
504 config->T2a_min_cp_dl = atoi(value);
505 printf("T2a_min_cp_dl: %d\n",config->T2a_min_cp_dl);
506 } else if (strcmp(key, KEY_T2A_MAX_CP_DL ) == 0) {
507 config->T2a_max_cp_dl = atoi(value);
508 printf("T2a_max_cp_dl: %d\n",config->T2a_max_cp_dl);
509 } else if (strcmp(key, KEY_T2A_MIN_CP_UL ) == 0) {
510 config->T2a_min_cp_ul = atoi(value);
511 printf("T2a_min_cp_ul: %d\n",config->T2a_min_cp_ul);
512 } else if (strcmp(key, KEY_T2A_MAX_CP_UL ) == 0) {
513 config->T2a_max_cp_ul = atoi(value);
514 printf("T2a_max_cp_ul: %d\n",config->T2a_max_cp_ul);
515 } else if (strcmp(key, KEY_T2A_MIN_UP ) == 0) {
516 config->T2a_min_up = atoi(value);
517 printf("T2a_min_up: %d\n",config->T2a_min_up);
518 } else if (strcmp(key, KEY_T2A_MAX_UP ) == 0) {
519 config->T2a_max_up = atoi(value);
520 printf("T2a_max_up: %d\n",config->T2a_max_up);
521 } else if (strcmp(key, KEY_TA3_MIN ) == 0) {
522 config->Ta3_min = atoi(value);
523 printf("Ta3_min: %d\n",config->Ta3_min);
524 } else if (strcmp(key, KEY_TA3_MAX ) == 0) {
525 config->Ta3_max = atoi(value);
526 printf("Ta3_max: %d\n",config->Ta3_max);
527 } else if (strcmp(key, KEY_T1A_MIN_CP_DL ) == 0) {
528 config->T1a_min_cp_dl = atoi(value);
529 printf("T1a_min_cp_dl: %d\n",config->T1a_min_cp_dl);
530 } else if (strcmp(key, KEY_T1A_MAX_CP_DL ) == 0) {
531 config->T1a_max_cp_dl = atoi(value);
532 printf("T1a_max_cp_dl: %d\n",config->T1a_max_cp_dl);
533 } else if (strcmp(key, KEY_T1A_MIN_CP_UL ) == 0) {
534 config->T1a_min_cp_ul = atoi(value);
535 printf("T1a_min_cp_ul: %d\n",config->T1a_min_cp_ul);
536 } else if (strcmp(key, KEY_T1A_MAX_CP_UL ) == 0) {
537 config->T1a_max_cp_ul = atoi(value);
538 printf("T1a_max_cp_ul: %d\n",config->T1a_max_cp_ul);
539 } else if (strcmp(key, KEY_T1A_MIN_UP ) == 0) {
540 config->T1a_min_up = atoi(value);
541 printf("T1a_min_up: %d\n",config->T1a_min_up);
542 } else if (strcmp(key, KEY_T1A_MAX_UP ) == 0) {
543 config->T1a_max_up = atoi(value);
544 printf("T1a_max_up: %d\n",config->T1a_max_up);
545 } else if (strcmp(key, KEY_TA4_MIN ) == 0) {
546 config->Ta4_min = atoi(value);
547 printf("Ta4_min: %d\n",config->Ta4_min);
548 } else if (strcmp(key, KEY_TA4_MAX ) == 0) {
549 config->Ta4_max = atoi(value);
550 printf("Ta4_max: %d\n",config->Ta4_max);
552 } else if (strcmp(key, KEY_CP_ENABLE ) == 0) {
553 config->enableCP = atoi(value);
554 printf("CPenable: %d\n",config->enableCP);
555 } else if (strcmp(key, KEY_DEBUG_STOP ) == 0) {
556 config->debugStop = atoi(value);
557 printf("debugStop: %d\n",config->debugStop);
558 } else if (strcmp(key, KEY_DEBUG_STOP_CNT) == 0) {
559 config->debugStopCount = atoi(value);
560 printf("debugStopCount: %d\n",config->debugStopCount);
561 } else if (strcmp(key, KEY_BBDEV_MODE) == 0) {
562 config->bbdevMode = atoi(value);
563 printf("bbdevMode: %d\n",config->debugStopCount);
564 } else if (strcmp(key, KEY_DYNA_SEC_ENA) == 0) {
565 config->DynamicSectionEna = atoi(value);
566 printf("DynamicSectionEna: %d\n",config->DynamicSectionEna);
567 } else if (strcmp(key, KEY_ALPHA) == 0) {
568 config->GPS_Alpha = atoi(value);
569 printf("GPS_Alpha: %d\n",config->GPS_Alpha);
570 } else if (strcmp(key, KEY_BETA) == 0) {
571 config->GPS_Beta = atoi(value);
572 printf("GPS_Beta: %d\n",config->GPS_Beta);
573 } else if (strcmp(key, KEY_CP_VTAG ) == 0) {
574 config->cp_vlan_tag = atoi(value);
575 printf("cp_vlan_tag: %d\n",config->cp_vlan_tag);
576 } else if (strcmp(key, KEY_UP_VTAG ) == 0) {
577 config->up_vlan_tag = atoi(value);
578 printf("up_vlan_tag: %d\n",config->up_vlan_tag);
579 } else if (strcmp(key, KEY_MAX_SEC_SYM ) == 0) {
580 config->max_sections_per_symbol = atoi(value);
581 printf("max_sections_per_symbol: %d\n",config->max_sections_per_symbol);
582 } else if (strcmp(key, KEY_MAX_SEC_SLOT ) == 0) {
583 config->max_sections_per_slot = atoi(value);
584 printf("max_sections_per_slot: %d\n",config->max_sections_per_slot);
585 } else if (strcmp(key, KEY_NPRBELEM_UL ) == 0) {
586 config->p_PrbMapUl->nPrbElm = atoi(value);
587 if (config->p_PrbMapUl->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
589 printf("nTddPeriod is larger than max allowed, invalid!\n");
590 config->p_PrbMapUl->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
592 printf("nPrbElemUl: %d\n",config->p_PrbMapUl->nPrbElm);
593 } else if (strncmp(key, KEY_PRBELEM_UL, strlen(KEY_PRBELEM_UL)) == 0) {
594 sscanf(key,"PrbElemUl%u",§ion_idx_ul);
595 if (section_idx_ul >= config->p_PrbMapUl->nPrbElm){
596 printf("section_idx %d exceeds nPrbElemUl\n",section_idx_ul);
599 struct xran_prb_elm *pPrbElem = &config->p_PrbMapUl->prbMap[section_idx_ul];
600 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
601 (int16_t*)&pPrbElem->nRBStart,
602 (int16_t*)&pPrbElem->nRBSize,
603 (int16_t*)&pPrbElem->nStartSymb,
604 (int16_t*)&pPrbElem->numSymb,
605 (int16_t*)&pPrbElem->nBeamIndex,
606 (int16_t*)&pPrbElem->bf_weight_update,
607 (int16_t*)&pPrbElem->compMethod,
608 (int16_t*)&pPrbElem->iqWidth,
609 (int16_t*)&pPrbElem->BeamFormingType);
610 printf("nPrbElemUl%d: ",section_idx_ul);
611 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
612 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
614 } else if(strncmp(key, KEY_EXTBFW_UL, strlen(KEY_EXTBFW_UL)) == 0) {
615 sscanf(key, "ExtBfwUl%u", §ion_idx_ul);
616 if(section_idx_ul >= config->p_PrbMapUl->nPrbElm) {
617 printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx_ul);
620 struct xran_prb_elm *pPrbElem = &config->p_PrbMapUl->prbMap[section_idx_ul];
621 sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
622 (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
623 (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
624 (uint8_t*)&pPrbElem->bf_weight.RAD,
625 (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
626 (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
627 (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
628 printf(KEY_EXTBFW_UL"%d: ", section_idx_ul);
629 printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
630 pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
632 }else if (strcmp(key, KEY_NPRBELEM_DL ) == 0) {
633 config->p_PrbMapDl->nPrbElm = atoi(value);
634 if (config->p_PrbMapDl->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
636 printf("nPrbElm is larger than max allowed, invalid!\n");
637 config->p_PrbMapDl->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
639 printf("nPrbElemDl: %d\n",config->p_PrbMapDl->nPrbElm);
640 } else if (strncmp(key, KEY_PRBELEM_DL, strlen(KEY_PRBELEM_DL)) == 0) {
641 sscanf(key,"PrbElemDl%u",§ion_idx_dl);
642 if (section_idx_dl >= config->p_PrbMapDl->nPrbElm){
643 printf("section_idx %d exceeds nPrbElemDl\n",section_idx_dl);
646 struct xran_prb_elm *pPrbElem = &config->p_PrbMapDl->prbMap[section_idx_dl];
647 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
648 (int16_t*)&pPrbElem->nRBStart,
649 (int16_t*)&pPrbElem->nRBSize,
650 (int16_t*)&pPrbElem->nStartSymb,
651 (int16_t*)&pPrbElem->numSymb,
652 (int16_t*)&pPrbElem->nBeamIndex,
653 (int16_t*)&pPrbElem->bf_weight_update,
654 (int16_t*)&pPrbElem->compMethod,
655 (int16_t*)&pPrbElem->iqWidth,
656 (int16_t*)&pPrbElem->BeamFormingType,
657 (int16_t*)&pPrbElem->ScaleFactor,
658 (int16_t*)&pPrbElem->reMask);
659 printf("nPrbElemDl%d: ",section_idx_dl);
660 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d ScaleFactor %d reMask %d\n",
661 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType, pPrbElem->ScaleFactor, pPrbElem->reMask);
663 } else if(strncmp(key, KEY_EXTBFW_DL, strlen(KEY_EXTBFW_DL)) == 0) {
664 sscanf(key, "ExtBfwDl%u", §ion_idx_dl);
665 if(section_idx_dl >= config->p_PrbMapDl->nPrbElm) {
666 printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx_dl);
669 struct xran_prb_elm *pPrbElem = &config->p_PrbMapDl->prbMap[section_idx_dl];
670 sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
671 (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
672 (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
673 (uint8_t*)&pPrbElem->bf_weight.RAD,
674 (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
675 (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
676 (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
677 printf(KEY_EXTBFW_DL"%d: ", section_idx_dl);
678 printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
679 pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
681 } else if (strcmp(key, KEY_NPRBELEM_SRS ) == 0) {
682 config->p_PrbMapSrs->nPrbElm = atoi(value);
683 if (config->p_PrbMapSrs->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
685 printf("nPrbElm is larger than max allowed, invalid!\n");
686 config->p_PrbMapSrs->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
688 printf("nPrbElemSrs: %d\n",config->p_PrbMapSrs->nPrbElm);
689 } else if (strncmp(key, KEY_PRBELEM_SRS, strlen(KEY_PRBELEM_SRS)) == 0) {
690 sscanf(key,"PrbElemSrs%u",§ion_idx_srs);
691 if (section_idx_srs >= config->p_PrbMapSrs->nPrbElm) {
692 printf("section_idx %d exceeds nPrbElemSrs\n",section_idx_srs);
694 struct xran_prb_elm *pPrbElem = &config->p_PrbMapSrs->prbMap[section_idx_srs];
695 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
696 (int16_t*)&pPrbElem->nRBStart,
697 (int16_t*)&pPrbElem->nRBSize,
698 (int16_t*)&pPrbElem->nStartSymb,
699 (int16_t*)&pPrbElem->numSymb,
700 (int16_t*)&pPrbElem->nBeamIndex,
701 (int16_t*)&pPrbElem->bf_weight_update,
702 (int16_t*)&pPrbElem->compMethod,
703 (int16_t*)&pPrbElem->iqWidth,
704 (int16_t*)&pPrbElem->BeamFormingType);
705 printf("nPrbElemSrs%d: ",section_idx_srs);
706 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
707 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
710 printf("Unsupported configuration key [%s]\n", key);
718 fillUsecaseStruct(UsecaseConfig *config, const char *key, const char *value)
720 int32_t parse_res = 0;
721 if (strcmp(key, KEY_APP_MODE) == 0){
722 config->appMode = atoi(value);
723 printf("appMode %d \n", config->appMode);
724 } else if (strcmp(key, KEY_XU_NUM) == 0){
725 config->oXuNum = atoi(value);
726 printf("oXuNum %d \n", config->oXuNum);
727 } else if (strcmp(key, KEY_XU_ETH_LINK_SPD) == 0){
728 config->EthLinkSpeed = atoi(value);
729 printf("EthLinkSpeed %d \n", config->EthLinkSpeed);
730 } else if (strcmp(key, KEY_XU_ETH_LINE_NUM) == 0){
731 config->EthLinesNumber = atoi(value);
732 printf("EthLinkSpeed %d \n", config->EthLinesNumber);
733 } else if (strcmp(key, KEY_XU_RXQ_VF) == 0){
734 config->num_rxq = atoi(value);
735 printf("oXuRxqNumber %d \n", config->num_rxq);
736 } else if (strcmp(key, KEY_XU_CP_ON_ONE_VF) == 0) {
737 config->one_vf_cu_plane = atoi(value);
738 printf("oXuCPon1Vf %d \n", config->one_vf_cu_plane);
739 } else if (strcmp(key, KEY_IO_SLEEP) == 0) {
740 config->io_sleep = atoi(value);
741 printf("io_sleep %d \n", config->io_sleep);
742 } else if (strcmp(key, KEY_IO_CORE) == 0) {
743 config->io_core = atoi(value);
744 printf("io_core %d [core id]\n", config->io_core);
745 } else if (strcmp(key, KEY_MAIN_CORE) == 0) {
746 config->main_core = atoi(value);
747 printf("main_core %d [core id]\n", config->main_core);
748 } else if (strcmp(key, KEY_IO_WORKER) == 0) {
749 config->io_worker = strtoll(value, NULL, 0);
750 printf("io_worker 0x%lx [mask]\n", config->io_worker);
751 } else if (strcmp(key, KEY_IO_WORKER_64_127) == 0) {
752 config->io_worker_64_127 = strtoll(value, NULL, 0);
753 printf("io_worker_64_127 0x%lx [mask]\n", config->io_worker_64_127);
754 } else if (strcmp(key, KEY_SYSTEM_CORE) == 0) {
755 config->system_core = atoi(value);
756 printf("system core %d [core id]\n", config->system_core);
757 } else if (strcmp(key, KEY_IOVA_MODE) == 0) {
758 config->iova_mode = atoi(value);
759 printf("iova_mode %d\n", config->iova_mode);
760 } else if (strcmp(key, KEY_DPDK_MEM_SZ) == 0) {
761 config->dpdk_mem_sz = atoi(value);
762 printf("dpdk_mem_sz %d\n", config->dpdk_mem_sz);
763 } else if (strcmp(key, KEY_INSTANCE_ID) == 0) {
764 config->instance_id = atoi(value);
765 printf("instance_id %d\n", config->instance_id);
766 }else if (strncmp(key, KEY_FILE_O_XU_CFG, strlen(KEY_FILE_O_XU_CFG)) == 0) {
767 unsigned int o_xu_id = 0;
768 sscanf(key,"oXuCfgFile%02u",&o_xu_id);
769 if (o_xu_id >= XRAN_PORTS_NUM) {
770 printf("oXuCfgFile%d exceeds max O-XU supported\n",o_xu_id);
772 strncpy(&config->o_xu_cfg_file[o_xu_id][0], value, strlen(value));
773 printf("oXuCfgFile%d: %s\n",o_xu_id, config->o_xu_cfg_file[o_xu_id]);
775 } else if (strncmp(key, KEY_OWDM_INIT_EN, strlen(KEY_OWDM_INIT_EN)) == 0) {
776 config->owdmInitEn = atoi(value);
777 printf("owdmInitEn %d\n", config->owdmInitEn);
778 } else if (strncmp(key, KEY_OWDM_MEAS_METH, strlen(KEY_OWDM_MEAS_METH)) == 0) {
779 config->owdmMeasMeth = atoi(value);
780 printf("owdmMeasMeth %d\n", config->owdmMeasMeth);
781 } else if (strncmp(key, KEY_OWDM_NUM_SAMPS, strlen(KEY_OWDM_NUM_SAMPS)) == 0) {
782 config->owdmNumSamps = atoi(value);
783 printf("owdmNumSamps %d\n", config->owdmNumSamps);
784 } else if (strncmp(key, KEY_OWDM_FLTR_TYPE, strlen(KEY_OWDM_FLTR_TYPE)) == 0) {
785 config->owdmFltType = atoi(value);
786 printf("owdmFltType %d\n", config->owdmFltType);
787 } else if (strncmp(key, KEY_OWDM_RSP_TO, strlen(KEY_OWDM_RSP_TO)) == 0) {
788 config->owdmRspTo = atol(value);
789 printf("owdmRspTo %lu\n", config->owdmRspTo);
790 } else if (strncmp(key, KEY_OWDM_MEAS_ID, strlen(KEY_OWDM_MEAS_ID)) == 0) {
791 config->owdmMeasId = atoi(value);
792 printf("owdmMeasId %d\n", config->owdmMeasId);
793 } else if (strncmp(key, KEY_OWDM_EN, strlen(KEY_OWDM_EN)) == 0) {
794 config->owdmEnable = atoi(value);
795 printf("owdmEnable %d\n", config->owdmEnable);
796 } else if (strncmp(key, KEY_OWDM_PL_LENGTH, strlen(KEY_OWDM_PL_LENGTH)) == 0) {
797 config->owdmPlLength = atoi(value);
798 printf("owdmPlLength %d\n", config->owdmPlLength);
799 } else if (strncmp(key, KEY_OWDM_MEAS_ST, strlen(KEY_OWDM_MEAS_ST)) == 0) {
800 config->owdmMeasState = atoi(value);
801 printf("owdmMeasState %d\n", config->owdmMeasState);
802 } else if (strncmp(key, KEY_O_XU_PCIE_BUS, strlen(KEY_O_XU_PCIE_BUS)) == 0) {
803 unsigned int o_xu_id = 0;
804 unsigned int vf_num = 0;
805 sscanf(key,"PciBusAddoXu%02uVf%02u",&o_xu_id, &vf_num);
806 if (o_xu_id >= XRAN_PORTS_NUM || vf_num >= XRAN_VF_MAX){
807 printf("PciBusAddoXu%dVf%d exceeds max O-XU supported\n",o_xu_id, vf_num);
809 strncpy(&config->o_xu_pcie_bus_addr[o_xu_id][vf_num][0], value, strlen(value));
810 printf("PciBusAddoXu%dVf%d: %s\n",o_xu_id, vf_num, &config->o_xu_pcie_bus_addr[o_xu_id][vf_num][0]);
812 } else if (strncmp(key, KEY_O_XU_REM_MAC, strlen(KEY_O_XU_REM_MAC)) == 0) {
813 unsigned int xu_num = 0;
814 unsigned int vf_num = 0;
816 sscanf(key,"oXuRem%02uMac%02u",&xu_num, &vf_num);
818 if (xu_num >= XRAN_PORTS_NUM || vf_num >= XRAN_VF_MAX) {
819 printf("oXuRem%02uMac%02u exceeds max supported\n",xu_num, vf_num);
821 printf("oXuRem%02uMac%02u: %s\n",xu_num, vf_num, value);
822 sscanf(value, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[0],
823 (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[1],
824 (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[2],
825 (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[3],
826 (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[4],
827 (uint8_t*)&config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[5]);
829 printf("[xu %d vf %d]RU MAC address: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
832 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[0],
833 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[1],
834 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[2],
835 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[3],
836 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[4],
837 config->remote_o_xu_addr[xu_num][vf_num].addr_bytes[5]);
840 printf("Unsupported configuration key [%s]\n", key);
848 fillSlotStructAsCb(void* cbParam, const char *key, const char *value)
850 struct slot_cfg_to_pars *p_slot_cfg = (struct slot_cfg_to_pars*) cbParam;
851 RuntimeConfig *config = p_slot_cfg->config;
852 int32_t direction = p_slot_cfg->direction;
853 int32_t slot_idx = p_slot_cfg->slot_idx;
854 uint32_t section_idx = 0;
856 //printf("Dir %d slot %d\n", direction, slot_idx);
858 if (strcmp(key, KEY_NPRBELEM_UL ) == 0) {
859 config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = atoi(value);
860 if (config->p_SlotPrbMap[direction][slot_idx]->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
862 printf("nTddPeriod is larger than max allowed, invalid!\n");
863 config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
865 printf("nPrbElemUl: %d\n",config->p_SlotPrbMap[direction][slot_idx]->nPrbElm );
866 } else if (strncmp(key, KEY_PRBELEM_UL_ANT_M, strlen(KEY_PRBELEM_UL_ANT_M)) == 0) {
867 sscanf(key,"PrbElemUlAntCMask%u",§ion_idx);
868 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
869 printf("section_idx %d exceeds nPrbElemul\n",section_idx);
872 sscanf(value, "%lx",(uint64_t*)&config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
873 printf("%s%u 0x%lx\n",KEY_PRBELEM_UL_ANT_M, section_idx, config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
875 } else if (strncmp(key, KEY_PRBELEM_UL_CC_M, strlen(KEY_PRBELEM_UL_CC_M)) == 0) {
876 sscanf(key,"PrbElemUlCCMask%u",§ion_idx);
877 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
878 printf("section_idx %d exceeds nPrbElemUL\n",section_idx);
881 sscanf(value, "%02hx",(uint16_t*)&config->SlotPrbCCmask[direction][slot_idx][section_idx]);
882 printf("%s%u 0x%02x\n",KEY_PRBELEM_UL_CC_M, section_idx, config->SlotPrbCCmask[direction][slot_idx][section_idx]);
884 } else if (strncmp(key, KEY_PRBELEM_UL, strlen(KEY_PRBELEM_UL)) == 0) {
885 sscanf(key,"PrbElemUl%u",§ion_idx);
886 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
887 printf("section_idx %d exceeds nPrbElemUl\n",section_idx);
890 struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
891 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
892 (int16_t*)&pPrbElem->nRBStart,
893 (int16_t*)&pPrbElem->nRBSize,
894 (int16_t*)&pPrbElem->nStartSymb,
895 (int16_t*)&pPrbElem->numSymb,
896 (int16_t*)&pPrbElem->nBeamIndex,
897 (int16_t*)&pPrbElem->bf_weight_update,
898 (int16_t*)&pPrbElem->compMethod,
899 (int16_t*)&pPrbElem->iqWidth,
900 (int16_t*)&pPrbElem->BeamFormingType);
901 printf("nPrbElemUl%d: ",section_idx);
902 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
903 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
905 } else if(strncmp(key, KEY_EXTBFW_UL, strlen(KEY_EXTBFW_UL)) == 0) {
906 sscanf(key, "ExtBfwUl%u", §ion_idx);
907 if(section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
908 printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx);
910 struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
911 sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
912 (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
913 (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
914 (uint8_t*)&pPrbElem->bf_weight.RAD,
915 (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
916 (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
917 (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
918 printf(KEY_EXTBFW_UL"%d: ", section_idx);
919 printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
920 pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
922 }else if (strcmp(key, KEY_NPRBELEM_DL ) == 0) {
923 config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = atoi(value);
924 if (config->p_SlotPrbMap[direction][slot_idx]->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
926 printf("nTddPeriod is larger than max allowed, invalid!\n");
927 config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
929 printf("nPrbElemDl: %d\n",config->p_SlotPrbMap[direction][slot_idx]->nPrbElm);
930 } else if (strncmp(key, KEY_PRBELEM_DL_ANT_M, strlen(KEY_PRBELEM_DL_ANT_M)) == 0) {
931 sscanf(key,"PrbElemDlAntCMask%u",§ion_idx);
932 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
933 printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
936 sscanf(value, "%lx",(uint64_t*)&config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
937 printf("%s%u 0x%lx\n",KEY_PRBELEM_DL_ANT_M, section_idx, config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
939 } else if (strncmp(key, KEY_PRBELEM_DL_CC_M, strlen(KEY_PRBELEM_DL_CC_M)) == 0) {
940 sscanf(key,"PrbElemDlCCMask%u",§ion_idx);
941 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
942 printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
945 sscanf(value, "%02hx",(uint16_t*)&config->SlotPrbCCmask[direction][slot_idx][section_idx]);
946 printf("%s%u 0x%02x\n",KEY_PRBELEM_DL_CC_M, section_idx, config->SlotPrbCCmask[direction][slot_idx][section_idx]);
948 } else if (strncmp(key, KEY_PRBELEM_DL, strlen(KEY_PRBELEM_DL)) == 0) {
949 sscanf(key,"PrbElemDl%u",§ion_idx);
950 if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
951 printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
954 struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
955 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
956 (int16_t*)&pPrbElem->nRBStart,
957 (int16_t*)&pPrbElem->nRBSize,
958 (int16_t*)&pPrbElem->nStartSymb,
959 (int16_t*)&pPrbElem->numSymb,
960 (int16_t*)&pPrbElem->nBeamIndex,
961 (int16_t*)&pPrbElem->bf_weight_update,
962 (int16_t*)&pPrbElem->compMethod,
963 (int16_t*)&pPrbElem->iqWidth,
964 (int16_t*)&pPrbElem->BeamFormingType);
965 printf("nPrbElemDl%d: ",section_idx);
966 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
967 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
969 } else if(strncmp(key, KEY_EXTBFW_DL, strlen(KEY_EXTBFW_DL)) == 0) {
970 sscanf(key, "ExtBfwDl%u", §ion_idx);
971 if(section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
972 printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx);
975 struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
976 sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
977 (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
978 (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
979 (uint8_t*)&pPrbElem->bf_weight.RAD,
980 (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
981 (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
982 (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
983 printf(KEY_EXTBFW_DL"%d: ",section_idx);
984 printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
985 pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
988 printf("Unsupported configuration key [%s]\n", key);
996 config_malloc_prb_map(void)
998 uint32_t size = sizeof(struct xran_prb_map) + (XRAN_MAX_SECTIONS_PER_SLOT -1) * sizeof(struct xran_prb_elm);
1004 memset(ret, 0, size);
1005 return (struct xran_prb_map*)ret;
1007 rte_panic("xran_prb_map alloc failed");
1012 config_init(RuntimeConfig *p_o_xu_cfg)
1015 memset(p_o_xu_cfg, 0, sizeof(RuntimeConfig));
1017 p_o_xu_cfg->p_PrbMapDl = config_malloc_prb_map();
1018 p_o_xu_cfg->p_PrbMapUl = config_malloc_prb_map();
1019 p_o_xu_cfg->p_PrbMapSrs = config_malloc_prb_map();
1021 for (i= 0; i < XRAN_DIR_MAX; i++){
1022 for (j= 0; j < XRAN_N_FE_BUF_LEN; j++){
1023 p_o_xu_cfg->p_SlotPrbMap[i][j] = config_malloc_prb_map();
1027 for (i = 0; i < XRAN_DIR_MAX; i++) {
1028 for (j = 0; j < XRAN_N_FE_BUF_LEN; j++) {
1029 for (k = 0; k < XRAN_MAX_SECTOR_NR; k++) {
1030 for (z = 0; z < XRAN_MAX_ANTENNA_NR; z++) {
1031 p_o_xu_cfg->p_RunSlotPrbMap[i][j][k][z] = config_malloc_prb_map();
1032 p_o_xu_cfg->p_RunSrsSlotPrbMap[i][j][k][z] = config_malloc_prb_map();
1043 parseConfigFile(char *filename, RuntimeConfig *config)
1045 char inputLine[MAX_LINE_SIZE] = {0};
1049 char key[MAX_LINE_SIZE] = {0};
1050 char value[MAX_LINE_SIZE] = {0};
1051 FILE *file = fopen(filename, "r");
1054 log_err("Error while opening config file from: %s", filename);
1058 // init_config(config);
1061 if (fgets(inputLine, MAX_LINE_SIZE, file) == NULL) {
1063 printf("%d lines of config file has been read.\n", lineNum);
1066 printf("Configuration file reading error has occurred.\n");
1072 if (inputLine[strlen(inputLine)-1] == '\n')
1073 inputLine[strlen(inputLine)-1] == '\0';
1076 inputLen = strlen(inputLine);
1078 for (i=0; i<inputLen; i++)
1079 if (inputLine[i] == '#') {
1080 inputLine[i] = '\0';
1085 for (i=0; i<inputLen; i++)
1086 if (inputLine[i] == '=') {
1087 strncpy(key, inputLine, i);
1090 if ((i + 1 > inputLen - 1) || (i - 2 > inputLen)) {
1091 log_err("Parsing config file error at line %d", lineNum);
1095 strncpy(value, &inputLine[i+1], (sizeof(value) - 1));
1096 value[inputLen-i-2] = '\0';
1099 if (strlen(key) == 0 || strlen(value) == 0) {
1100 printf("Parsing config file error at line %d", lineNum);
1105 if (fillConfigStruct(config, key, value) != 0) {
1113 memset(&inputLine[0], 0, sizeof(MAX_LINE_SIZE));
1114 memset(&key[0], 0, sizeof(MAX_LINE_SIZE));
1115 memset(&value[0], 0, sizeof(MAX_LINE_SIZE));
1123 parseSlotConfigFile(char *dir, RuntimeConfig *config)
1128 int32_t slot_idx = 0;
1130 int32_t ant_idx = 0;
1131 int32_t direction = 0;
1132 struct slot_cfg_to_pars slot_cfg_param;
1134 for (direction = 0; direction < XRAN_DIR_MAX; direction++) {
1135 for (slot_idx = 0; slot_idx < config->numSlots; slot_idx++){
1136 memset(filename, 0, sizeof(filename));
1137 printf("dir (%s)\n",dir);
1138 len = strlen(dir) + 1;
1140 printf("parseSlotConfigFile: Name of directory, %s is too long. Maximum is 511 characters!!\n", dir);
1143 strncpy(filename, dir, len);
1145 strncat(filename, "/", 1);
1147 len = (sizeof(filename)) - len;
1149 if(len > strlen(config->SlotNum_file[direction][slot_idx])){
1150 strncat(filename, config->SlotNum_file[direction][slot_idx], RTE_MIN (len, strlen(config->SlotNum_file[direction][slot_idx])));
1152 printf("File name error\n");
1155 printf("slot_file[%d][%d] (%s)\n",direction, slot_idx, filename);
1156 printf("\n=================== Slot%s %d===================\n", ((direction == XRAN_DIR_UL) ? "RX" : "TX"), slot_idx);
1158 slot_cfg_param.direction = direction;
1159 slot_cfg_param.slot_idx = slot_idx;
1160 slot_cfg_param.config = config;
1162 if (parseFileViaCb(filename, fillSlotStructAsCb, (void*)&slot_cfg_param)) {
1163 printf("Configuration file error\n");
1173 parseFileViaCb (char *filename, fillConfigStruct_fn cbFn, void* cbParm)
1175 char inputLine[MAX_LINE_SIZE] = {0};
1179 char key[MAX_LINE_SIZE] = {0};
1180 char value[MAX_LINE_SIZE] = {0};
1181 FILE *file = fopen(filename, "r");
1184 log_err("Error while opening config file from: %s", filename);
1189 if (fgets(inputLine, MAX_LINE_SIZE, file) == NULL) {
1191 printf("%d lines of config file has been read.\n", lineNum);
1194 printf("Configuration file reading error has occurred.\n");
1200 if (inputLine[strlen(inputLine)-1] == '\n')
1201 inputLine[strlen(inputLine)-1] == '\0';
1204 inputLen = strlen(inputLine);
1206 for (i=0; i<inputLen; i++)
1207 if (inputLine[i] == '#') {
1208 inputLine[i] = '\0';
1213 for (i=0; i<inputLen; i++)
1214 if (inputLine[i] == '=') {
1215 strncpy(key, inputLine, i);
1218 if ((i + 1 > inputLen - 1) || (i - 2 > inputLen)) {
1219 log_err("Parsing config file error at line %d", lineNum);
1223 strncpy(value, &inputLine[i+1], (sizeof(value) - 1));
1224 value[inputLen-i-2] = '\0';
1227 if (strlen(key) == 0 || strlen(value) == 0) {
1228 printf("Parsing config file error at line %d", lineNum);
1234 if (cbFn(cbParm, key, value) != 0) {
1239 printf("cbFn==NULL\n");
1247 memset(&inputLine[0], 0, sizeof(MAX_LINE_SIZE));
1248 memset(&key[0], 0, sizeof(MAX_LINE_SIZE));
1249 memset(&value[0], 0, sizeof(MAX_LINE_SIZE));
1256 int parseUsecaseFile(char *filename, UsecaseConfig *usecase_cfg)
1258 char inputLine[MAX_LINE_SIZE] = {0};
1262 char key[MAX_LINE_SIZE] = {0};
1263 char value[MAX_LINE_SIZE] = {0};
1264 FILE *file = fopen(filename, "r");
1267 log_err("Error while opening config file from: %s", filename);
1272 if (fgets(inputLine, MAX_LINE_SIZE, file) == NULL) {
1274 printf("%d lines of config file has been read.\n", lineNum);
1277 printf("Configuration file reading error has occurred.\n");
1283 if (inputLine[strlen(inputLine)-1] == '\n')
1284 inputLine[strlen(inputLine)-1] == '\0';
1287 inputLen = strlen(inputLine);
1289 for (i=0; i<inputLen; i++)
1290 if (inputLine[i] == '#') {
1291 inputLine[i] = '\0';
1296 for (i=0; i<inputLen; i++)
1297 if (inputLine[i] == '=') {
1298 strncpy(key, inputLine, i);
1301 if ((i + 1 > inputLen - 1) || (i - 2 > inputLen)) {
1302 log_err("Parsing config file error at line %d", lineNum);
1306 strncpy(value, &inputLine[i+1], (sizeof(value) - 1));
1307 value[inputLen-i-2] = '\0';
1310 if (strlen(key) == 0 || strlen(value) == 0) {
1311 printf("Parsing config file error at line %d", lineNum);
1316 if (fillUsecaseStruct(usecase_cfg, key, value) != 0) {
1324 memset(&inputLine[0], 0, sizeof(MAX_LINE_SIZE));
1325 memset(&key[0], 0, sizeof(MAX_LINE_SIZE));
1326 memset(&value[0], 0, sizeof(MAX_LINE_SIZE));