|WARNING| [RFC,2/2] bpf: rename macros to match Linux kernel

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Aug 5 12:12:20 CEST 2026


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

_AI Code Review_

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

# DPDK BPF Code Review

## Summary

This patch series renames BPF opcode macros and moves public symbols from `bpf_def.h` to `rte_bpf.h` with proper `rte_` prefixes. The changes are primarily mechanical search-and-replace, making the code match Linux kernel naming conventions.

## Patch 1/2: bpf: make bpf_def.h private

### Errors

None.

### Warnings

None.

### Info

- The patch moves `struct ebpf_insn` to `struct rte_ebpf_insn` and `EBPF_FUNC_MAX_ARGS` to `RTE_EBPF_FUNC_MAX_ARGS` in the public header, adding the required `rte_` prefix
- 171 files changed is within expected range for a pervasive rename
- The mechanical nature of the changes (find-replace of structure names and constants) reduces the risk of introducing bugs
- Test files updated consistently with the new naming

## Patch 2/2: bpf: rename macros to match Linux kernel

### Errors

None.

### Warnings

1. **Inconsistent naming convention between patches**
   - Patch 1 uses `RTE_EBPF_*` prefix (e.g., `RTE_EBPF_FUNC_MAX_ARGS`)
   - Patch 2 removes the `E` prefix from macro names (e.g., `EBPF_ALU64` - `BPF_ALU64`)
   - This creates an asymmetry: public symbols have `RTE_EBPF_` but macros use `BPF_`
   - Consider whether `RTE_BPF_ALU64` would be more consistent with the `RTE_EBPF_FUNC_MAX_ARGS` naming from patch 1
   - Location: throughout `lib/bpf/bpf_def.h`

2. **Missing release notes**
   - API-visible changes (renamed public structure and constants) require release notes
   - Users upgrading will need to know about `struct ebpf_insn` - `struct rte_ebpf_insn`
   - Location: `doc/guides/rel_notes/release_26_07.rst` (or current release file)

### Info

- 1459 lines changed reflects the pervasive nature of the rename (macro names appear throughout the codebase)
- The mapping from `EBPF_*` to `BPF_*` aligns with Linux kernel conventions, which will help developers familiar with kernel eBPF
- The commit message notes this aids "humans and AI tools during code generation and analysis" -- a reasonable motivation for aligning with the most common naming
- Mechanical substitution reduces the chance of logic errors
- No changes to program logic, only symbol names

---

## Overall Assessment

Both patches are primarily mechanical renames with no changes to program logic. The code compiles and the test suite is updated consistently. The main concerns are:

1. **Naming consistency** between the `RTE_EBPF_` prefix (patch 1) and the `BPF_` macro names (patch 2) -- consider whether all exported symbols should use a uniform prefix
2. **Missing release notes** for the API-visible structure rename

The patches do not introduce correctness bugs, resource leaks, or race conditions. The changes are low-risk from a functional standpoint but require documentation for API consumers.


More information about the test-report mailing list