[v9,5/5] distributor: use wait until scheme
Checks
Commit Message
Instead of polling for bufptr64 to be updated, use
wait until scheme for this case.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
lib/distributor/rte_distributor_single.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Comments
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Feifei Wang
> ---
> lib/distributor/rte_distributor_single.c | 10 ++++------
Hi ,
rte_distributor.c file also has couple of places where similar change can be done, just wondering was that missed ?
Thanks,
Reshma
> -----邮件原件-----
> 发件人: dev <dev-bounces@dpdk.org> 代表 Pattan, Reshma
> 发送时间: Tuesday, November 2, 2021 12:05 AM
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>; Hunt, David
> <david.hunt@intel.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; jerinjacobk@gmail.com;
> stephen@networkplumber.org; thomas@monjalon.net;
> david.marchand@redhat.com; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> jerinj@marvell.com
> 主题: Re: [dpdk-dev] [PATCH v9 5/5] distributor: use wait until scheme
>
>
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Feifei Wang
> > ---
> > lib/distributor/rte_distributor_single.c | 10 ++++------
>
> Hi ,
>
> rte_distributor.c file also has couple of places where similar change can be
> done, just wondering was that missed ?
Thanks for your reminding.
I just checked rte_distributor.c and there are 6 places which have rte_pause.
However, I think these places cannot apply the new helper due to that they need
to do other actions in the loop besides waiting.
Our new helper can only wait for the change of this variable, not do other actions.
Best Regards
Feifei
>
> Thanks,
> Reshma
@@ -33,9 +33,8 @@ rte_distributor_request_pkt_single(struct rte_distributor_single *d,
union rte_distributor_buffer_single *buf = &d->bufs[worker_id];
int64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
| RTE_DISTRIB_GET_BUF;
- while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED)
- & RTE_DISTRIB_FLAGS_MASK))
- rte_pause();
+ RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
+ ==, 0, __ATOMIC_RELAXED);
/* Sync with distributor on GET_BUF flag. */
__atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);
@@ -74,9 +73,8 @@ rte_distributor_return_pkt_single(struct rte_distributor_single *d,
union rte_distributor_buffer_single *buf = &d->bufs[worker_id];
uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
| RTE_DISTRIB_RETURN_BUF;
- while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED)
- & RTE_DISTRIB_FLAGS_MASK))
- rte_pause();
+ RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
+ ==, 0, __ATOMIC_RELAXED);
/* Sync with distributor on RETURN_BUF flag. */
__atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);