| 1188 | } |
| 1189 | |
| 1190 | static int |
| 1191 | ff_parse_args(struct ff_config *cfg, int argc, char *const argv[]) |
| 1192 | { |
| 1193 | int c; |
| 1194 | int index = 0; |
| 1195 | optind = 1; |
| 1196 | while((c = getopt_long(argc, argv, short_options, long_options, &index)) != -1) { |
| 1197 | switch (c) { |
| 1198 | case 'c': |
| 1199 | cfg->filename = strdup(optarg); |
| 1200 | break; |
| 1201 | case 'p': |
| 1202 | cfg->dpdk.proc_id = atoi(optarg); |
| 1203 | break; |
| 1204 | case 't': |
| 1205 | cfg->dpdk.proc_type = strdup(optarg); |
| 1206 | break; |
| 1207 | default: |
| 1208 | return -1; |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | if (cfg->dpdk.proc_type == NULL) { |
| 1213 | cfg->dpdk.proc_type = strdup("auto"); |
| 1214 | } |
| 1215 | |
| 1216 | if (strcmp(cfg->dpdk.proc_type, "primary") && |
| 1217 | strcmp(cfg->dpdk.proc_type, "secondary") && |
| 1218 | strcmp(cfg->dpdk.proc_type, "auto")) { |
| 1219 | printf("invalid proc-type:%s\n", cfg->dpdk.proc_type); |
| 1220 | return -1; |
| 1221 | } |
| 1222 | |
| 1223 | if ((uint16_t)cfg->dpdk.proc_id > RTE_MAX_LCORE) { |
| 1224 | printf("invalid proc_id:%d, use default 0\n", cfg->dpdk.proc_id); |
| 1225 | cfg->dpdk.proc_id = 0; |
| 1226 | } |
| 1227 | |
| 1228 | return 0; |
| 1229 | } |
| 1230 | |
| 1231 | static int |
| 1232 | ff_check_config(struct ff_config *cfg) |
no test coverage detected