[dpdk-dev] [PATCH v4 2/2] ethdev: make rte_flow API thread safe
Suanming Mou
suanmingm at nvidia.com
Wed Oct 14 12:41:57 CEST 2020
Hi Thomas,
Thanks, will update the next version when Windows mutex macro solution is confirmed.
BR,
SuanmingMou
> -----Original Message-----
> From: Thomas Monjalon <thomas at monjalon.net>
> Sent: Wednesday, October 14, 2020 6:19 PM
> To: Suanming Mou <suanmingm at nvidia.com>
> Cc: Ori Kam <orika at nvidia.com>; Ferruh Yigit <ferruh.yigit at intel.com>; Andrew
> Rybchenko <arybchenko at solarflare.com>; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: make rte_flow API thread safe
>
> 09/10/2020 03:17, Suanming Mou:
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > +If PMD interfaces do not support re-entrancy/multi-thread safety,
> > +rte_flow
>
> "API" should be inserted here to make clear which layer we talk about.
>
> > +level functions will do it by mutex per port. The application can
> > +test the
>
> "do it" is too vague. I suggest "protect threads".
>
> > +dev_flags with RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE in struct
> > +rte_eth_dev_data
>
> The application access it through dev_info.
>
> > +to know if the rte_flow thread-safe works under rte_flow level or PMD level.
>
> Again insert "API": rte_flow API level
>
> This sentence can be confusing. Better to say explicitly that if
> RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE is set, it means the protection at API
> level is disabled.
>
> > +Please note that the mutex only protects rte_flow level functions,
> > +other control path functions are not in scope.
>
> Please find a complete rewording with sentences split after punctuation:
>
> If PMD interfaces do not support re-entrancy/multi-thread safety, the rte_flow
> API functions will protect threads by mutex per port.
> The application can check whether ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE``
> is set in ``dev_flags``, meaning the PMD is thread-safe regarding rte_flow, so the
> API level protection is disabled.
> Please note that this API-level mutex protects only rte_flow functions, other
> control path functions are not in scope.
>
>
> [...]
> > --- a/doc/guides/rel_notes/release_20_11.rst
> > +++ b/doc/guides/rel_notes/release_20_11.rst
> > @@ -109,6 +109,12 @@ New Features
> > * Extern objects and functions can be plugged into the pipeline.
> > * Transaction-oriented table updates.
> >
> > +* **Added thread safe support to rte_flow functions.**
> > +
> > + Added ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE`` device flag to indicate
> > + if PMD support thread safe operations. If PMD doesn't set the flag,
> > + rte_flow level functions will protect the flow operations with mutex.
> > +
>
> Should be sorted before drivers with other ethdev features if any.
>
> [...]
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> > +/** Device PMD supports thread safety flow operation */
>
> "Device" is useless
> safety -> safe (adjective before "flow operation")
>
> It becomes:
> /** PMD supports thread-safe flow operations */
>
> > +#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE 0x0001
>
> OK for the name of the flag.
>
> [...]
> > --- a/lib/librte_ethdev/rte_ethdev_core.h
> > +++ b/lib/librte_ethdev/rte_ethdev_core.h
> > @@ -180,6 +183,7 @@ struct rte_eth_dev_data {
> > * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
> > */
> >
> > + pthread_mutex_t fts_mutex; /**< rte flow ops thread safety mutex. */
>
> "ts" or "safety" is redundant for a mutex.
> I suggest "flow_ops_mutex" as a name.
>
>
More information about the dev
mailing list