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

Thomas Monjalon thomas at monjalon.net
Thu Apr 15 13:57:42 CEST 2021


15/04/2021 10:15, Andrew Rybchenko:
> >  	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?




More information about the dev mailing list