[EXT] Re: [PATCH v2 3/3] event/cnxk: use WFE in Tx fc wait

Pavan Nikhilesh Bhagavatula pbhagavatula at marvell.com
Fri Jun 16 08:46:00 CEST 2023


=
> On Tue, 13 Jun 2023 14:55:48 +0530
> <pbhagavatula at marvell.com> wrote:
> 
> >  static __rte_always_inline void
> >  cn10k_sso_txq_fc_wait(const struct cn10k_eth_txq *txq)
> >  {
> > +#ifdef RTE_ARCH_ARM64
> > +	uint64_t space;
> > +
> > +	asm volatile(PLT_CPU_FEATURE_PREAMBLE
> > +		     "		ldxr %[space], [%[addr]]		\n"
> > +		     "		cmp %[adj], %[space] 			\n"
> > +		     "		b.hi .Ldne%=				\n"
> > +		     "		sevl					\n"
> > +		     ".Lrty%=:	wfe					\n"
> > +		     "		ldxr %[space], [%[addr]]		\n"
> > +		     "		cmp %[adj], %[space]			\n"
> > +		     "		b.ls .Lrty%=				\n"
> > +		     ".Ldne%=:						\n"
> > +		     : [space] "=&r"(space)
> > +		     : [adj] "r"(txq->nb_sqb_bufs_adj), [addr] "r"(txq-
> >fc_mem)
> > +		     : "memory");
> > +#else
> >  	while ((uint64_t)txq->nb_sqb_bufs_adj <=
> >  	       __atomic_load_n(txq->fc_mem, __ATOMIC_RELAXED))
> >  		;
> > +#endif
> >  }
> 
> Rather than introduce assembly here, please extend existing rte_pause
> functions and then other drivers could benefit and it would fit
> existing WFE usage.
> 

Yes, a future patch is planned to replace this and other occurrences with 
RTE_WAIT_UNTIL_MASKED

> Something like:
> 
> static __rte_always_inline void
> rte_wait_until_le_32(volatile uint32_t *addr, uint32_t expected,
> 		int memorder);
> 
> Direct assembly in drivers is hard to maintain and should be forbidden.



More information about the dev mailing list