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

Stephen Hemminger stephen at networkplumber.org
Thu Jun 15 17:28:57 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.

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