|WARNING| [v2] net/ixgbe: fix repeated Rx packet buffer shrink for FDIR
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sun Sep 27 07:30:12 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/170043
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-27
# DPDK Patch Review: net/ixgbe FDIR Rx buffer fix
## Summary
This patch fixes a bug where the RXPBSIZE(0) register was repeatedly reduced each time Flow Director was re-enabled, by computing the reduced size from the default buffer size instead of reading the current (already reduced) register value.
---
## ERRORS
### 1. Resource leak on error path in ixgbe_fdir_flow_program()
**File**: drivers/net/intel/ixgbe/ixgbe_flow.c
**Location**: Lines 2647-2668
The `ixgbe_fdir_process_rule()` function at line 2657 may allocate resources (mask, flex bytes configuration) that are not released if the function succeeds but `ixgbe_fdir_filter_program()` at line 2663 later fails.
When `ixgbe_fdir_process_rule()` returns 0, it may have:
- Set `fdir_info->mask_added = true` and allocated mask resources
- Modified `fdir_info->flex_bytes_offset`
If `ixgbe_fdir_filter_program()` fails after this point, the new error path at line 2675 calls `ixgbe_fdir_disable()` but does not clean up the mask/flex state set by `ixgbe_fdir_process_rule()`.
**Suggested fix**: On the error path, reset the mask/flex state if this was the first mask:
```c
error:
/* FDIR mode is only recorded on success, so undo the enable */
if (fdir_enabled) {
if (first_mask) {
fdir_info->mask_added = false;
fdir_info->mask = (struct ixgbe_hw_fdir_mask){0};
fdir_info->flex_bytes_offset = 0;
}
ixgbe_fdir_disable(IXGBE_DEV_PRIVATE_TO_HW(adapter));
}
return ret;
```
---
## WARNINGS
### 1. Inconsistent error handling in ixgbe_clear_all_fdir_filter()
**File**: drivers/net/intel/ixgbe/ixgbe_fdir.c
**Location**: Lines 1373-1375
The call to `ixgbe_reinit_fdir_tables_82599()` may fail, but the function continues and returns 0 anyway. While the comment notes this in the v2 changelog ("Do not fail flush if re-initializing the FDIR tables fails"), logging a WARNING but then proceeding to disable FDIR and clear the hash table may leave the hardware in an inconsistent state.
This is acceptable if it's the intended design, but consider whether returning an error code might be safer for callers to handle.
---
## INFO
### 1. Variable `had_flows` removed but logic preserved
**File**: drivers/net/intel/ixgbe/ixgbe_fdir.c
**Location**: Line 1372 (removed), lines 1373-1383 (new logic)
The patch removes the `had_flows` flag and unconditionally calls `ixgbe_reinit_fdir_tables_82599()` and `ixgbe_fdir_disable()` when `fdir_conf->mode != RTE_FDIR_MODE_NONE`. This is correct because the condition `fdir_conf->mode != RTE_FDIR_MODE_NONE` is equivalent to the old `had_flows` check (FDIR mode is only set to non-NONE when flows exist). The change simplifies the logic.
### 2. Consistent use of hw->mac.rx_pb_size
The patch correctly uses `hw->mac.rx_pb_size` as the source of truth for the default packet buffer size in both `ixgbe_fdir_disable()` (line 563) and `ixgbe_fdir_configure()` (line 620). This ensures the buffer is always restored to the original default size, fixing the root cause described in the commit message.
---
## CONCLUSION
The patch correctly addresses the stated bug (repeated RXPBSIZE reduction) and adds proper cleanup on error paths. However, there is one **Error**-level issue: the error path in `ixgbe_fdir_flow_program()` may leak mask/flex configuration state if `ixgbe_fdir_filter_program()` fails after `ixgbe_fdir_process_rule()` succeeds.
More information about the test-report
mailing list