From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: zaiyuwang@trustnetic.com, Jiawen Wu <jiawenwu@trustnetic.com>,
stable@dpdk.org
Subject: [PATCH 09/19] net/txgbe: fix the maxinum number of FDIR filter
Date: Mon, 27 Oct 2025 11:15:32 +0800 [thread overview]
Message-ID: <20251027031542.10512-10-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20251027031542.10512-1-jiawenwu@trustnetic.com>
FDIR is determined the maximum value on the hardware based on the
memory space allocated (i.e. fdir_conf.pballoc). But the hash map of
FDIR is created based on TXGBE_MAX_FDIR_FILTER_NUM. These two do not
match. It resulted in the absence of error when creating more FDIR rules
than the maximum allowed by the hardware.
Fixes: 635c21354f9a ("net/txgbe: add flow director filter init and uninit")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/txgbe/txgbe_ethdev.c | 6 ++++--
drivers/net/txgbe/txgbe_fdir.c | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index e9bbf8ea72..f650c5b7a4 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -935,11 +935,13 @@ static int txgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev)
static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev)
{
+ struct rte_eth_fdir_conf *fdir_conf = TXGBE_DEV_FDIR_CONF(eth_dev);
struct txgbe_hw_fdir_info *fdir_info = TXGBE_DEV_FDIR(eth_dev);
char fdir_hash_name[RTE_HASH_NAMESIZE];
+ u16 max_fdir_num = (1024 << (fdir_conf->pballoc + 1)) - 2;
struct rte_hash_parameters fdir_hash_params = {
.name = fdir_hash_name,
- .entries = TXGBE_MAX_FDIR_FILTER_NUM,
+ .entries = max_fdir_num,
.key_len = sizeof(struct txgbe_atr_input),
.hash_func = rte_hash_crc,
.hash_func_init_val = 0,
@@ -956,7 +958,7 @@ static int txgbe_fdir_filter_init(struct rte_eth_dev *eth_dev)
}
fdir_info->hash_map = rte_zmalloc("txgbe",
sizeof(struct txgbe_fdir_filter *) *
- TXGBE_MAX_FDIR_FILTER_NUM,
+ max_fdir_num,
0);
if (!fdir_info->hash_map) {
PMD_INIT_LOG(ERR,
diff --git a/drivers/net/txgbe/txgbe_fdir.c b/drivers/net/txgbe/txgbe_fdir.c
index 0efd43b59a..631dec69e8 100644
--- a/drivers/net/txgbe/txgbe_fdir.c
+++ b/drivers/net/txgbe/txgbe_fdir.c
@@ -959,6 +959,7 @@ txgbe_fdir_filter_restore(struct rte_eth_dev *dev)
int
txgbe_clear_all_fdir_filter(struct rte_eth_dev *dev)
{
+ struct rte_eth_fdir_conf *fdir_conf = TXGBE_DEV_FDIR_CONF(dev);
struct txgbe_hw_fdir_info *fdir_info = TXGBE_DEV_FDIR(dev);
struct txgbe_fdir_filter *fdir_filter;
struct txgbe_fdir_filter *filter_flag;
@@ -967,7 +968,8 @@ txgbe_clear_all_fdir_filter(struct rte_eth_dev *dev)
/* flush flow director */
rte_hash_reset(fdir_info->hash_handle);
memset(fdir_info->hash_map, 0,
- sizeof(struct txgbe_fdir_filter *) * TXGBE_MAX_FDIR_FILTER_NUM);
+ sizeof(struct txgbe_fdir_filter *) *
+ ((1024 << (fdir_conf->pballoc + 1)) - 2));
filter_flag = TAILQ_FIRST(&fdir_info->fdir_list);
while ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) {
TAILQ_REMOVE(&fdir_info->fdir_list,
--
2.48.1
next prev parent reply other threads:[~2025-10-27 3:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 3:15 [PATCH 00/19] Wangxun Fixes Jiawen Wu
2025-10-27 3:15 ` [PATCH 01/19] net/txgbe: fix hardware statistic rx_l3_l4_xsum_error Jiawen Wu
2025-10-27 3:15 ` [PATCH 02/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 03/19] net/txgbe: reduce memory size of ring descriptors Jiawen Wu
2025-10-27 3:15 ` [PATCH 04/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 05/19] net/txgbe: fix VF Rx buffer size in config register Jiawen Wu
2025-10-27 3:15 ` [PATCH 06/19] net/ngbe: " Jiawen Wu
2025-10-27 3:15 ` [PATCH 07/19] net/txgbe: remove duplicate txq assignment Jiawen Wu
2025-10-27 3:15 ` [PATCH 08/19] net/txgbe: add device arguments for FDIR Jiawen Wu
2025-10-27 3:15 ` Jiawen Wu [this message]
2025-10-27 3:15 ` [PATCH 10/19] net/txgbe: fix FDIR mode is not be cleared Jiawen Wu
2025-10-27 3:15 ` [PATCH 11/19] net/txgbe: fix FDIR drop action for L4 match packets Jiawen Wu
2025-10-27 3:15 ` [PATCH 12/19] net/txgbe: fix to create FDIR filter for tunnel SCTP packet Jiawen Wu
2025-10-27 3:15 ` [PATCH 13/19] net/txgbe: filter FDIR match flex bytes for tunnel packets Jiawen Wu
2025-10-27 3:15 ` [PATCH 14/19] net/txgbe: fix FDIR rule raw relative for L3 packets Jiawen Wu
2025-10-27 3:15 ` [PATCH 15/19] net/txgbe: fix FDIR input mask Jiawen Wu
2025-10-27 3:15 ` [PATCH 16/19] net/txgbe: switch to use FDIR when ntuple filter is full Jiawen Wu
2025-10-27 3:15 ` [PATCH 17/19] net/txgbe: fix VF-PF message for ntuple flow filter Jiawen Wu
2025-10-27 3:15 ` [PATCH 18/19] net/txgbe: switch to use FDIR on VF Jiawen Wu
2025-10-27 3:15 ` [PATCH 19/19] net/txgbe: remove unsupported flow action mark Jiawen Wu
2025-10-27 16:51 ` [PATCH 00/19] Wangxun Fixes 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=20251027031542.10512-10-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=zaiyuwang@trustnetic.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;
as well as URLs for NNTP newsgroup(s).