[PATCH] net/ixgbe: fix inverted test and set conditional

Morten Brørup mb at smartsharesystems.com
Mon Jun 19 10:19:00 CEST 2023


> From: David Marchand [mailto:david.marchand at redhat.com]
> Sent: Monday, 19 June 2023 09.54
> 
> On Thu, Jun 15, 2023 at 9:30 PM Tyler Retzlaff
> <roretzla at linux.microsoft.com> wrote:
> >
> > Correct a mistake when converting ixgbe to use __atomic_test_and_set
> > instead of rte_atomic32_test_and_set. The return value from
> > __atomic_test_and_set is inverted relative to rte_atomic32_test_and_set.
> >
> > Fixes: e90baf6b82f6 ("net/ixgbe: replace legacy atomics with GCC builtin
> atomics")
> >
> > Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> Reviewed-by: David Marchand <david.marchand at redhat.com>
> 
> Thanks for the fix Tyler.

rte_atomic32_test_and_set() returns the inverse of __atomic_test_and_set()!

We need to provide a prominent warning about this when deprecating rte_atomic32_test_and_set(), or everyone else will make the same mistake as Tyler, i.e. perform a simple search/replace with the new function name, not noticing that the function's return value is inverted.
Perhaps we can also add some build time warning when using rte_atomic32_test_and_set()?

PS:
Tyler, the Solarflare driver also uses rte_atomic32_test_and_set(); maybe you missed in the original patch series.
https://elixir.bootlin.com/dpdk/v23.07-rc1/A/ident/rte_atomic32_test_and_set



More information about the dev mailing list