* [PATCH] net/ice: fix sizing of filter hash table
@ 2024-07-11 16:57 Bruce Richardson
2024-07-12 8:40 ` David Marchand
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2024-07-11 16:57 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
The hash table used for managing the filter rules in the ice driver was
dimensioned to a hard-coded 16k, which is insufficient for holding all
the filters supported by E830 HW.
Rather than using a hard-coded value which may need updates for new
hardware support, we can query the NIC max filter support from hardware
and scale the hash table size based on that value.
Fixes: 1a2fc1799f09 ("net/ice: reject duplicated flow for flow director")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
NOTE: Omission of "Cc: stable..." is deliberate. Although this
is a fix for an issue originally introduced in an old commit, the issue
only manifests with newly-supported HW, so the fix does not need
backporting.
---
drivers/net/ice/ice_ethdev.h | 2 --
drivers/net/ice/ice_fdir_filter.c | 9 +++++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index d73faaed49..3ea9f37dc8 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -351,8 +351,6 @@ struct ice_fdir_filter_conf {
u8 pkt_len;
};
-#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16)
-
struct ice_fdir_fltr_pattern {
enum ice_fltr_ptype flow_type;
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 0b7920ad44..edd8cc8f1a 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -375,12 +375,17 @@ ice_fdir_init_filter_list(struct ice_pf *pf)
{
struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
struct ice_fdir_info *fdir_info = &pf->fdir;
+ struct ice_hw *hw = &pf->adapter->hw;
char fdir_hash_name[RTE_HASH_NAMESIZE];
+ const uint32_t max_fd_filter_entries =
+ hw->func_caps.fd_fltr_guar + hw->func_caps.fd_fltr_best_effort;
+ /* dimension hash table as max filters + 12.5% to ensure a little headroom */
+ const uint32_t hash_table_entries = max_fd_filter_entries + (max_fd_filter_entries >> 3);
int ret;
struct rte_hash_parameters fdir_hash_params = {
.name = fdir_hash_name,
- .entries = ICE_MAX_FDIR_FILTER_NUM,
+ .entries = hash_table_entries,
.key_len = sizeof(struct ice_fdir_fltr_pattern),
.hash_func = rte_hash_crc,
.hash_func_init_val = 0,
@@ -398,7 +403,7 @@ ice_fdir_init_filter_list(struct ice_pf *pf)
}
fdir_info->hash_map = rte_zmalloc("ice_fdir_hash_map",
sizeof(*fdir_info->hash_map) *
- ICE_MAX_FDIR_FILTER_NUM,
+ hash_table_entries,
0);
if (!fdir_info->hash_map) {
PMD_INIT_LOG(ERR,
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ice: fix sizing of filter hash table
2024-07-11 16:57 [PATCH] net/ice: fix sizing of filter hash table Bruce Richardson
@ 2024-07-12 8:40 ` David Marchand
2024-07-12 9:34 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2024-07-12 8:40 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
On Thu, Jul 11, 2024 at 6:57 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> The hash table used for managing the filter rules in the ice driver was
> dimensioned to a hard-coded 16k, which is insufficient for holding all
> the filters supported by E830 HW.
>
> Rather than using a hard-coded value which may need updates for new
> hardware support, we can query the NIC max filter support from hardware
> and scale the hash table size based on that value.
>
> Fixes: 1a2fc1799f09 ("net/ice: reject duplicated flow for flow director")
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
I did not test it, but on the principle this looks fine.
Acked-by: David Marchand <david.marchand@redhat.com>
>
> ---
>
> NOTE: Omission of "Cc: stable..." is deliberate. Although this
> is a fix for an issue originally introduced in an old commit, the issue
> only manifests with newly-supported HW, so the fix does not need
> backporting.
Makes sense.
--
David Marchand
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ice: fix sizing of filter hash table
2024-07-12 8:40 ` David Marchand
@ 2024-07-12 9:34 ` Bruce Richardson
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2024-07-12 9:34 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, Jul 12, 2024 at 10:40:02AM +0200, David Marchand wrote:
> On Thu, Jul 11, 2024 at 6:57 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > The hash table used for managing the filter rules in the ice driver was
> > dimensioned to a hard-coded 16k, which is insufficient for holding all
> > the filters supported by E830 HW.
> >
> > Rather than using a hard-coded value which may need updates for new
> > hardware support, we can query the NIC max filter support from hardware
> > and scale the hash table size based on that value.
> >
> > Fixes: 1a2fc1799f09 ("net/ice: reject duplicated flow for flow director")
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> I did not test it, but on the principle this looks fine.
> Acked-by: David Marchand <david.marchand@redhat.com>
>
Applied to dpdk-next-net-intel.
/Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-12 9:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-11 16:57 [PATCH] net/ice: fix sizing of filter hash table Bruce Richardson
2024-07-12 8:40 ` David Marchand
2024-07-12 9:34 ` Bruce Richardson
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).