[PATCH] net/txgbe: keep flow rules per port
Stephen Hemminger
stephen at networkplumber.org
Sun Nov 8 17:40:51 CET 2026
On Mon, 9 Nov 2026 00:00:21 +0800
Zhang Tengfei <zhtfdev at gmail.com> wrote:
> rte_flow rules for every txgbe port were stored in file-scope lists.
> Flushing or closing one port freed the rte_flow handles of the others
> while their hardware rules stayed programmed, and probing another port
> reinitialized the lists. The same lists are used by the PF and VF flow
> operations.
>
> Keep one flow list in struct txgbe_adapter. A port disables flow
> director only when its own FDIR rule count reaches zero.
>
> Fixes: 5c2352b9ece6 ("net/txgbe: support creating consistent filter")
> Cc: stable at dpdk.org
>
> Signed-off-by: Zhang Tengfei <zhtfdev at gmail.com>
> ---
I didn't look at all the details but seems to be good idea.
AI liked it but found some related overlap
Subject: Re: [PATCH] net/txgbe: keep flow rules per port
Moving the flow list into struct txgbe_adapter is the right fix, and
checking that the handle belongs to the port before touching hardware
in txgbe_flow_destroy() closes a real cross-port bug. Applies to
v26.11-rc2, builds with -Dwerror=true. Fixes: tag is correct, the
global lists came in with 5c2352b9ece6.
Warning
The new fdir_info->n_flows counter duplicates state the driver already
keeps per port. Every FDIR rte_flow rule, PF and VF, goes through
txgbe_insert_fdir_filter() which adds a node to fdir_info->fdir_list,
and the delete paths remove it via txgbe_remove_fdir_filter().
txgbe_clear_all_fdir_filter() and txgbe_fdir_filter_uninit() empty
that list as well. Duplicate adds are rejected (-EINVAL), so the list
length equals n_flows in all paths.
Drop n_flows and test the existing list instead:
if (!ret) {
rte_free(fdir_rule_ptr);
if (TAILQ_EMPTY(&fdir_info->fdir_list)) {
memset(&fdir_info->mask, 0,
sizeof(struct txgbe_hw_fdir_mask));
...
That removes the field, the two increments in txgbe_flow_create(),
the reset in txgbe_filterlist_flush() and txgbe_fdir_filter_init(),
and the "if (n_flows > 0)" guard which only hides an accounting bug
if one ever exists. Smaller diff for the stable backport too.
Info
After removing the TAILQ_ENTRY members, txgbe_ntuple_filter_ele and
the other *_ele structs are single-member wrappers. Fine to leave for
a stable fix; a later cleanup could store the filter structs directly.
More information about the stable
mailing list