|WARNING| [v4,3/3] net/txgbe: fix FDIR error handling on flow create

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Sep 18 21:07:05 CEST 2026


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

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-18

# DPDK Patch Review: net/txgbe flow creation fixes

## Patch 1/3: Fix L2 tunnel error on flow create

**No issues found.**

The patch correctly adds error path propagation after L2 tunnel filter add failure by adding `goto out;`. This prevents the original error from being overwritten by later RSS parsing and matches the existing pattern used for ethertype and SYN filters.

---

## Patch 2/3: Fix leak of filters on flow create

**No issues found.**

The patch fixes a correctness bug where hardware filters were programmed before allocating the software tracking object. If allocation failed, the hardware filter remained installed with no handle to remove it.

The refactored pattern is correct:
1. Allocate software object first
2. Program hardware
3. On hardware failure, free the software object and propagate error
4. On success, add to tracking list and return

All filter types (ntuple, ethertype, SYN, FDIR, L2 tunnel, RSS) follow this pattern after the patch. The FDIR allocation is correctly moved before the global mask installation to avoid leaving `mask_added` set with no rule on allocation failure.

Error handling is complete on all paths:
- Memory allocation failures now set `ret = -ENOMEM` before `goto out`
- Hardware programming failures free the allocated object before `goto out`
- The ntuple "table full" case preserves the `goto next` fallthrough logic

---

## Patch 3/3: Fix FDIR error handling on flow create

**Errors:**

### 1. Mask-only rule check should return success, not error

**Line:** `if (!fdir_rule.b_spec) { ret = -EINVAL; goto out; }`

**Issue:** A mask-only rule (no spec, only mask) installs the global input mask but does not install a filter. After successfully installing the mask, the code returns `-EINVAL`, causing the application to see a failed create even though the mask was committed to hardware.

**Why it matters:** The application cannot distinguish "mask installed successfully but no rule" from an actual error. The mask remains active in hardware with no tracking, and future mask-conflicting rules will be rejected.

**Fix:** If mask programming succeeds, free the filter object and **return success** (the flow with `filter_type` indicating mask-only, or a sentinel). Do not return `-EINVAL`.

Alternatively, if mask-only rules are not intended to be supported, reject them **before** programming the mask (move the check to before the `txgbe_fdir_set_input_mask()` call).

```c
/* Option 1: Reject mask-only before programming */
if (fdir_rule.b_mask && !fdir_rule.b_spec) {
	ret = -EINVAL;
	goto out;
}

fdir_rule_ptr = rte_zmalloc(...);
if (!fdir_rule_ptr) { ... }

/* Mask programming follows... */
```

```c
/* Option 2: If mask-only is valid, treat as success after mask install */
if (!fdir_rule.b_spec) {
	/* Mask installed, but no rule spec - return success marker */
	rte_free(fdir_rule_ptr);
	flow->rule = NULL;  /* Or some indicator this is mask-only */
	flow->filter_type = RTE_ETH_FILTER_FDIR;
	return flow;
}
```

The correct option depends on the intended semantics. If mask-only creates are not supported, Option 1 is correct. If they are supported (DPDK allows mask-only FDIR for some PMDs), Option 2 is needed.

---

**Warnings:** None.

**Info:** None.

---

## Summary

- **Patch 1/3:** Clean fix for error propagation. Ready to merge.
- **Patch 2/3:** Comprehensive fix for resource leak. Ready to merge.
- **Patch 3/3:** Incorrect errno handling is fixed, but mask-only rule rejection must be moved to avoid partially committing the mask. Requires revision.


More information about the test-report mailing list