X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-bbdev%2Ftest_bbdev_vector.c;h=614dbd1a6d2e4553908147fc0e3cf72e269adbce;hb=a550baf24af90f76354eab0d4f91165a78157d38;hp=2d0852cdb227edcd39b543b48b22fc1574150910;hpb=f714a18885a6d25275b776d6131f5fc728bd522a;p=dpdk.git diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index 2d0852cdb2..614dbd1a6d 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -2,7 +2,7 @@ * Copyright(c) 2017 Intel Corporation */ -#ifdef RTE_EXEC_ENV_BSDAPP +#ifdef RTE_EXEC_ENV_FREEBSD #define _WITH_GETLINE #endif #include @@ -18,6 +18,8 @@ const char *op_data_prefixes[] = { "input", "soft_output", "hard_output", + "harq_input", + "harq_output", }; /* trim leading and trailing spaces */ @@ -84,6 +86,7 @@ parse_values(char *tokens, uint32_t **data, uint32_t *data_length) } values[n_tokens] = (uint32_t) strtoul(tok, &error, 0); + if ((error == NULL) || (*error != '\0')) { printf("Failed with convert '%s'\n", tok); rte_free(values); @@ -144,6 +147,8 @@ op_decoder_flag_strtoul(char *token, uint32_t *op_flag_value) *op_flag_value = RTE_BBDEV_TURBO_MAP_DEC; else if (!strcmp(token, "RTE_BBDEV_TURBO_DEC_SCATTER_GATHER")) *op_flag_value = RTE_BBDEV_TURBO_DEC_SCATTER_GATHER; + else if (!strcmp(token, "RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP")) + *op_flag_value = RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP; else { printf("The given value is not a turbo decoder flag\n"); return -1; @@ -152,6 +157,57 @@ op_decoder_flag_strtoul(char *token, uint32_t *op_flag_value) return 0; } +/* convert LDPC flag from string to unsigned long int*/ +static int +op_ldpc_decoder_flag_strtoul(char *token, uint32_t *op_flag_value) +{ + if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK; + else if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK; + else if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP; + else if (!strcmp(token, "RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS")) + *op_flag_value = RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE; + else if (!strcmp(token, "RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE; + else if (!strcmp(token, "RTE_BBDEV_LDPC_DECODE_BYPASS")) + *op_flag_value = RTE_BBDEV_LDPC_DECODE_BYPASS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_SOFT_OUT_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_SOFT_OUT_ENABLE; + else if (!strcmp(token, "RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS")) + *op_flag_value = RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS")) + *op_flag_value = RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE; + else if (!strcmp(token, "RTE_BBDEV_LDPC_DEC_INTERRUPTS")) + *op_flag_value = RTE_BBDEV_LDPC_DEC_INTERRUPTS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_DEC_SCATTER_GATHER")) + *op_flag_value = RTE_BBDEV_LDPC_DEC_SCATTER_GATHER; + else if (!strcmp(token, "RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION")) + *op_flag_value = RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION; + else if (!strcmp(token, "RTE_BBDEV_LDPC_LLR_COMPRESSION")) + *op_flag_value = RTE_BBDEV_LDPC_LLR_COMPRESSION; + else if (!strcmp(token, + "RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE; + else if (!strcmp(token, + "RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE")) + *op_flag_value = RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE; + else if (!strcmp(token, + "RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK")) + *op_flag_value = RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK; + else { + printf("The given value is not a LDPC decoder flag\n"); + return -1; + } + + return 0; +} + /* convert turbo encoder flag from string to unsigned long int*/ static int op_encoder_flag_strtoul(char *token, uint32_t *op_flag_value) @@ -174,6 +230,32 @@ op_encoder_flag_strtoul(char *token, uint32_t *op_flag_value) return 0; } +/* convert LDPC encoder flag from string to unsigned long int*/ +static int +op_ldpc_encoder_flag_strtoul(char *token, uint32_t *op_flag_value) +{ + if (!strcmp(token, "RTE_BBDEV_LDPC_INTERLEAVER_BYPASS")) + *op_flag_value = RTE_BBDEV_LDPC_INTERLEAVER_BYPASS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_RATE_MATCH")) + *op_flag_value = RTE_BBDEV_LDPC_RATE_MATCH; + else if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_24A_ATTACH")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_24A_ATTACH; + else if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_24B_ATTACH")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_24B_ATTACH; + else if (!strcmp(token, "RTE_BBDEV_LDPC_CRC_16_ATTACH")) + *op_flag_value = RTE_BBDEV_LDPC_CRC_16_ATTACH; + else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_INTERRUPTS")) + *op_flag_value = RTE_BBDEV_LDPC_ENC_INTERRUPTS; + else if (!strcmp(token, "RTE_BBDEV_LDPC_ENC_SCATTER_GATHER")) + *op_flag_value = RTE_BBDEV_LDPC_ENC_SCATTER_GATHER; + else { + printf("The given value is not a turbo encoder flag\n"); + return -1; + } + + return 0; +} + /* tokenization turbo decoder/encoder flags values separated by a comma */ static int parse_turbo_flags(char *tokens, uint32_t *op_flags, @@ -194,6 +276,14 @@ parse_turbo_flags(char *tokens, uint32_t *op_flags, } else if (op_type == RTE_BBDEV_OP_TURBO_ENC) { if (op_encoder_flag_strtoul(tok, &op_flag_value) == -1) return -1; + } else if (op_type == RTE_BBDEV_OP_LDPC_ENC) { + if (op_ldpc_encoder_flag_strtoul(tok, &op_flag_value) + == -1) + return -1; + } else if (op_type == RTE_BBDEV_OP_LDPC_DEC) { + if (op_ldpc_decoder_flag_strtoul(tok, &op_flag_value) + == -1) + return -1; } else { return -1; } @@ -217,6 +307,10 @@ op_turbo_type_strtol(char *token, enum rte_bbdev_op_type *op_type) *op_type = RTE_BBDEV_OP_TURBO_DEC; else if (!strcmp(token, "RTE_BBDEV_OP_TURBO_ENC")) *op_type = RTE_BBDEV_OP_TURBO_ENC; + else if (!strcmp(token, "RTE_BBDEV_OP_LDPC_ENC")) + *op_type = RTE_BBDEV_OP_LDPC_ENC; + else if (!strcmp(token, "RTE_BBDEV_OP_LDPC_DEC")) + *op_type = RTE_BBDEV_OP_LDPC_DEC; else if (!strcmp(token, "RTE_BBDEV_OP_NONE")) *op_type = RTE_BBDEV_OP_NONE; else { @@ -246,12 +340,18 @@ parse_expected_status(char *tokens, int *status, enum rte_bbdev_op_type op_type) *status = *status | (1 << RTE_BBDEV_DRV_ERROR); else if (!strcmp(tok, "FCW")) *status = *status | (1 << RTE_BBDEV_DATA_ERROR); + else if (!strcmp(tok, "SYNCRC")) { + *status = *status | (1 << RTE_BBDEV_SYNDROME_ERROR); + *status = *status | (1 << RTE_BBDEV_CRC_ERROR); + } else if (!strcmp(tok, "SYN")) + *status = *status | (1 << RTE_BBDEV_SYNDROME_ERROR); else if (!strcmp(tok, "CRC")) { - if (op_type == RTE_BBDEV_OP_TURBO_DEC) + if ((op_type == RTE_BBDEV_OP_TURBO_DEC) || + (op_type == RTE_BBDEV_OP_LDPC_DEC)) *status = *status | (1 << RTE_BBDEV_CRC_ERROR); else { printf( - "CRC is only a valid value for turbo decoder\n"); + "CRC is only a valid value for decoder\n"); return -1; } } else { @@ -288,7 +388,7 @@ parse_data_entry(const char *key_token, char *token, struct op_data_buf *op_data; unsigned int *nb_ops; - if (type > DATA_NUM_TYPES) { + if (type >= DATA_NUM_TYPES) { printf("Unknown op type: %d!\n", type); return -1; } @@ -296,9 +396,9 @@ parse_data_entry(const char *key_token, char *token, op_data = vector->entries[type].segments; nb_ops = &vector->entries[type].nb_segments; - if (*nb_ops >= RTE_BBDEV_MAX_CODE_BLOCKS) { + if (*nb_ops >= RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) { printf("Too many segments (code blocks defined): %u, max %d!\n", - *nb_ops, RTE_BBDEV_MAX_CODE_BLOCKS); + *nb_ops, RTE_BBDEV_TURBO_MAX_CODE_BLOCKS); return -1; } @@ -410,6 +510,10 @@ parse_decoder_params(const char *key_token, char *token, vector->mask |= TEST_BBDEV_VF_NUM_MAPS; turbo_dec->num_maps = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "r")) { + vector->mask |= TEST_BBDEV_VF_R; + turbo_dec->tb_params.r = (uint8_t)strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "code_block_mode")) { vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; turbo_dec->code_block_mode = (uint8_t) strtoul(token, &err, 0); @@ -542,6 +646,211 @@ parse_encoder_params(const char *key_token, char *token, return 0; } + +/* parses LDPC encoder parameters and assigns to global variable */ +static int +parse_ldpc_encoder_params(const char *key_token, char *token, + struct test_bbdev_vector *vector) +{ + int ret = 0, status = 0; + uint32_t op_flags = 0; + char *err = NULL; + + struct rte_bbdev_op_ldpc_enc *ldpc_enc = &vector->ldpc_enc; + + if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) + ret = parse_data_entry(key_token, token, vector, + DATA_INPUT, + op_data_prefixes[DATA_INPUT]); + else if (starts_with(key_token, "output")) + ret = parse_data_entry(key_token, token, vector, + DATA_HARD_OUTPUT, + "output"); + else if (!strcmp(key_token, "e")) { + vector->mask |= TEST_BBDEV_VF_E; + ldpc_enc->cb_params.e = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "ea")) { + vector->mask |= TEST_BBDEV_VF_EA; + ldpc_enc->tb_params.ea = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "eb")) { + vector->mask |= TEST_BBDEV_VF_EB; + ldpc_enc->tb_params.eb = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "c")) { + vector->mask |= TEST_BBDEV_VF_C; + ldpc_enc->tb_params.c = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "cab")) { + vector->mask |= TEST_BBDEV_VF_CAB; + ldpc_enc->tb_params.cab = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "rv_index")) { + vector->mask |= TEST_BBDEV_VF_RV_INDEX; + ldpc_enc->rv_index = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "n_cb")) { + vector->mask |= TEST_BBDEV_VF_NCB; + ldpc_enc->n_cb = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "r")) { + vector->mask |= TEST_BBDEV_VF_R; + ldpc_enc->tb_params.r = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "q_m")) { + vector->mask |= TEST_BBDEV_VF_QM; + ldpc_enc->q_m = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "basegraph")) { + vector->mask |= TEST_BBDEV_VF_BG; + ldpc_enc->basegraph = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "z_c")) { + vector->mask |= TEST_BBDEV_VF_ZC; + ldpc_enc->z_c = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "n_filler")) { + vector->mask |= TEST_BBDEV_VF_F; + ldpc_enc->n_filler = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "code_block_mode")) { + vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + ldpc_enc->code_block_mode = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "op_flags")) { + vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + ret = parse_turbo_flags(token, &op_flags, vector->op_type); + if (!ret) + ldpc_enc->op_flags = op_flags; + } else if (!strcmp(key_token, "expected_status")) { + vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, vector->op_type); + if (!ret) + vector->expected_status = status; + } else { + printf("Not valid ldpc enc key: '%s'\n", key_token); + return -1; + } + + if (ret != 0) { + printf("Failed with convert '%s\t%s'\n", key_token, token); + return -1; + } + + return 0; +} + +/* parses LDPC decoder parameters and assigns to global variable */ +static int +parse_ldpc_decoder_params(const char *key_token, char *token, + struct test_bbdev_vector *vector) +{ + int ret = 0, status = 0; + uint32_t op_flags = 0; + char *err = NULL; + + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; + + if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) + ret = parse_data_entry(key_token, token, vector, + DATA_INPUT, + op_data_prefixes[DATA_INPUT]); + else if (starts_with(key_token, "output")) + ret = parse_data_entry(key_token, token, vector, + DATA_HARD_OUTPUT, + "output"); + else if (starts_with(key_token, op_data_prefixes[DATA_HARQ_INPUT])) + ret = parse_data_entry(key_token, token, vector, + DATA_HARQ_INPUT, + op_data_prefixes[DATA_HARQ_INPUT]); + else if (starts_with(key_token, op_data_prefixes[DATA_HARQ_OUTPUT])) + ret = parse_data_entry(key_token, token, vector, + DATA_HARQ_OUTPUT, + op_data_prefixes[DATA_HARQ_OUTPUT]); + else if (!strcmp(key_token, "e")) { + vector->mask |= TEST_BBDEV_VF_E; + ldpc_dec->cb_params.e = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "ea")) { + vector->mask |= TEST_BBDEV_VF_EA; + ldpc_dec->tb_params.ea = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "eb")) { + vector->mask |= TEST_BBDEV_VF_EB; + ldpc_dec->tb_params.eb = (uint32_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "c")) { + vector->mask |= TEST_BBDEV_VF_C; + ldpc_dec->tb_params.c = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "cab")) { + vector->mask |= TEST_BBDEV_VF_CAB; + ldpc_dec->tb_params.cab = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "rv_index")) { + vector->mask |= TEST_BBDEV_VF_RV_INDEX; + ldpc_dec->rv_index = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "n_cb")) { + vector->mask |= TEST_BBDEV_VF_NCB; + ldpc_dec->n_cb = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "r")) { + vector->mask |= TEST_BBDEV_VF_R; + ldpc_dec->tb_params.r = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "q_m")) { + vector->mask |= TEST_BBDEV_VF_QM; + ldpc_dec->q_m = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "basegraph")) { + vector->mask |= TEST_BBDEV_VF_BG; + ldpc_dec->basegraph = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "z_c")) { + vector->mask |= TEST_BBDEV_VF_ZC; + ldpc_dec->z_c = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "n_filler")) { + vector->mask |= TEST_BBDEV_VF_F; + ldpc_dec->n_filler = (uint16_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "expected_iter_count")) { + vector->mask |= TEST_BBDEV_VF_EXPECTED_ITER_COUNT; + ldpc_dec->iter_count = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "iter_max")) { + vector->mask |= TEST_BBDEV_VF_ITER_MAX; + ldpc_dec->iter_max = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "code_block_mode")) { + vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + ldpc_dec->code_block_mode = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "op_flags")) { + vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + ret = parse_turbo_flags(token, &op_flags, vector->op_type); + if (!ret) + ldpc_dec->op_flags = op_flags; + } else if (!strcmp(key_token, "expected_status")) { + vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, vector->op_type); + if (!ret) + vector->expected_status = status; + } else { + printf("Not valid ldpc dec key: '%s'\n", key_token); + return -1; + } + + if (ret != 0) { + printf("Failed with convert '%s\t%s'\n", key_token, token); + return -1; + } + + return 0; +} + /* checks the type of key and assigns data */ static int parse_entry(char *entry, struct test_bbdev_vector *vector) @@ -587,6 +896,12 @@ parse_entry(char *entry, struct test_bbdev_vector *vector) } else if (vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { if (parse_encoder_params(key_token, token, vector) == -1) return -1; + } else if (vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { + if (parse_ldpc_encoder_params(key_token, token, vector) == -1) + return -1; + } else if (vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { + if (parse_ldpc_decoder_params(key_token, token, vector) == -1) + return -1; } return 0; @@ -625,6 +940,39 @@ check_decoder_segments(struct test_bbdev_vector *vector) return 0; } +static int +check_ldpc_decoder_segments(struct test_bbdev_vector *vector) +{ + unsigned char i; + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; + + for (i = 0; i < vector->entries[DATA_INPUT].nb_segments; i++) + if (vector->entries[DATA_INPUT].segments[i].addr == NULL) + return -1; + + for (i = 0; i < vector->entries[DATA_HARD_OUTPUT].nb_segments; i++) + if (vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) + return -1; + + if ((ldpc_dec->op_flags & RTE_BBDEV_LDPC_SOFT_OUT_ENABLE) && + (vector->entries[DATA_SOFT_OUTPUT].nb_segments == 0)) + return -1; + + for (i = 0; i < vector->entries[DATA_SOFT_OUTPUT].nb_segments; i++) + if (vector->entries[DATA_SOFT_OUTPUT].segments[i].addr == NULL) + return -1; + + if ((ldpc_dec->op_flags & RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE) && + (vector->entries[DATA_HARQ_OUTPUT].nb_segments == 0)) + return -1; + + for (i = 0; i < vector->entries[DATA_HARQ_OUTPUT].nb_segments; i++) + if (vector->entries[DATA_HARQ_OUTPUT].segments[i].addr == NULL) + return -1; + + return 0; +} + static int check_decoder_llr_spec(struct test_bbdev_vector *vector) { @@ -642,7 +990,7 @@ check_decoder_llr_spec(struct test_bbdev_vector *vector) !(turbo_dec->op_flags & RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN)) { printf( - "WARNING: input LLR sign formalism was not specified and will be set to negative LLR for '1' bit\n"); + "INFO: input LLR sign formalism was not specified and will be set to negative LLR for '1' bit\n"); turbo_dec->op_flags |= RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN; } @@ -661,7 +1009,7 @@ check_decoder_llr_spec(struct test_bbdev_vector *vector) !(turbo_dec->op_flags & RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT)) { printf( - "WARNING: soft output LLR sign formalism was not specified and will be set to negative LLR for '1' bit\n"); + "INFO: soft output LLR sign formalism was not specified and will be set to negative LLR for '1' bit\n"); turbo_dec->op_flags |= RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT; } @@ -669,6 +1017,21 @@ check_decoder_llr_spec(struct test_bbdev_vector *vector) return 0; } +static int +check_decoder_op_flags(struct test_bbdev_vector *vector) +{ + struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; + + if ((turbo_dec->op_flags & RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP) && + !(turbo_dec->op_flags & RTE_BBDEV_TURBO_CRC_TYPE_24B)) { + printf( + "WARNING: RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP flag is missing RTE_BBDEV_TURBO_CRC_TYPE_24B\n"); + return -1; + } + + return 0; +} + /* checks decoder parameters */ static int check_decoder(struct test_bbdev_vector *vector) @@ -682,13 +1045,16 @@ check_decoder(struct test_bbdev_vector *vector) if (check_decoder_llr_spec(vector) < 0) return -1; + if (check_decoder_op_flags(vector) < 0) + return -1; + /* Check which params were set */ if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) { printf( "WARNING: code_block_mode was not specified in vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n"); - turbo_dec->code_block_mode = 1; + turbo_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK; } - if (turbo_dec->code_block_mode == 0) { + if (turbo_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) { if (!(mask & TEST_BBDEV_VF_EA)) printf( "WARNING: ea was not specified in vector file and will be set to 0\n"); @@ -712,6 +1078,9 @@ check_decoder(struct test_bbdev_vector *vector) if (!(mask & TEST_BBDEV_VF_CAB)) printf( "WARNING: cab was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_R)) + printf( + "WARNING: r was not specified in vector file and will be set to 0\n"); } else { if (!(mask & TEST_BBDEV_VF_E)) printf( @@ -722,7 +1091,7 @@ check_decoder(struct test_bbdev_vector *vector) } if (!(mask & TEST_BBDEV_VF_RV_INDEX)) printf( - "WARNING: rv_index was not specified in vector file and will be set to 0\n"); + "INFO: rv_index was not specified in vector file and will be set to 0\n"); if (!(mask & TEST_BBDEV_VF_ITER_MIN)) printf( "WARNING: iter_min was not specified in vector file and will be set to 0\n"); @@ -742,7 +1111,7 @@ check_decoder(struct test_bbdev_vector *vector) } else if (!(turbo_dec->op_flags & RTE_BBDEV_TURBO_MAP_DEC) && mask & TEST_BBDEV_VF_NUM_MAPS) { printf( - "WARNING: RTE_BBDEV_TURBO_MAP_DEC was not set in vector file and num_maps will be set to 0\n"); + "INFO: RTE_BBDEV_TURBO_MAP_DEC was not set in vector file and num_maps will be set to 0\n"); turbo_dec->num_maps = 0; } if (!(mask & TEST_BBDEV_VF_EXPECTED_STATUS)) @@ -751,6 +1120,72 @@ check_decoder(struct test_bbdev_vector *vector) return 0; } +/* checks LDPC decoder parameters */ +static int +check_ldpc_decoder(struct test_bbdev_vector *vector) +{ + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; + const int mask = vector->mask; + + if (check_ldpc_decoder_segments(vector) < 0) + return -1; + + /* + * if (check_ldpc_decoder_llr_spec(vector) < 0) + * return -1; + * + * if (check_ldpc_decoder_op_flags(vector) < 0) + * return -1; + */ + + /* Check which params were set */ + if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) { + printf( + "WARNING: code_block_mode was not specified in vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n"); + ldpc_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK; + } + if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) { + if (!(mask & TEST_BBDEV_VF_EA)) + printf( + "WARNING: ea was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_EB)) + printf( + "WARNING: eb was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_C)) { + printf( + "WARNING: c was not specified in vector file and will be set to 1\n"); + ldpc_dec->tb_params.c = 1; + } + if (!(mask & TEST_BBDEV_VF_CAB)) + printf( + "WARNING: cab was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_R)) + printf( + "WARNING: r was not specified in vector file and will be set to 0\n"); + } else { + if (!(mask & TEST_BBDEV_VF_E)) + printf( + "WARNING: e was not specified in vector file and will be set to 0\n"); + } + if (!(mask & TEST_BBDEV_VF_RV_INDEX)) + printf( + "INFO: rv_index was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_ITER_MAX)) + printf( + "WARNING: iter_max was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)) + printf( + "WARNING: expected_iter_count was not specified in vector file and iter_count will not be validated\n"); + if (!(mask & TEST_BBDEV_VF_OP_FLAGS)) { + printf( + "WARNING: op_flags was not specified in vector file and capabilities will not be validated\n"); + } + if (!(mask & TEST_BBDEV_VF_EXPECTED_STATUS)) + printf( + "WARNING: expected_status was not specified in vector file and will be set to 0\n"); + return 0; +} + /* checks encoder parameters */ static int check_encoder(struct test_bbdev_vector *vector) @@ -775,9 +1210,9 @@ check_encoder(struct test_bbdev_vector *vector) if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) { printf( "WARNING: code_block_mode was not specified in vector file and will be set to 1\n"); - vector->turbo_enc.code_block_mode = 1; + vector->turbo_enc.code_block_mode = RTE_BBDEV_CODE_BLOCK; } - if (vector->turbo_enc.code_block_mode == 0) { + if (vector->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) { if (!(mask & TEST_BBDEV_VF_EA) && (vector->turbo_enc.op_flags & RTE_BBDEV_TURBO_RATE_MATCH)) printf( @@ -827,10 +1262,66 @@ check_encoder(struct test_bbdev_vector *vector) } if (!(mask & TEST_BBDEV_VF_RV_INDEX)) printf( - "WARNING: rv_index was not specified in vector file and will be set to 0\n"); + "INFO: rv_index was not specified in vector file and will be set to 0\n"); if (!(mask & TEST_BBDEV_VF_OP_FLAGS)) printf( - "WARNING: op_flags was not specified in vector file and capabilities will not be validated\n"); + "INFO: op_flags was not specified in vector file and capabilities will not be validated\n"); + if (!(mask & TEST_BBDEV_VF_EXPECTED_STATUS)) + printf( + "WARNING: expected_status was not specified in vector file and will be set to 0\n"); + + return 0; +} + + +/* checks encoder parameters */ +static int +check_ldpc_encoder(struct test_bbdev_vector *vector) +{ + unsigned char i; + const int mask = vector->mask; + + if (vector->entries[DATA_INPUT].nb_segments == 0) + return -1; + + for (i = 0; i < vector->entries[DATA_INPUT].nb_segments; i++) + if (vector->entries[DATA_INPUT].segments[i].addr == NULL) + return -1; + + if (vector->entries[DATA_HARD_OUTPUT].nb_segments == 0) + return -1; + + for (i = 0; i < vector->entries[DATA_HARD_OUTPUT].nb_segments; i++) + if (vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) + return -1; + + if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) { + printf( + "WARNING: code_block_mode was not specified in vector file and will be set to 1\n"); + vector->turbo_enc.code_block_mode = RTE_BBDEV_CODE_BLOCK; + } + if (vector->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) { + } else { + if (!(mask & TEST_BBDEV_VF_E) && (vector->turbo_enc.op_flags & + RTE_BBDEV_TURBO_RATE_MATCH)) + printf( + "WARNING: e was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_NCB)) + printf( + "WARNING: ncb was not specified in vector file and will be set to 0\n"); + } + if (!(mask & TEST_BBDEV_VF_BG)) + printf( + "WARNING: BG was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_ZC)) + printf( + "WARNING: Zc was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_RV_INDEX)) + printf( + "INFO: rv_index was not specified in vector file and will be set to 0\n"); + if (!(mask & TEST_BBDEV_VF_OP_FLAGS)) + printf( + "INFO: op_flags was not specified in vector file and capabilities will not be validated\n"); if (!(mask & TEST_BBDEV_VF_EXPECTED_STATUS)) printf( "WARNING: expected_status was not specified in vector file and will be set to 0\n"); @@ -847,6 +1338,12 @@ bbdev_check_vector(struct test_bbdev_vector *vector) } else if (vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { if (check_encoder(vector) == -1) return -1; + } else if (vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { + if (check_ldpc_encoder(vector) == -1) + return -1; + } else if (vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { + if (check_ldpc_decoder(vector) == -1) + return -1; } else if (vector->op_type != RTE_BBDEV_OP_NONE) { printf("Vector was not filled\n"); return -1; @@ -889,8 +1386,7 @@ test_bbdev_vector_read(const char *filename, goto exit; } - memset(entry, 0, strlen(line) + 1); - strncpy(entry, line, strlen(line)); + strcpy(entry, line); /* check if entry ends with , or = */ if (entry[strlen(entry) - 1] == ',' @@ -912,7 +1408,8 @@ test_bbdev_vector_read(const char *filename, } entry = entry_extended; - strncat(entry, line, strlen(line)); + /* entry has been allocated accordingly */ + strcpy(&entry[strlen(entry)], line); if (entry[strlen(entry) - 1] != ',') break;