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 37C4A48A44 for ; Fri, 31 Oct 2025 15:38:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3119B4067B; Fri, 31 Oct 2025 15:38:33 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id C60314067B for ; Fri, 31 Oct 2025 15:38:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761921511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XK9Rsmx8llZE2LQFqy3C0KplB26ksE2ac9EiU2AXSlg=; b=CwIcI7UsLWcabpW3mg7RZ98CRiTeLhA2WJpAMVGUPeT2w+mcLmX5GGvPsIOlhk3wDolBuJ gy6J5Y6nYnx+Ssgt3x+VJtN0I0BIuBYOg6b/5YydRzl8II71JwoHr7/ETfsSEV6d5SWvWJ 36fPdldh59jMsGNE2Lvy8V+jupdHexY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107-DhZ9wcT4MlKxvaBO-1E2OA-1; Fri, 31 Oct 2025 10:38:27 -0400 X-MC-Unique: DhZ9wcT4MlKxvaBO-1E2OA-1 X-Mimecast-MFC-AGG-ID: DhZ9wcT4MlKxvaBO-1E2OA_1761921506 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9ABE518089A2; Fri, 31 Oct 2025 14:38:26 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.50]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 131531800579; Fri, 31 Oct 2025 14:38:24 +0000 (UTC) From: Kevin Traynor To: Anatoly Burakov Cc: Bruce Richardson , dpdk stable Subject: patch 'net/ice: remove indirection for FDIR filters' has been queued to stable release 24.11.4 Date: Fri, 31 Oct 2025 14:33:23 +0000 Message-ID: <20251031143421.324432-81-ktraynor@redhat.com> In-Reply-To: <20251031143421.324432-1-ktraynor@redhat.com> References: <20251031143421.324432-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: v2x8Rn3KQHgU16_1r49ifp7gNB3Yebarr3A6nx_yNtg_1761921506 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/05/25. 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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/64aa5ac4824f21eb5701d3cbf2d129e8ed8d1e7d Thanks. Kevin --- >From 64aa5ac4824f21eb5701d3cbf2d129e8ed8d1e7d Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Fri, 10 Oct 2025 14:13:19 +0100 Subject: [PATCH] net/ice: remove indirection for FDIR filters [ upstream commit f1dd6c3fdf974810e9a0d57920a4aa66fa16342e ] Currently, when filters are created for FDIR, they are allocated dynamically using `ice_malloc()`. Not only this is inconsistent with hash filter code paths (hash uses embedded structures), this is also creating unnecessary indirection and complexity, and creates a memory leak where, if something fails during raw pattern parse, the profile memory isn't deallocated. Since there is no actual reason for why FDIR filter profile must use indirection, instead of fixing the memory leak just avoid it altogether by making the filter profile an embedded struct. When parsing begins, the entire scratch filter structure is zeroed out anyway, so there is no need to add any additional zero-initialization code. Fixes: 25be39cc1760 ("net/ice: enable protocol agnostic flow offloading in FDIR") Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- drivers/net/ice/ice_ethdev.h | 2 +- drivers/net/ice/ice_fdir_filter.c | 30 +++++++++++------------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index a5b27fabd2..6fcb3296ed 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -347,5 +347,5 @@ struct ice_fdir_filter_conf { uint32_t mark_flag; - struct ice_parser_profile *prof; + struct ice_parser_profile prof; bool parser_ena; u8 *pkt_buf; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index dc28328c09..688f037d2e 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1313,5 +1313,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, struct ice_hw *hw = ICE_PF_TO_HW(pf); - int id = ice_find_first_bit(filter->prof->ptypes, UINT16_MAX); + int id = ice_find_first_bit(filter->prof.ptypes, UINT16_MAX); int ptg = hw->blk[ICE_BLK_FD].xlt1.t[id]; u16 ctrl_vsi = pf->fdir.fdir_vsi->idx; @@ -1323,9 +1323,9 @@ ice_fdir_create_filter(struct ice_adapter *ad, for (i = 0; i < ICE_MAX_FV_WORDS; i++) if (pi->prof.fv[i].proto_id != - filter->prof->fv[i].proto_id || + filter->prof.fv[i].proto_id || pi->prof.fv[i].offset != - filter->prof->fv[i].offset || + filter->prof.fv[i].offset || pi->prof.fv[i].msk != - filter->prof->fv[i].msk) + filter->prof.fv[i].msk) break; if (i == ICE_MAX_FV_WORDS) { @@ -1337,5 +1337,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (!fv_found) { ret = ice_flow_set_hw_prof(hw, main_vsi, ctrl_vsi, - filter->prof, ICE_BLK_FD); + &filter->prof, ICE_BLK_FD); if (ret) goto error; @@ -1347,10 +1347,10 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (!fv_found) { - for (i = 0; i < filter->prof->fv_num; i++) { + for (i = 0; i < filter->prof.fv_num; i++) { pi->prof.fv[i].proto_id = - filter->prof->fv[i].proto_id; + filter->prof.fv[i].proto_id; pi->prof.fv[i].offset = - filter->prof->fv[i].offset; - pi->prof.fv[i].msk = filter->prof->fv[i].msk; + filter->prof.fv[i].offset; + pi->prof.fv[i].msk = filter->prof.fv[i].msk; } pi->fdir_actived_cnt = 1; @@ -1450,5 +1450,4 @@ free_entry: error: - rte_free(filter->prof); rte_free(filter->pkt_buf); return -rte_errno; @@ -1472,5 +1471,5 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, struct ice_hw *hw = ICE_PF_TO_HW(pf); - int id = ice_find_first_bit(filter->prof->ptypes, UINT16_MAX); + int id = ice_find_first_bit(filter->prof.ptypes, UINT16_MAX); int ptg = hw->blk[ICE_BLK_FD].xlt1.t[id]; u16 ctrl_vsi = pf->fdir.fdir_vsi->idx; @@ -1500,5 +1499,4 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, flow->rule = NULL; - rte_free(filter->prof); rte_free(filter->pkt_buf); rte_free(filter); @@ -1927,11 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; - filter->prof = (struct ice_parser_profile *) - ice_malloc(&ad->hw, sizeof(*filter->prof)); - if (!filter->prof) - return -ENOMEM; - if (ice_parser_profile_init(&rslt, tmp_spec, tmp_mask, - pkt_len, ICE_BLK_FD, true, filter->prof)) + pkt_len, ICE_BLK_FD, true, &filter->prof)) return -rte_errno; @@ -2489,5 +2482,4 @@ ice_fdir_parse(struct ice_adapter *ad, return ret; error: - rte_free(filter->prof); rte_free(filter->pkt_buf); rte_free(item); -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-31 13:53:54.684351527 +0000 +++ 0081-net-ice-remove-indirection-for-FDIR-filters.patch 2025-10-31 13:53:52.182523824 +0000 @@ -1 +1 @@ -From f1dd6c3fdf974810e9a0d57920a4aa66fa16342e Mon Sep 17 00:00:00 2001 +From 64aa5ac4824f21eb5701d3cbf2d129e8ed8d1e7d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f1dd6c3fdf974810e9a0d57920a4aa66fa16342e ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -25,2 +26,2 @@ - drivers/net/intel/ice/ice_ethdev.h | 2 +- - drivers/net/intel/ice/ice_fdir_filter.c | 30 +++++++++---------------- + drivers/net/ice/ice_ethdev.h | 2 +- + drivers/net/ice/ice_fdir_filter.c | 30 +++++++++++------------------- @@ -29,5 +30,5 @@ -diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h -index a0d2082206..6478d6dfbd 100644 ---- a/drivers/net/intel/ice/ice_ethdev.h -+++ b/drivers/net/intel/ice/ice_ethdev.h -@@ -380,5 +380,5 @@ struct ice_fdir_filter_conf { +diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h +index a5b27fabd2..6fcb3296ed 100644 +--- a/drivers/net/ice/ice_ethdev.h ++++ b/drivers/net/ice/ice_ethdev.h +@@ -347,5 +347,5 @@ struct ice_fdir_filter_conf { @@ -40,5 +41,5 @@ -diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c -index d41d223d52..d593624792 100644 ---- a/drivers/net/intel/ice/ice_fdir_filter.c -+++ b/drivers/net/intel/ice/ice_fdir_filter.c -@@ -1315,5 +1315,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, +diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c +index dc28328c09..688f037d2e 100644 +--- a/drivers/net/ice/ice_fdir_filter.c ++++ b/drivers/net/ice/ice_fdir_filter.c +@@ -1313,5 +1313,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -51 +52 @@ -@@ -1325,9 +1325,9 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1323,9 +1323,9 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -64 +65 @@ -@@ -1339,5 +1339,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1337,5 +1337,5 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -71 +72 @@ -@@ -1349,10 +1349,10 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1347,10 +1347,10 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -86 +87 @@ -@@ -1452,5 +1452,4 @@ free_entry: +@@ -1450,5 +1450,4 @@ free_entry: @@ -92 +93 @@ -@@ -1474,5 +1473,5 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, +@@ -1472,5 +1471,5 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, @@ -99 +100 @@ -@@ -1502,5 +1501,4 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, +@@ -1500,5 +1499,4 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, @@ -105 +106 @@ -@@ -1929,11 +1927,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1927,11 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -118 +119 @@ -@@ -2496,5 +2489,4 @@ ice_fdir_parse(struct ice_adapter *ad, +@@ -2489,5 +2482,4 @@ ice_fdir_parse(struct ice_adapter *ad,