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 C864E489EF for ; Mon, 27 Oct 2025 17:22:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C203D4067D; Mon, 27 Oct 2025 17:22:41 +0100 (CET) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 072724028B for ; Mon, 27 Oct 2025 17:22:40 +0100 (CET) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4710665e7deso25505745e9.1 for ; Mon, 27 Oct 2025 09:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761582159; x=1762186959; 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=/BkxWQqSDSc5fkP3Un4dOHtA+OI43PoMuxE6Jf7FE+M=; b=PHa9AX5T0afjvyIWA9MD6Sksj5PJv/tHlLLhDa5fFiBvuxMKiBIiCKomA3wUJ3AQnG RwMCpxCVSiOAPf7LFOOhjN0MGxXj4SIfZVe976fkDUC09OoHb9IJkrU8wgf9M5jcyTM4 or0VUQ0lVEYwqtEwRI/thKtZFE3mW1MRB3UpoN8LMjimQXxghI2nw1LlWXgk/MgR1ph6 0Fh9LOmCTz78nNHmmnkf1gjeflBzyr5MJUk1FabPsjAUIBRODbSE/Dbu5LThppXnqWYu /oH3jB398Zn/H+KE3Hl6B/E09LPRpb1s+VJJEIX6Na/pHJXbPMhIgcced3jTKduG5owC y3zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761582159; x=1762186959; 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=/BkxWQqSDSc5fkP3Un4dOHtA+OI43PoMuxE6Jf7FE+M=; b=b93hNm7TfXb7V7pxhpCc76CXZZ+ewkJCDlFwEFg3byT58OIAogsdsZgHmKfUzMFQhC tDLanB8HezzveHFiTIfp1fGqZjNdTQXqFTJ9cwLqApUMNP2SCzAmKlMnUZ6kcyy/gwEv NXYNnp2zVTfusLtuP+EZAKIrAb0gAmZeiZrV38gSM8EJ7NtVw/UbmY1FPTRU/q+NtB0C 47ahFNDmE4F079YfzUDu8MWJCTUqJj4z4lrWb0BBZzbosLAPudnJJl7YTBrG/TBTLd5d IU+Z2oLPxzsHZKiQx+kKLItAizyQ5DqM3USpxH9vW2m01jLyj3DwVXdzu0UGsuN2IwNX HRZA== X-Forwarded-Encrypted: i=1; AJvYcCUd3djAVqpJv721apk4U1HFJ/16yNZBOMCKZHQJwUh5WIugQtOB4+icknOxUvUyVlG5VU7vHj8=@dpdk.org X-Gm-Message-State: AOJu0YzCw7gIzeQ474JTkFl6jkEbUmNURJWead7QeWr8c9lYrk8eTJ5i pABhyQMYOWGxdhNXfC7n0bWVNq2JBMRZu0x78xdrI+AMo7WSH8JKm8+q X-Gm-Gg: ASbGncv07W6enmBEQ9YfFCiCvCxKbgmq8ZGz9v4qJyobYdInz9XThcCkm+plmHgyCn2 lnWtU9sOYjyh/gDD6MyJtFQ3EHAYiBObk8QzI6FGrjFtqhL/mKp68NfLZZEo38bCXcXPCGh1KFl EYXojuvZiBxZ/2rxi25sX9mQFahtcoQIAbwP1o/Z+YY4WOahpBa6PS9Ro6CMgShtoC/aNzh80Of zh+cwSFpL5f9dhp6STItSwA1mQ1ttxJ2y7SOKxh3q5RbPfdrwwElye9knPaBNXx65AbwFOMPTJr iuHxREx8Y/x+x3I+B/km1rsNoOUdq1ggPL08ImyeF3wq0wDB2ZmofR/qq9JjviMkzKMRcHu8J5J CIUZ/SV3ipCT51tRx8/gbJnBxhb9Xvvi1l7nh6kJtMktebeyXLNzbVm4C+rv4QcH5M7qpqdUuLx AtNB517Q== X-Google-Smtp-Source: AGHT+IGi3xX6kF4hwDY+48ZPXhe0AjVMJzeEMf/EIObzBuSbcLHLYavd85I7ACYJvNkZ3z7M0MMXbA== X-Received: by 2002:a05:600c:5307:b0:477:ad4:4920 with SMTP id 5b1f17b1804b1-47717dfc594mr2145385e9.10.1761582159448; Mon, 27 Oct 2025 09:22:39 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:6fc5:c3bc:147e:832c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-475ddb01036sm69421785e9.13.2025.10.27.09.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Oct 2025 09:22:38 -0700 (PDT) From: luca.boccassi@gmail.com To: Anatoly Burakov Cc: Bruce Richardson , dpdk stable Subject: patch 'net/ice: remove indirection for FDIR filters' has been queued to stable release 22.11.11 Date: Mon, 27 Oct 2025 16:19:25 +0000 Message-ID: <20251027162001.3710450-47-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251027162001.3710450-1-luca.boccassi@gmail.com> References: <20251027162001.3710450-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 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 22.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/29/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/b16d67cc79ec48e31b1478e81bd5648b713c50f4 Thanks. Luca Boccassi --- >From b16d67cc79ec48e31b1478e81bd5648b713c50f4 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 9799cad394..7cee77b898 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -345,7 +345,7 @@ struct ice_fdir_filter_conf { uint64_t input_set_i; /* only for tunnel inner fields */ uint32_t mark_flag; - struct ice_parser_profile *prof; + struct ice_parser_profile prof; bool parser_ena; u8 *pkt_buf; u8 pkt_len; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 7e97547d8b..8829041c47 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1330,7 +1330,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (filter->parser_ena) { 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; u16 main_vsi = pf->main_vsi->idx; @@ -1340,11 +1340,11 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (pi->fdir_actived_cnt != 0) { 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) { fv_found = true; @@ -1354,7 +1354,7 @@ 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; } @@ -1364,12 +1364,12 @@ ice_fdir_create_filter(struct ice_adapter *ad, goto error; 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; } @@ -1467,7 +1467,6 @@ free_entry: return -rte_errno; error: - rte_free(filter->prof); rte_free(filter->pkt_buf); return -rte_errno; } @@ -1489,7 +1488,7 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, if (filter->parser_ena) { 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; u16 main_vsi = pf->main_vsi->idx; @@ -1517,7 +1516,6 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, flow->rule = NULL; - rte_free(filter->prof); rte_free(filter->pkt_buf); rte_free(filter); @@ -1944,13 +1942,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, if (!tmp_mask) 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; u8 *pkt_buf = (u8 *)ice_malloc(&ad->hw, pkt_len + 1); @@ -2509,7 +2502,6 @@ ice_fdir_parse(struct ice_adapter *ad, rte_free(item); return ret; error: - rte_free(filter->prof); rte_free(filter->pkt_buf); rte_free(item); return ret; -- 2.47.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-27 15:54:36.548631009 +0000 +++ 0047-net-ice-remove-indirection-for-FDIR-filters.patch 2025-10-27 15:54:34.815950051 +0000 @@ -1 +1 @@ -From f1dd6c3fdf974810e9a0d57920a4aa66fa16342e Mon Sep 17 00:00:00 2001 +From b16d67cc79ec48e31b1478e81bd5648b713c50f4 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 -@@ -379,7 +379,7 @@ struct ice_fdir_filter_conf { +diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h +index 9799cad394..7cee77b898 100644 +--- a/drivers/net/ice/ice_ethdev.h ++++ b/drivers/net/ice/ice_ethdev.h +@@ -345,7 +345,7 @@ struct ice_fdir_filter_conf { @@ -42,5 +43,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 -@@ -1314,7 +1314,7 @@ 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 7e97547d8b..8829041c47 100644 +--- a/drivers/net/ice/ice_fdir_filter.c ++++ b/drivers/net/ice/ice_fdir_filter.c +@@ -1330,7 +1330,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -55 +56 @@ -@@ -1324,11 +1324,11 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1340,11 +1340,11 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -70 +71 @@ -@@ -1338,7 +1338,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1354,7 +1354,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -79 +80 @@ -@@ -1348,12 +1348,12 @@ ice_fdir_create_filter(struct ice_adapter *ad, +@@ -1364,12 +1364,12 @@ ice_fdir_create_filter(struct ice_adapter *ad, @@ -96 +97 @@ -@@ -1451,7 +1451,6 @@ free_entry: +@@ -1467,7 +1467,6 @@ free_entry: @@ -104 +105 @@ -@@ -1473,7 +1472,7 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, +@@ -1489,7 +1488,7 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, @@ -113 +114 @@ -@@ -1501,7 +1500,6 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, +@@ -1517,7 +1516,6 @@ ice_fdir_destroy_filter(struct ice_adapter *ad, @@ -121 +122 @@ -@@ -1928,13 +1926,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1944,13 +1942,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -136 +137 @@ -@@ -2495,7 +2488,6 @@ ice_fdir_parse(struct ice_adapter *ad, +@@ -2509,7 +2502,6 @@ ice_fdir_parse(struct ice_adapter *ad,