|WARNING| [v6,24/24] eal: deprecate rte_atomicNN functions

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Aug 5 18:51:54 CEST 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/167075

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-08-05

I have reviewed this patch series against the AGENTS.md guidelines. Here is my analysis:

## OVERALL ASSESSMENT

This is a well-executed conversion from deprecated `rte_atomicNN_*()` APIs to C11 stdatomic equivalents. The patches demonstrate good understanding of memory ordering and atomic operation semantics. Most patches are clean with only a few issues found.

---

## PATCH-BY-PATCH FINDINGS

### Patch 1/24: bpf: use C11 atomics in BPF_ST_ATOMIC_REG
**Status: Clean**

### Patch 2/24: net/bonding: use stdatomic
**Status: Clean**

### Patch 3/24: net/nbl: remove unused rte_atomic16 field
**Status: Clean**

### Patch 4/24: net/ena: replace use of rte_atomicNN
**Errors:**
1. **Statistics do not require atomics** - The patch correctly removes atomics from statistics counters (ierrors, oerrors, rx_nombuf) which is correct per DPDK PMD model, but the commit message should explicitly state this is intentional because statistics do not need exact synchronization during contention.

### Patch 5/24: net/failsafe: convert to stdatomic
**Warnings:**
1. **Memory ordering may be too strong** - The `FS_ATOMIC_P()` and `FS_ATOMIC_V()` macros use `rte_memory_order_seq_cst` on both acquire and release operations. Based on the code pattern (P sets flag, V clears it), acquire on the exchange and release on the store would be more appropriate:
   ```c
   #define FS_ATOMIC_P(a) \
       rte_atomic_exchange_explicit(&(a), 1, rte_memory_order_acquire)
   #define FS_ATOMIC_V(a) \
       rte_atomic_store_explicit(&(a), 0, rte_memory_order_release)
   ```

### Patch 6/24: net/enic: do not use deprecated rte_atomic64
**Status: Clean**

### Patch 7/24: net/pfe: use ethdev linkstatus helpers
**Status: Clean**

### Patch 8/24: net/sfc: replace rte_atomic with stdatomic
**Status: Clean**

### Patch 9/24: crypto/ccp: replace use of rte_atomic64 with stdatomic
**Status: Clean**

### Patch 10/24: bus/dpaa: replace rte_atomic16 with stdatomic
**Status: Clean**

### Patch 11/24: bus/fslmc: replace rte_atomic16 with stdatomic
**Status: Clean**

### Patch 12/24: net/netvsc: replace rte_atomic32 with stdatomic
**Status: Clean**

### Patch 13/24: event/sw: convert from rte_atomic32 to stdatomic
**Status: Clean**

### Patch 14/24: bus/vmbus: convert from rte_atomic to stdatomic
**Warnings:**
1. **Complex memory ordering** - The `vmbus_txbr_write()` changes are correct but complex. The commit message could better explain why both the CAS and the final store need specific orderings. The wait-then-publish pattern is critical for correctness.

### Patch 15/24: common/dpaax: use stdatomic instead of rte_atomic
**Errors:**
1. **Incorrect return value semantics** - `atomic_inc_and_test` and `atomic_dec_and_test` have inverted logic:
   ```c
   // BAD - tests if result BEFORE operation was zero
   #define atomic_inc_and_test(v)  (rte_atomic_fetch_add_explicit((v), 1, \
                                       rte_memory_order_seq_cst) == 0)
   
   // GOOD - tests if result AFTER operation is zero
   #define atomic_inc_and_test(v)  (rte_atomic_fetch_add_explicit((v), 1, \
                                       rte_memory_order_seq_cst) + 1 == 0)
   #define atomic_dec_and_test(v)  (rte_atomic_fetch_sub_explicit((v), 1, \
                                       rte_memory_order_seq_cst) - 1 == 0)
   ```

### Patch 16/24: net/bnx2x: convert from rte_atomic32 to stdatomic
**Status: Clean**

### Patch 17/24: bus/fslmc: replace rte_atomic32 with stdatomic
**Errors:**
1. **Same issue as patch 15** - Incorrect `atomic_inc_and_test`/`atomic_dec_and_test` semantics (testing pre-operation value instead of post-operation).

### Patch 18/24: drivers/event: replace rte_atomic32 in selftests
**Status: Clean**

### Patch 19/24: net/hinic: replace rte_atomic32 with stdatomic
**Status: Clean**

### Patch 20/24: net/txgbe: replace rte_atomic32 with stdatomic
**Status: Clean**

### Patch 21/24: net/vhost: use stdatomic instead of rte_atomic32
**Status: Clean** - The complex seq_cst handshake is correctly explained in comments.

### Patch 22/24: vdpa/ifc: replace rte_atomic32 with stdatomic
**Status: Clean**

### Patch 23/24: test/atomic: suppress deprecation warnings for legacy APIs
**Status: Clean**

### Patch 24/24: eal: deprecate rte_atomicNN functions
**Status: Clean**

---

## SUMMARY OF ISSUES

### Errors (Must Fix)
1. **Patch 15 & 17**: Incorrect test-and-set semantics in `atomic_inc_and_test()` and `atomic_dec_and_test()` macros - they test the pre-operation value instead of post-operation value.

### Warnings (Should Fix)
1. **Patch 5**: Memory ordering could be optimized (acquire/release instead of seq_cst for P/V macros).

### Info
1. **Patch 4**: Commit message should explicitly state that removing atomics from statistics is intentional per DPDK PMD requirements.

---

## CORRECTNESS ANALYSIS

The series correctly:
- Preserves memory ordering semantics (mostly using seq_cst to match legacy API)
- Handles the producer/consumer handshake patterns (patches 14, 21)
- Uses relaxed ordering for statistics where appropriate
- Converts test-and-set operations correctly (except patches 15/17)
- Uses `RTE_ATOMIC()` type annotations properly
- Handles initialization correctly

The critical bugs are in patches 15 and 17 where the test-and-operation macros will give wrong results.


More information about the test-report mailing list