[PATCH v4 2/3] ethdev: add standby state for live migration

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Wed Feb 1 09:40:18 CET 2023


On 2/1/23 11:27, Thomas Monjalon wrote:
> 01/02/2023 08:52, Andrew Rybchenko:
>> On 1/18/23 18:44, Rongwei Liu wrote:
>>> + * When configuring the device from a standby process,
>>> + * it has no effect except for below situations:
>>> + *   - traffic not handled by the active process configuration
>>> + *   - no active process
>>> + *
>>> + * When a process is changed from a standby to an active role,
>>> + * all preceding configurations that are queued by hardware
>>> + * should become effective immediately.
>>> + * Before role transition, all the traffic handling configurations
>>> + * set by the active process should be flushed first.
>>> + *
>>> + * In summary, the operations are expected to happen in this order
>>> + * in "old" and "new" applications:
>>> + *   device: already configured by the old application
>>> + *   new:    start as active
>>> + *   new:    probe the same device
>>> + *   new:    set as standby
>>> + *   new:    configure the device
>>> + *   device: has configurations from old and new applications
>>> + *   old:    clear its device configuration
>>> + *   device: has only 1 configuration from new application
>>> + *   new:    set as active
>>> + *   device: downtime for connecting all to the new application
>>> + *   old:    shutdown
>>> + *
>>> + * @param standby
>>> + *   Role active if false, standby if true.
>>
>> Typically API with boolean parameters is bad. May be in this
>> particular case it is better to have two functions:
>> rte_eth_process_set_active() and rte_eth_process_set_standby().
> 
> Why?
> It could be an enum as well.

It is simply hard to read (what is set_role(true)???) and not
extensible. enum instead of boolean is an acceptable
alternative of many functions.



More information about the dev mailing list