[dpdk-dev] [RFC] lib/ethdev: add dev configured flag
Huisong Li
lihuisong at huawei.com
Tue Jul 6 03:47:38 CEST 2021
在 2021/7/5 19:22, Ananyev, Konstantin 写道:
>
>> On 7/5/21 6:03 AM, Huisong Li wrote:
>>> 在 2021/7/3 19:04, Ananyev, Konstantin 写道:
>>>>> 在 2021/7/2 21:23, Ananyev, Konstantin 写道:
>>>>>>> On 7/2/2021 12:08 PM, Andrew Rybchenko wrote:
>>>>>>>> @Thomas, @Ferruh, I tend to accept it (with minor style fixes),
>>>>>>>> but I need your opinion on it before doing it.
>>>>>>>>
>>>>>>> I guess we were relying on the user/application to have correct
>>>>>>> order up until
>>>>>>> now, it can be good to add this into the API. OK to add it for me.
>>>>>> I don't know do we really need that flag in dev_data or not,
>>>>>> but if we do - probably better to reset it at dev_confgure()
>>>>>> straight before
>>>>>> we start to make any changes in dev_data.
>>>>> Sorry, I don't get you. Some fields in rte_eth_dev_data are initialized
>>>>> firstly in the probe phase.
>>>>>
>>>>> Do you mean to add clear this flag at the beginning of dev_configure()?
>>>> Yes, just before we start to modify things.
>>> In this patch, this flag has been cleared for all scenarios where the
>>> rte_eth_dev_data modification fails in the dev_configure().
> I understand that.
> What I am saying: at first call to dev_confgiure() you execute it with
> dev_data->confgiured == 0.
> On second and subsequent calls - it could be either 0 or 1,
> depending how previous dev_confgiure() had finished.
> I think it would be good to keep it always the same,
> to avoid any non-anticipated behaviour.
I get it.
The current patch can ensure that this flag is 1 when dev_configure() is
called successfully,
and is 0 when dev_configure() isn't called or dev_data fails to be
modified.
But there is a drawback, as you say. I will fix it in non-RFC version.
>>> And it is set to 1 when dev_configure() is configured successfully.
>>>
>>> Please check the rollback. Thanks😁
>
>
>> I guess Konstantin means the case when user re-configures
>> the device which has been configured before and the operation
>> fails. I'm not 100% what should be the state of the flag when
>> dev_configure callback is executed. I'd say that it should be
>> 0 when the first configure happens and should be 1 in the
>> case of reconfigure. I'll try to review it carefully when
>> non-RFC version of the patch is available.
More information about the dev
mailing list