From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>,
Laurent Hardy <laurent.hardy@6wind.com>,
David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>, Olivier Matz <olivier.matz@6wind.com>,
Andrew Rybchenko <arybchenko@solarflare.com>
Subject: Re: [dpdk-dev] [PATCH] librte_ethdev: extend dpdk api led control to query capability
Date: Wed, 8 Jan 2020 14:01:06 +0000 [thread overview]
Message-ID: <6c3702d8-10a4-10e7-2884-33e884b3bedd@intel.com> (raw)
In-Reply-To: <736913fa-3ad9-af6e-c1ad-bc6e72b8059e@intel.com>
On 1/8/2020 1:52 PM, Ferruh Yigit wrote:
> On 1/8/2020 1:25 PM, Thomas Monjalon wrote:
>> 08/01/2020 14:20, Ferruh Yigit:
>>> On 1/8/2020 1:06 PM, Thomas Monjalon wrote:
>>>> 08/01/2020 13:59, Ferruh Yigit:
>>>>> But for dev_ops, instead of having another capabilities indicator, which
>>>>> requires PMDs to keep this synchronized, I think it is better if we can self
>>>>> contain this information within dev_ops, like not implementing dev_ops would
>>>>> mean it is not supported, this way it is easier to maintain and less error prone.
>>>>
>>>> It means the dev_ops is resetted at init if a device does not support the feature.
>>>> It is against having const dev_ops.
>>>
>>> I didn't get your comment.
>>> For example getting FW version, I am saying instead of keeping another piece of
>>> information to say if it is supported by device/driver, better to grasp this
>>> from if the driver implemented 'fw_version_get' dev_ops or not.
>>
>> I like this approach.
>> Capabilities should be expressed by setting the function pointer or not (NULL).
>> But a driver may support a feature for a subset of devices.
>
> In that case dev_ops itself can return the '-ENOTSUP', since application
> interaction will be through the ethdev API, either API send '-ENOTSUP' because
> the dev_ops is NULL or dev_ops itself send the '-ENOTSUP' because of the
> underlying version of the device, for application it will be clear that that
> feature is not supported.
For this specific problem,
What do you think having:
rte_eth_led_on_is_supported()
rte_eth_led_off_is_supported()
like:
rte_eth_led_on_is_supported() {
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
return 0;
}
rte_eth_led_on() {
ret = rte_eth_led_on_is_supported();
if (ret)
return ret;
return eth_err(port_id, (*dev->dev_ops->dev_led_on)(dev));
}
>
>> If a device does not support a feature, the function pointer must be set to NULL.
>> The only issue is having dev_ops as a const struct.
>
> Not sure about changing the dev_ops on runtime, it can be very hard to debug.
>
next prev parent reply other threads:[~2020-01-08 14:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 14:56 Laurent Hardy
2020-01-08 8:56 ` David Marchand
2020-01-08 9:09 ` Ferruh Yigit
2020-01-08 9:42 ` Olivier Matz
2020-01-08 12:12 ` Ferruh Yigit
2020-01-08 12:27 ` Olivier Matz
2020-01-08 14:08 ` Ferruh Yigit
2020-01-08 14:45 ` Laurent Hardy
2020-01-08 9:55 ` David Marchand
2020-01-08 10:31 ` Laurent Hardy
2020-01-08 12:59 ` Ferruh Yigit
2020-01-08 13:06 ` Thomas Monjalon
2020-01-08 13:20 ` Ferruh Yigit
2020-01-08 13:25 ` Thomas Monjalon
2020-01-08 13:34 ` Thomas Monjalon
2020-01-08 13:53 ` Ferruh Yigit
2020-01-08 13:52 ` Ferruh Yigit
2020-01-08 14:01 ` Ferruh Yigit [this message]
2020-01-08 14:15 ` Andrew Rybchenko
2020-01-08 14:27 ` Thomas Monjalon
2020-01-08 14:37 ` Andrew Rybchenko
2020-01-08 13:58 ` Laurent Hardy
2020-01-08 14:07 ` Thomas Monjalon
2020-01-08 15:16 ` Laurent Hardy
2020-05-08 12:03 ` Ferruh Yigit
2020-05-08 12:11 ` Ferruh Yigit
2020-01-08 12:30 ` Ferruh Yigit
2020-01-08 13:00 ` David Marchand
2020-01-08 13:11 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c3702d8-10a4-10e7-2884-33e884b3bedd@intel.com \
--to=ferruh.yigit@intel.com \
--cc=arybchenko@solarflare.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=laurent.hardy@6wind.com \
--cc=olivier.matz@6wind.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).