checks the type of key and assigns data */
| 1138 | |
| 1139 | /* checks the type of key and assigns data */ |
| 1140 | static int |
| 1141 | parse_entry(char *entry, struct test_bbdev_vector *vector) |
| 1142 | { |
| 1143 | int ret = 0; |
| 1144 | char *token, *key_token; |
| 1145 | enum rte_bbdev_op_type op_type = RTE_BBDEV_OP_NONE; |
| 1146 | |
| 1147 | if (entry == NULL) { |
| 1148 | printf("Expected entry value\n"); |
| 1149 | return -1; |
| 1150 | } |
| 1151 | |
| 1152 | /* get key */ |
| 1153 | token = strtok(entry, ENTRY_DELIMITER); |
| 1154 | key_token = token; |
| 1155 | /* get values for key */ |
| 1156 | token = strtok(NULL, ENTRY_DELIMITER); |
| 1157 | |
| 1158 | if (key_token == NULL || token == NULL) { |
| 1159 | printf("Expected 'key = values' but was '%.40s'..\n", entry); |
| 1160 | return -1; |
| 1161 | } |
| 1162 | trim_space(key_token); |
| 1163 | |
| 1164 | /* first key_token has to specify type of operation */ |
| 1165 | if (vector->op_type == RTE_BBDEV_OP_NONE) { |
| 1166 | if (!strcmp(key_token, "op_type")) { |
| 1167 | ret = op_turbo_type_strtol(token, &op_type); |
| 1168 | if (!ret) |
| 1169 | vector->op_type = op_type; |
| 1170 | return (!ret) ? 0 : -1; |
| 1171 | } |
| 1172 | printf("First key_token (%s) does not specify op_type\n", |
| 1173 | key_token); |
| 1174 | return -1; |
| 1175 | } |
| 1176 | |
| 1177 | /* compare keys */ |
| 1178 | if (vector->op_type == RTE_BBDEV_OP_TURBO_DEC) { |
| 1179 | if (parse_decoder_params(key_token, token, vector) == -1) |
| 1180 | return -1; |
| 1181 | } else if (vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { |
| 1182 | if (parse_encoder_params(key_token, token, vector) == -1) |
| 1183 | return -1; |
| 1184 | } else if (vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { |
| 1185 | if (parse_ldpc_encoder_params(key_token, token, vector) == -1) |
| 1186 | return -1; |
| 1187 | } else if (vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { |
| 1188 | if (parse_ldpc_decoder_params(key_token, token, vector) == -1) |
| 1189 | return -1; |
| 1190 | } else if (vector->op_type == RTE_BBDEV_OP_FFT) { |
| 1191 | if (parse_fft_params(key_token, token, vector) == -1) |
| 1192 | return -1; |
| 1193 | } else if (vector->op_type == RTE_BBDEV_OP_MLDTS) { |
| 1194 | if (parse_mld_params(key_token, token, vector) == -1) |
| 1195 | return -1; |
| 1196 | } |
| 1197 |
no test coverage detected