rte_devargs_parse

Dmitry Kozlyuk dkozlyuk at nvidia.com
Wed Feb 2 12:04:17 CET 2022


Hello,

/**
 * Parse a device string.
 *
 * Verify that a bus is capable of handling the device passed
 * in argument. Store which bus will handle the device, its name
 * and the eventual device parameters.
 *
 * [SNIP]
 *
 * @param da
 *   The devargs structure holding the device information.
 *
 * [SNIP]
 */
int rte_devargs_parse(struct rte_devargs *da, const char *dev);

It is unclear from this description that "da" is not only filled,
but also used as an input, and if it is not initialized
or at least zero-filled, the function will crash.
"Holding the device information" is not helpful,
because it doesn't say it's a pre- or post-condition,
or what must be filled on input (if everything, why parse at all?).
In test_devargs.c, test_valid_devargs_cases() zero-fills "da",
but test_invalid_devargs() does not, which is probably wrong.

Is the function intended to work this way?
What use case is covered by calling it with initialized "da"?



More information about the dev mailing list