MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bbdev_parse_args

Function bbdev_parse_args

dpdk/examples/bbdev_app/main.c:212–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212static int
213bbdev_parse_args(int argc, char **argv,
214 struct app_config_params *app_params)
215{
216 int optind = 0;
217 int opt;
218 int opt_indx = 0;
219 char *prgname = argv[0];
220
221 static struct option lgopts[] = {
222 { "enc_core_mask", required_argument, 0, 'e' },
223 { "dec_core_mask", required_argument, 0, 'd' },
224 { "port_id", required_argument, 0, 'p' },
225 { "bbdev_id", required_argument, 0, 'b' },
226 { NULL, 0, 0, 0 }
227 };
228
229 BBDEV_ASSERT(argc != 0);
230 BBDEV_ASSERT(argv != NULL);
231 BBDEV_ASSERT(app_params != NULL);
232
233 while ((opt = getopt_long(argc, argv, "e:d:p:b:", lgopts, &opt_indx)) !=
234 EOF) {
235 switch (opt) {
236 case 'e':
237 app_params->enc_core_mask =
238 bbdev_parse_mask(optarg);
239 if (app_params->enc_core_mask == 0) {
240 usage(prgname);
241 return -1;
242 }
243 app_params->num_enc_cores =
244 rte_popcount32(app_params->enc_core_mask);
245 break;
246
247 case 'd':
248 app_params->dec_core_mask =
249 bbdev_parse_mask(optarg);
250 if (app_params->dec_core_mask == 0) {
251 usage(prgname);
252 return -1;
253 }
254 app_params->num_dec_cores =
255 rte_popcount32(app_params->dec_core_mask);
256 break;
257
258 case 'p':
259 app_params->port_id = bbdev_parse_number(optarg);
260 break;
261
262 case 'b':
263 app_params->bbdev_id = bbdev_parse_number(optarg);
264 break;
265
266 default:
267 usage(prgname);
268 return -1;
269 }

Callers 1

mainFunction · 0.85

Calls 5

getopt_longFunction · 0.85
bbdev_parse_maskFunction · 0.85
rte_popcount32Function · 0.85
bbdev_parse_numberFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected