From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B45CE455FE; Thu, 11 Jul 2024 18:57:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AE4C42E63; Thu, 11 Jul 2024 18:57:36 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mails.dpdk.org (Postfix) with ESMTP id 4ABAE42E60 for ; Thu, 11 Jul 2024 18:57:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720717056; x=1752253056; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GYK5TIwJDxQoPdeefv4dB7Z4ExZhUiSHnmO5EWnKvLQ=; b=aQY3r1WSrm+t4s19e34Bc5bVt3rso7jCPnIzij0XR8qOLGLNO4HniZwB eO/JBZIDVxtRBMgv8sX+o1YZXaozwEnAR0o7zdyLv4uLart2WuUmqYZIx v4Kbu4lotV9rT7P+4qBo2fkCVlG3gqPadnofNPnlG3Ivs8cNc7k3ofmqz 5i7Pe8wkUpXt94qR4e9xN3TMNMmgAwhnpm+byXHRNx572XpNrNt/2yols 3R1qweBDByM3C5EfXtOQnt1UcZ2zTlHo9OWFbZRTv3dSP9LAq07fOiYiX F6bzaA0QZeo0usn7cG/1UPwCpetqg83yQJ3HinD9cZpcDLhoxBqm4TuGa w==; X-CSE-ConnectionGUID: AFqcE3JDQNG1ww8E94p1aQ== X-CSE-MsgGUID: 4KLIapqcT7ChQypg//Bn9w== X-IronPort-AV: E=McAfee;i="6700,10204,11130"; a="17962569" X-IronPort-AV: E=Sophos;i="6.09,200,1716274800"; d="scan'208";a="17962569" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2024 09:57:35 -0700 X-CSE-ConnectionGUID: X1TuYr3yQ7OZZ347JCV47Q== X-CSE-MsgGUID: vg+J/7aDR2yU8bNHHARqgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,200,1716274800"; d="scan'208";a="49394459" Received: from silpixa00399413-oob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.33]) by orviesa008.jf.intel.com with ESMTP; 11 Jul 2024 09:57:34 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH] net/ice: fix sizing of filter hash table Date: Thu, 11 Jul 2024 17:57:28 +0100 Message-ID: <20240711165728.1105073-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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