Thread (65 messages) 65 messages, 7 authors, 2021-04-29

Re: [dpdk-dev] [PATCH v4] ethdev: add sanity checks in control APIs

From: Thomas Monjalon <hidden>
Date: 2021-04-15 12:20:21

15/04/2021 14:03, Andrew Rybchenko:
On 4/15/21 2:57 PM, Thomas Monjalon wrote:
quoted
15/04/2021 10:15, Andrew Rybchenko:
quoted
quoted
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
In theory, the first argument is sufficient to make the ops
check, but I think it is the right solution to keep it as is
since current tendency is to check operation support when
driver callback is really required and we're going to use it.
However, if we do it just after port_id check, we'll have a
way to check for callback support without any side effects
if we provide invalid argument value. I.e. if -ENOTSUP is
returned, callback is not supported, if -EINVAL, callback is
supported (but argument is invalid and nothing done).
However, it looks a bit fragile and not always possible.
Thoughts on it are welcome.
Sorry I don't understand it fully.
You say we should check for ENOTSUP at the very beginning?
I'm just trying to consider it and understand if it would be
right or wrong.
I think it's better to check things when they are required.
If the application does not give the right parameter,
it won't be caught until a supporting device will be used.

If the appplication gives the wrong parameter on purpose,
because it won't be supported, then it's better not calling the function.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help