|WARNING| [v1,1/1] net/ice: remove obsolete shared counter support

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Mon Oct 19 17:54:09 CEST 2026


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

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-19

# DPDK Patch Review

## Correctness Issues

### Error: Resource leak on error path

**File:** `drivers/net/intel/ice/ice_fdir_filter.c`

**Function:** `ice_fdir_counter_alloc()`

**Lines:** Around line 350-365 (after patch)

The function allocates a counter from the pool but fails to return it to the pool if the subsequent hardware register write fails:

```c
counter_free->pool = pool;

/* reset statistic counter value */
ICE_WRITE_REG(hw, GLSTAT_FD_CNT0H(counter_free->hw_index), 0);
ICE_WRITE_REG(hw, GLSTAT_FD_CNT0L(counter_free->hw_index), 0);

err = ice_fdir_counter_pool_add(pf, counter_free, counter_free->hw_index);
if (err) {
	PMD_DRV_LOG(ERR, "Failed to add FDIR counter to pool.");
	return NULL;
}
```

If `ice_fdir_counter_pool_add()` fails, the function returns `NULL` without restoring `counter_free` to the pool's free list. The counter is removed from `pool->counter_list` earlier (implicitly by `TAILQ_FIRST()` being used in a context where it was removed), but never returned.

**Suggested fix:** Before `return NULL;`, add:
```c
if (err) {
	PMD_DRV_LOG(ERR, "Failed to add FDIR counter to pool.");
	TAILQ_INSERT_HEAD(&pool->counter_list, counter_free, next);
	return NULL;
}
```

---

## Style Issues

### Warning: Missing blank line between declaration and statement

**File:** `drivers/net/intel/ice/ice_fdir_filter.c`

**Function:** `ice_fdir_counter_free()`

**Lines:** Around line 372-374 (after patch)

```c
if (!counter)
	return;

struct ice_fdir_counter_pool *pool = counter->pool;
```

The declaration of `pool` should be separated from the preceding statement by a blank line, or moved to the start of the function block before any statements.

**Suggested fix:** Either move the declaration to the top:
```c
static void
ice_fdir_counter_free(struct ice_fdir_counter *counter)
{
	struct ice_fdir_counter_pool *pool;

	if (!counter)
		return;

	pool = counter->pool;
	TAILQ_INSERT_TAIL(&pool->counter_list, counter, next);
}
```

Or add a blank line:
```c
if (!counter)
	return;

struct ice_fdir_counter_pool *pool = counter->pool;
```

---

### Info: Unused parameter marking

**File:** `drivers/net/intel/ice/ice_fdir_filter.c`

**Function:** `ice_fdir_counter_free()`

The patch removes the `__rte_unused` marker from the `pf` parameter, which was correct since `pf` was indeed unused. However, after the patch, the function signature no longer has a `pf` parameter at all, so this is correctly handled. No issue here.

---

## Process and Documentation

### Warning: Missing release notes

This patch removes a significant internal feature (shared counter support). While the functionality was already unreachable, the code removal should be documented in the release notes under the "Removed Items" section for the current release (`doc/guides/rel_notes/release_XX_YY.rst`).

**Suggested addition:**
```rst
Removed Items
-------------

* **net/ice: Removed unreachable shared counter code.**

  Removed internal shared counter lookup and reference counting code
  that became unreachable after the deprecated shared counter attribute
  was removed from the rte_flow COUNT action.
```

---

### Info: Pre-existing unused structure members

**File:** `drivers/net/intel/ice/ice_ethdev.h`

The patch removes `shared`, `ref_cnt`, and `id` from `struct ice_fdir_counter`, which is correct cleanup. However, note that `hits` and `bytes` members remain and their usage should be verified elsewhere (this is pre-existing, not introduced by this patch).

---

## Summary

The patch successfully removes dead code for shared counter support. The main correctness issue is a resource leak on the error path in `ice_fdir_counter_alloc()` that was pre-existing but is now more visible after simplification. The style issue with variable declaration placement should be addressed. Release notes should document the removal.

---

Review-Result: ERROR


More information about the test-report mailing list