|WARNING| [RFC, v4, 2/2] net/bonding: restrict secondary control operations
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sun Aug 30 03:39:04 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/168629
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-08-30
# DPDK Patch Review
## Patch 1/2: net/bonding: skip unavailable member stats
### Errors
None.
### Warnings
None.
### Info
The patch correctly adds error checking to `rte_eth_stats_get()` and skips members whose statistics cannot be retrieved. This prevents accumulation of uninitialized data. The fix is straightforward and correct.
---
## Patch 2/2: net/bonding: restrict secondary control operations
### Errors
1. **Missing `RTE_EXPORT_SYMBOL` macro for new function**
The `bond_check_primary()` function is defined as `static inline` in a header file, so it does not require an export macro. However, if it were a non-inline function in a `.c` file, it would need `RTE_EXPORT_INTERNAL_SYMBOL(bond_check_primary)` since it's shared between bonding components. The current inline placement is acceptable.
Actually, upon re-reading: `bond_check_primary()` is `static inline` in the header, so no export is needed. This is correct.
2. **Link update function modifies shared state without atomics**
In `bond_ethdev_link_update()`, the function reads and writes to `ethdev->data->dev_link` fields (link_speed, link_status) directly, then uses `rte_eth_linkstatus_set()` at the end. However, between the `rte_eth_linkstatus_get()` at the start and the `rte_eth_linkstatus_set()` at the end, if another thread calls `rte_eth_link_get()`, it might observe a partially updated link state.
The use of `rte_eth_linkstatus_set()` is correct and provides atomic publication of the final state. The local `bond_link` variable is used for intermediate calculations, which is the right pattern. The final `rte_eth_linkstatus_set()` call ensures the update is atomic from the perspective of concurrent readers. This is acceptable.
Wait - examining more closely: all modifications happen to the local `bond_link` variable, and only the final `rte_eth_linkstatus_set()` touches shared state. This is correct.
### Warnings
1. **Release notes should include Bugzilla reference**
The patch fixes Bugzilla ID 1900 (mentioned in the commit message), but the release notes entry does not reference it. Consider adding "Fixes: Bugzilla 1900" or a similar note in the release notes for traceability.
2. **Documentation could clarify detach behavior**
The documentation states "Secondary processes may attach to an existing bonding device for detach and supported query operations only," but the term "detach" could be misinterpreted. It's clearer to say "Secondary processes may attach to an existing bonding device for later detachment and for supported query operations only" to emphasize that detach is an operation performed after attachment, not an alternative to attachment.
3. **Missing Cc: stable at dpdk.org**
This is a bug fix (Bugzilla 1900) that restricts secondary process operations to prevent undefined behavior. It should likely be backported to stable branches and should include `Cc: stable at dpdk.org` in the commit message.
4. **LACP state dumping could log a message in secondary**
The `bond_ethdev_priv_dump()` function silently skips LACP state in secondary processes. Consider logging a brief message like "LACP state query not supported in secondary process" to inform the user why the output is incomplete.
### Info
1. **Consistent error return value convention**
Most bonding API functions return `-1` on error, while the new 802.3ad restrictions return `-ENOTSUP`. Consider standardizing on `-ENOTSUP` for all "not supported in secondary" errors to make error handling more consistent for callers. However, maintaining compatibility with existing return value conventions may be more important here.
2. **`bond_check_primary()` inline in header**
The function is simple (4 lines) and will be called from multiple translation units. Inline placement is appropriate.
3. **Documentation placement**
The restriction documentation is placed in the programmers guide under the "Using Link Bonding Devices" section, which is appropriate. The release notes entry under "API Changes" correctly documents the behavioral change.
---
## Summary
Both patches are correct. Patch 1/2 is a clean correctness fix. Patch 2/2 properly restricts secondary process operations by installing a reduced `dev_ops` table and checking `rte_eal_process_type()` at API entry points. The use of `rte_eth_linkstatus_set()` for atomic link updates is correct.
The main suggestions are documentation improvements and potentially adding `Cc: stable at dpdk.org` for backporting the fix.
More information about the test-report
mailing list