[RFC 2/2] ethdev: add API to set process to primary or secondary
Rongwei Liu
rongweil at nvidia.com
Fri Dec 2 04:27:38 CET 2022
BR
Rongwei
> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Thursday, December 1, 2022 23:10
> To: Rongwei Liu <rongweil at nvidia.com>
> Cc: Matan Azrad <matan at nvidia.com>; Slava Ovsiienko
> <viacheslavo at nvidia.com>; Ori Kam <orika at nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas at monjalon.net>; Ferruh Yigit
> <ferruh.yigit at amd.com>; Andrew Rybchenko
> <andrew.rybchenko at oktetlabs.ru>; dev at dpdk.org; Raslan Darawsheh
> <rasland at nvidia.com>
> Subject: Re: [RFC 2/2] ethdev: add API to set process to primary or secondary
>
> External email: Use caution opening links or attachments
>
>
> On Thu, 1 Dec 2022 10:20:05 +0200
> Rongwei Liu <rongweil at nvidia.com> wrote:
>
> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice
> > + *
> > + * Set the rte_eth process to the primary or secondary role which
> > +affects
> > + * the flow rules offloading. It doesn't allow multiple processes to
> > +be the
> > + * same role unless no offload rules are set.
> > + * The primary process's flow rules are effective immediately while
> > +the secondary
> > + * process's rules will be queued in hardware until it becomes
> > +primary or no
> > + * primary process is alive.
> > + * The primary application will always receive traffic while the
> > +secondary
> > + * application will receive traffic when no matching rules are
> > +present from
> > + * the primary application.
> > + *
> > + * The application is primary by default if this API is not called.
> > + *
> > + * When a process transforms from a secondary to a primary role, all
> > +preceding
> > + * flow rules which are queued by hardware will be effective immediately.
> > + * Before role transition, all the rules set by the primary process
> > +should be
> > + * flushed first.
> > + *
> > + * When role flag "RTE_ETH_PROCESS_NIC_DUP_WITH_SECONDARY" is set,
> > +NIC domain
> > + * flow rules are effective immediately even if a process is secondary.
> > + *
> > + * @param active
> > + * Process primary (role) or not (secondary).
> > + * @param flag
> > + * The role flag.
> > + * @return
> > + * - (>=0) Number of rte devices which have been switched successfully.
> > + * - (-EINVAL) if bad parameter.
> > + */
> > +__rte_experimental
> > +int rte_eth_process_set_primary(bool primary, uint32_t flag);
>
> The state of the devices and the system is really unstable if this fails. There is
> no rollback here.
>
Assume application is calling rte_eth_process_set_primary(false);
Once failed, call all preceding successful ports as rte_eth_process_set_primary(true);
What do you think?
> I think this should have a PMD capability flag so that application can check
> that device supports doing this. And it would have to be opt-in so that existing
> devices would always fail.
If device doesn't support it, it can set the ethdev callback to NULL or return failure for all devices.
Then the devices' state will be consistent.
More information about the dev
mailing list