From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 07E5A455AD
	for <public@inbox.dpdk.org>; Mon, 15 Jul 2024 17:30:11 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0444640BA0;
	Mon, 15 Jul 2024 17:30:11 +0200 (CEST)
Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com
 [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id 6B57540BA0
 for <stable@dpdk.org>; Mon, 15 Jul 2024 17:30:09 +0200 (CEST)
Received: by mail-wm1-f51.google.com with SMTP id
 5b1f17b1804b1-427ad8bd88eso8310335e9.2
 for <stable@dpdk.org>; Mon, 15 Jul 2024 08:30:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1721057409; x=1721662209; darn=dpdk.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=9mPM/j1LtTf2wvm6agwZh3+ta3G6ixhJuVW9zIrDYCY=;
 b=HEWPcLa2TIqI0IHNPaFZ1Hk3oRnirWYgmJ1tsxQrjcrJ8cvoPb6278lSMQnVE7RTfE
 iA7Nz50inks+rS9/dHugby3BZqoCFDgIvguMggosSVXmru6mB3DVcUqsBqG1+jRN5ym8
 f52RlbzMZ2lsvWqQbZVB0a3dfcnh2W/aOh5kVh1q4w6yQbWup23V9LuVOD3FNf3s3EaK
 gyNxyVMPeZ+Zr2F5KjGsRE/R36Rly8XPIshsdhwH7hVfuhhmgU6YyEN/1u3rmmBL+Iv9
 hxZmp8Pylb4okKI7AvJGS6yZPMWa8mWwK9++AtygxW1uufQFFpfbnWQdl74LJwyrCSdE
 uEmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1721057409; x=1721662209;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=9mPM/j1LtTf2wvm6agwZh3+ta3G6ixhJuVW9zIrDYCY=;
 b=PGLv7u5qpGR+SWH7p7vOyb7gC1P7BZBHrb5PWVDxfHrL20vl8yyKefOMat9Hz9OYo5
 nCfaMotWDssq/0mh/IiIASj7UyOBGDjUyeEaOY3sLX4FDNexrlvOyq59X2vaZK+Spipx
 yt3hkgI+k8Gvps6r3UvtyCg7wohR41kcm+GM6I96E9M5eoHdd6VSDtMEua4D+vTAVVr7
 3lDUzkejvHCBaJdxFBp5yCkStKlBtW99xOGbeeLGrP84VX2yiwh+/9EcTbFJ0hUbyy5p
 VufAjHK5eIAZWXZ5T4OOiTDWT3kpX0FUA7yWSy3ORwHDEIKKZ52lgPYNVsfhYT+j8M9s
 pX4Q==
X-Forwarded-Encrypted: i=1;
 AJvYcCWkANQuVblTnLiM0CUc6x5NdKD8E4dHnfoPu6NvT5/a7lSJ6IuTebIaA+Bcqg31vUf9KNF4fL2mlrGexj8AigA=
X-Gm-Message-State: AOJu0YyfylaRIOJ8oj/bg+jDF8K3cIsA1HAqy0FEwQTyOju+mJaBG4Se
 87VVQKMA8nr9ZVr+jtf+zVLDMJ6q48hFxcxtFZsEgZ8OnkdEPqNo
X-Google-Smtp-Source: AGHT+IGw23hrge38RO4lABZGwsnGIwEFm6a1I7TzGj0ZRML4Gc9yYal+xVcOBifzqs4dKa/yvitC6Q==
X-Received: by 2002:a05:600c:3226:b0:426:59ec:17a9 with SMTP id
 5b1f17b1804b1-426707d7c9fmr135799075e9.22.1721057409083; 
 Mon, 15 Jul 2024 08:30:09 -0700 (PDT)
Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-4279f2cc306sm127769735e9.30.2024.07.15.08.30.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 15 Jul 2024 08:30:08 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: David Marchand <david.marchand@redhat.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'net/ice: fix sizing of filter hash table' has been queued to
 stable release 22.11.6
Date: Mon, 15 Jul 2024 16:26:34 +0100
Message-Id: <20240715152704.2229503-56-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240715152704.2229503-1-luca.boccassi@gmail.com>
References: <20240624235907.885628-81-luca.boccassi@gmail.com>
 <20240715152704.2229503-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi,

FYI, your patch has been queued to stable release 22.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/17/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/4999f309fb5e219d331854190882883828968924

Thanks.

Luca Boccassi

---
>From 4999f309fb5e219d331854190882883828968924 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson@intel.com>
Date: Thu, 11 Jul 2024 17:57:28 +0100
Subject: [PATCH] net/ice: fix sizing of filter hash table

[ upstream commit 15800bfdac939e2056c76e7c634825bb682e334c ]

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>
Acked-by: David Marchand <david.marchand@redhat.com>
---
 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 bfc9140dba..9799cad394 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 81e88c1dd8..7e97547d8b 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -377,12 +377,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,
@@ -400,7 +405,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.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-07-15 16:19:37.437382729 +0100
+++ 0056-net-ice-fix-sizing-of-filter-hash-table.patch	2024-07-15 16:19:34.628207744 +0100
@@ -1 +1 @@
-From 15800bfdac939e2056c76e7c634825bb682e334c Mon Sep 17 00:00:00 2001
+From 4999f309fb5e219d331854190882883828968924 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 15800bfdac939e2056c76e7c634825bb682e334c ]
+
@@ -24 +26 @@
-index d73faaed49..3ea9f37dc8 100644
+index bfc9140dba..9799cad394 100644
@@ -37 +39 @@
-index 0b7920ad44..edd8cc8f1a 100644
+index 81e88c1dd8..7e97547d8b 100644
@@ -40 +42 @@
-@@ -375,12 +375,17 @@ ice_fdir_init_filter_list(struct ice_pf *pf)
+@@ -377,12 +377,17 @@ ice_fdir_init_filter_list(struct ice_pf *pf)
@@ -59 +61 @@
-@@ -398,7 +403,7 @@ ice_fdir_init_filter_list(struct ice_pf *pf)
+@@ -400,7 +405,7 @@ ice_fdir_init_filter_list(struct ice_pf *pf)