+static void app_Help(void)
+{
+ char help_content[] = \
+ "sample application\n\n"\
+ "Usage: sample-app config_file_o_du.dat -p 2 0000:21:02.0 0000:21:02.1 0000:21:0a.0 0000:21:0a.1\n\n"\
+ "supports the following parameters:\n\n"\
+ "-p | --num_eth_pfs <number of ETH ports to connect to O-RU|O-DU> 1 - default sanity test\n"
+ "-c | --cfgfile <name of cfg file>\n"\
+ "-h | --help print usage\n";
+
+ printf("%s", help_content);
+}
+
+/**
+ *******************************************************************************
+ *
+ * @fn app_parse_args
+ * @brief is used to parse incoming app args
+ *
+ * @param[i] argc - app arg count
+ * @param[i] argv - array of args
+ * @param[o] params - app startup params filled basing on args parse
+ * @return number of parsed args
+ *
+ * @description
+ * The routine is parse input args and convert them into app startup params
+ *
+ * @references
+ * MS-111070-SP
+ *
+ * @ingroup icc_service_unit_test
+ *
+ ******************************************************************************/
+static int app_parse_args(int argc, char ** argv, struct sample_app_params* params)
+{
+ int c;
+ int *pInt;
+ int cnt = 0;
+
+ struct option long_options[] = {
+ {"cfgfile", required_argument, 0, 'c'},
+ {"num_eth_pfs", required_argument, 0, 'p'},
+ {"help", no_argument, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ memset(params, 0, sizeof (*params));
+
+ while (1) {
+ //int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+
+ c = getopt_long(argc, argv, "c:p:h", long_options, &option_index);
+
+ if (c == -1)
+ break;
+
+ cnt += 1;
+ pInt = NULL;
+
+ switch (c) {
+ case 'p': // test Case selection
+ pInt = ¶ms->num_vfs;
+ break;
+ case 'c':
+ params->cfg_file = optarg;
+ break;
+ case 'h':
+ app_Help();
+ exit(0);
+ }
+
+ if (pInt && optarg) {
+ // get int arg
+ if (optarg[0] == '0' && (optarg[1] == 'x' || optarg[1] == 'X')) {
+ sscanf(optarg, "%x", (unsigned *) pInt);
+ } else {
+ *pInt = atoi(optarg);
+ }
+ }
+ }
+ return cnt;
+}
+
+int32_t app_init_set_eAxCId_conf(struct xran_eaxcid_config *p_eAxC_cfg, RuntimeConfig * p_s_cfg)
+{
+ int32_t shift;
+ uint16_t mask;
+
+ if(p_s_cfg->DU_Port_ID_bitwidth && p_s_cfg->BandSector_ID_bitwidth && p_s_cfg->CC_ID_bitwidth
+ && p_s_cfg->RU_Port_ID_bitwidth &&
+ (p_s_cfg->DU_Port_ID_bitwidth + p_s_cfg->BandSector_ID_bitwidth + p_s_cfg->CC_ID_bitwidth
+ + p_s_cfg->RU_Port_ID_bitwidth) == 16 /* eAxC ID subfields are 16 bits */
+ ){ /* bit mask provided */
+
+ mask = 0;
+ p_eAxC_cfg->bit_ruPortId = 0;
+ for (shift = 0; shift < p_s_cfg->RU_Port_ID_bitwidth; shift++){
+ mask |= 1 << shift;
+ }
+ p_eAxC_cfg->mask_ruPortId = mask;
+
+ p_eAxC_cfg->bit_ccId = p_s_cfg->RU_Port_ID_bitwidth;
+ mask = 0;
+ for (shift = p_s_cfg->RU_Port_ID_bitwidth; shift < p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth; shift++){
+ mask |= 1 << shift;
+ }
+ p_eAxC_cfg->mask_ccId = mask;
+
+
+ p_eAxC_cfg->bit_bandSectorId = p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth;
+ mask = 0;
+ for (shift = p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth; shift < p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth + p_s_cfg->BandSector_ID_bitwidth; shift++){
+ mask |= 1 << shift;
+ }
+ p_eAxC_cfg->mask_bandSectorId = mask;
+
+ p_eAxC_cfg->bit_cuPortId = p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth + p_s_cfg->BandSector_ID_bitwidth;
+ mask = 0;
+ for (shift = p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth + p_s_cfg->BandSector_ID_bitwidth;
+ shift < p_s_cfg->RU_Port_ID_bitwidth + p_s_cfg->CC_ID_bitwidth + p_s_cfg->BandSector_ID_bitwidth + p_s_cfg->DU_Port_ID_bitwidth; shift++){
+ mask |= 1 << shift;
+ }
+ p_eAxC_cfg->mask_cuPortId = mask;
+
+
+ } else { /* bit mask config is not provided */
+ switch (p_s_cfg->xranCat){
+ case XRAN_CATEGORY_A: {
+ p_eAxC_cfg->mask_cuPortId = 0xf000;
+ p_eAxC_cfg->mask_bandSectorId = 0x0f00;
+ p_eAxC_cfg->mask_ccId = 0x00f0;
+ p_eAxC_cfg->mask_ruPortId = 0x000f;
+ p_eAxC_cfg->bit_cuPortId = 12;
+ p_eAxC_cfg->bit_bandSectorId = 8;
+ p_eAxC_cfg->bit_ccId = 4;
+ p_eAxC_cfg->bit_ruPortId = 0;
+ break;
+ }
+ case XRAN_CATEGORY_B: {
+ p_eAxC_cfg->mask_cuPortId = 0xf000;
+ p_eAxC_cfg->mask_bandSectorId = 0x0c00;
+ p_eAxC_cfg->mask_ccId = 0x0300;
+ p_eAxC_cfg->mask_ruPortId = 0x00ff; /* more than [0-127] eAxC */
+ p_eAxC_cfg->bit_cuPortId = 12;
+ p_eAxC_cfg->bit_bandSectorId = 10;
+ p_eAxC_cfg->bit_ccId = 8;
+ p_eAxC_cfg->bit_ruPortId = 0;
+ break;
+ }
+ default:
+ rte_panic("Incorrect Category\n");
+ }
+ }
+
+ if(p_s_cfg->xranCat == XRAN_CATEGORY_A)
+ p_s_cfg->numUlAxc = p_s_cfg->numAxc;
+
+ printf("bit_cuPortId %2d mask 0x%04x\n",p_eAxC_cfg->bit_cuPortId, p_eAxC_cfg->mask_cuPortId);
+ printf("bit_bandSectorId %2d mask 0x%04x\n",p_eAxC_cfg->bit_bandSectorId, p_eAxC_cfg->mask_bandSectorId);
+ printf("bit_ccId %2d mask 0x%04x\n",p_eAxC_cfg->bit_ccId, p_eAxC_cfg->mask_ccId);
+ printf("ruPortId %2d mask 0x%04x\n",p_eAxC_cfg->bit_ruPortId, p_eAxC_cfg->mask_ruPortId);
+
+ return 0;
+}
+