|WARNING| [2/2] net/mlx5: reset promiscuous modes on device close
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Fri Jul 31 11:59:28 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/167079
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-07-31
# DPDK Patch Review
## Patch 1/2: net/mlx5: fix promiscuous inconsistency on port start
### Errors
None identified.
### Warnings
**1. Missing Cc: stable at dpdk.org on Windows OS stub functions**
The Windows stub functions `mlx5_os_get_promisc()` and `mlx5_os_get_allmulti()` are added in `drivers/net/mlx5/windows/mlx5_os.c` as part of a stable backport fix. However, these are new functions being added to the Windows driver. While they are stubs that always return `false`, they are part of the API contract introduced by this fix. The patch should ensure consistency across all OS implementations when backporting.
**2. RTE_EXPORT_INTERNAL_SYMBOL placement**
The `RTE_EXPORT_INTERNAL_SYMBOL` macros in `drivers/common/mlx5/linux/mlx5_nl.c` are placed on the line immediately before the function return type. This is correct per the guidelines. However, these symbols are exported from the common driver library and used by the net driver, which is the intended use case for internal symbols. No issue here.
**3. Boolean return semantics**
The new functions `mlx5_nl_get_promisc()` and `mlx5_nl_get_allmulti()` return `bool` and use explicit boolean returns (`true`/`false`). The comparison in `mlx5_dev_start()` correctly uses direct boolean evaluation:
```c
if (mlx5_os_get_promisc(dev) != dev->data->promiscuous)
```
This is correct for boolean-returning predicates.
**4. Release notes**
This patch fixes a correctness bug (promiscuous mode inconsistency) but does not include a release notes update. While the `Fixes:` tag and `Cc: stable at dpdk.org` indicate this is a backport-eligible fix, a release notes entry in the "Fixed Issues" section would help users understand the behavior change. This is a **Warning** because it's a user-visible correctness fix.
### Info
**1. Netlink callback error handling**
The `mlx5_nl_get_flags_cb()` callback unconditionally writes to `*(uint32_t *)arg` even if the netlink message parsing might have issues. However, this follows the existing pattern in the file where callbacks write directly to the output parameter. The callers (`mlx5_nl_get_promisc()` and `mlx5_nl_get_allmulti()`) initialize `flags = 0` before the call and check the return value of `mlx5_nl_link_info()`, returning `false` on error. This pattern is acceptable.
**2. Code refactoring quality**
The refactoring of `mlx5_nl_get_mtu_bounds()` to use the new `mlx5_nl_link_info()` helper is a clean improvement that reduces code duplication. The new helper properly encapsulates the request/response pattern for RTM_GETLINK queries.
---
## Patch 2/2: net/mlx5: reset promiscuous modes on device close
### Errors
None identified.
### Warnings
**1. Incomplete cleanup on close failure path**
The cleanup code in `mlx5_dev_close()` calls `mlx5_os_get_promisc()` and `mlx5_os_set_promisc()` but does not check the return value of the setter. If `mlx5_os_set_promisc(dev, 0)` fails, the device remains in promiscuous mode but there is no error propagation or logging (beyond the DEBUG level). Similarly for `mlx5_os_set_allmulti()`.
Since `mlx5_dev_close()` is a cleanup path and returns `void`, there is limited recourse for handling errors. However, it would be more defensive to log at a higher severity (INFO or WARNING) if the reset fails, as this is the stated purpose of the patch (preventing unexpected consequences).
Suggested improvement:
```c
if (mlx5_os_get_promisc(dev)) {
ret = mlx5_os_set_promisc(dev, 0);
if (ret != 0)
DRV_LOG(WARNING, "port %u failed to reset promiscuous mode: %s",
dev->data->port_id, strerror(-ret));
else
DRV_LOG(DEBUG, "port %u reset promiscuous mode", dev->data->port_id);
}
```
**2. Release notes**
This patch changes user-visible behavior (the netdevice promiscuous/allmulti state after DPDK port close). Applications or scripts that rely on the netdevice remaining in its DPDK-configured state after close will observe different behavior. A release notes entry documenting this cleanup behavior would be appropriate.
### Info
**1. Redundant log message content**
The log messages `"port %u resetting promiscuous mode"` and `"port %u resetting all multicast mode"` at DEBUG level are useful for debugging but could be consolidated with the existing pattern in the codebase if there are similar messages elsewhere. This is minor and acceptable as-is.
---
## Summary
Both patches address a real correctness issue (promiscuous mode state inconsistency between kernel and DPDK). The code quality is good, with proper OS abstraction and clean refactoring.
**Key recommendations:**
1. Add release notes entries for both patches (user-visible behavior changes)
2. Consider logging reset failures in patch 2/2 at WARNING level instead of only DEBUG
3. Verify error handling strategy for `mlx5_os_set_promisc/allmulti` failures during close
The patches are otherwise ready for integration after addressing the documentation gap.
More information about the test-report
mailing list