On Tue, 13 Oct 2026 22:00:16 +0800
Zhang Tengfei <[email protected]> wrote:

> Enabling Flow Director reduces the Rx packet buffer 0 to reserve memory
> for the filter table, but the size was computed from the current
> register value and never restored when FDIR was no longer used. Since
> the FDIR mode is reset when the last rule is removed, on flush, or when
> enabling FDIR fails, the next rule enabled FDIR again and shrank the
> buffer once more, until it underflowed. Validating a rule also enabled
> FDIR.
> 
> Patch 1 computes the buffer size from the default packet buffer size,
> which alone stops the repeated reduction.
> Patch 2 stops enabling FDIR from flow validate and rolls back the mode
> when the first rule fails.
> Patch 3 disables FDIR and restores the buffer when no rule is left.
> 
> The same issue was fixed in ixgbe:
> <https://patches.dpdk.org/project/dpdk/patch/[email protected]>
> 
> Compile tested only.
> 
> Zhang Tengfei (3):
>   net/txgbe: fix Rx packet buffer size with flow director
>   net/txgbe: do not enable flow director on flow validate
>   net/txgbe: disable flow director when no rule is left
> 
>  drivers/net/txgbe/txgbe_ethdev.h |  1 +
>  drivers/net/txgbe/txgbe_fdir.c   | 36 +++++++++++++++----
>  drivers/net/txgbe/txgbe_flow.c   | 60 +++++++++++++++++---------------
>  3 files changed, 62 insertions(+), 35 deletions(-)
> 

AI review saw a warning that would be easy to fix.

Subject: Re: [PATCH 0/3] net/txgbe: flow director state fixes

Applied to main, each commit builds with -Dwerror=true. Fixes: tags
check out.

Series looks right overall; one validate regression in 2/3.

[PATCH 2/3] net/txgbe: do not enable flow director on flow validate

Warning: validate now accepts rules that create will always reject.

txgbe_parse_fdir_filter_normal() can set
rule->mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN. Before this patch, with
mode NONE, parse called txgbe_fdir_configure() which returns -ENOSYS
for anything other than SIGNATURE or PERFECT, so validate failed.
Now parse only checks for a mode mismatch, validate succeeds, and
create fails later in txgbe_fdir_configure().

Keep the cheap mode check in parse so validate and create agree:

        if (rule->mode != RTE_FDIR_MODE_SIGNATURE &&
            rule->mode != RTE_FDIR_MODE_PERFECT)
                return -ENOTSUP;

        if (fdir_conf->mode != RTE_FDIR_MODE_NONE &&
            fdir_conf->mode != rule->mode)
                return -ENOTSUP;

[PATCH 3/3] net/txgbe: disable flow director when no rule is left

Info: txgbe_fdir_disable() restores a single packet buffer layout
(PB0 = rx_pb_size, PB1-7 = 0), not what txgbe_configure_dcb() set at
dev_start. That matches what txgbe_fdir_configure() already does, so
FDIR with DCB is already broken and this is not a new problem. If
you respin, consider saving the PBRXSIZE values before enabling FDIR
and restoring them on disable, or reject FDIR when DCB Rx is
configured.

Reply via email to