DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Zhang Tengfei <zhtfdev@gmail.com>
Cc: dev@dpdk.org, jiawenwu@trustnetic.com, zaiyuwang@trustnetic.com,
	stable@dpdk.org
Subject: Re: [PATCH] net/txgbe: keep flow rules per port
Date: Sun, 8 Nov 2026 08:40:51 -0800	[thread overview]
Message-ID: <20261108084051.66ebbf3e@phoenix.local> (raw)
In-Reply-To: <20261108160021.31789-1-zhtfdev@gmail.com>

On Mon,  9 Nov 2026 00:00:21 +0800
Zhang Tengfei <zhtfdev@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@dpdk.org
> 
> Signed-off-by: Zhang Tengfei <zhtfdev@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.

  reply	other threads:[~2026-11-08 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 16:00 [PATCH] net/txgbe: keep flow rules per port Zhang Tengfei
2026-11-08 16:40 ` Stephen Hemminger [this message]
2026-11-09 12:51 ` [PATCH v2] " Zhang Tengfei
2026-11-09 18:00   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261108084051.66ebbf3e@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=stable@dpdk.org \
    --cc=zaiyuwang@trustnetic.com \
    --cc=zhtfdev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox