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 1430548A44 for ; Fri, 31 Oct 2025 15:39:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D50D40697; Fri, 31 Oct 2025 15:39:49 +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 53D7C406A2 for ; Fri, 31 Oct 2025 15:39:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761921587; 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=tgEJDyButoo7EarWqqJwNjRhmqnmFKcdoUyDILNpjUE=; b=FhgXcpZ9cmmGYelQcDcyEr2FhYSP0iYhvNr144zLJVhhLNmkSssVuajiaQXjYmGDRCWXhG TdOcy0hKfcX+AzpCsNOjI/V2LXltZXEpGAyAhYAL7JWYivYTh+5hhhchmH7hUExew7Z3V4 w7vqVTKcC1H2taZ0+pBYzE2E1BoKztw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-ICjsG4dwOhOuxBHw0vHsqA-1; Fri, 31 Oct 2025 10:39:46 -0400 X-MC-Unique: ICjsG4dwOhOuxBHw0vHsqA-1 X-Mimecast-MFC-AGG-ID: ICjsG4dwOhOuxBHw0vHsqA_1761921585 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C15D4195608D; Fri, 31 Oct 2025 14:39:45 +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 8439D18004D4; Fri, 31 Oct 2025 14:39:44 +0000 (UTC) From: Kevin Traynor To: Jun Yang Cc: dpdk stable Subject: patch 'net/dpaa2: fix flow rule resizing' has been queued to stable release 24.11.4 Date: Fri, 31 Oct 2025 14:34:00 +0000 Message-ID: <20251031143421.324432-118-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: zT-2G3-zed0yBnhm1rQAkyMUk70IX-gz9xv0HKGLWmA_1761921585 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/fcc33d7ad35889c6f80315704bd4fa87e67b1238 Thanks. Kevin --- >From fcc33d7ad35889c6f80315704bd4fa87e67b1238 Mon Sep 17 00:00:00 2001 From: Jun Yang Date: Thu, 16 Oct 2025 15:57:56 +0530 Subject: [PATCH] net/dpaa2: fix flow rule resizing [ upstream commit 3904f568b8e9987c82a4123776a62e4ca9857f1d ] Appending new extract need resize the flow's rule. The rule's size should start from new extract's position plus it's size unless the position is less than rule's original size. Fixes: 56c1817d532e ("net/dpaa2: refactor flow engine") Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_flow.c | 123 ++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 26 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index c94eb51ba5..810b6fae4b 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -631,12 +631,9 @@ dpaa2_flow_rule_insert_hole(struct dpaa2_dev_flow *flow, enum dpaa2_flow_dist_type dist_type) { - int end; - if (dist_type & DPAA2_FLOW_QOS_TYPE) { - end = flow->qos_rule_size; - if (end > offset) { + if (offset < flow->qos_rule_size) { memmove(flow->qos_key_addr + offset + size, flow->qos_key_addr + offset, - end - offset); + flow->qos_rule_size - offset); memset(flow->qos_key_addr + offset, 0, size); @@ -644,17 +641,18 @@ dpaa2_flow_rule_insert_hole(struct dpaa2_dev_flow *flow, memmove(flow->qos_mask_addr + offset + size, flow->qos_mask_addr + offset, - end - offset); + flow->qos_rule_size - offset); memset(flow->qos_mask_addr + offset, 0, size); + flow->qos_rule_size += size; + } else { + flow->qos_rule_size = offset + size; } - flow->qos_rule_size += size; } if (dist_type & DPAA2_FLOW_FS_TYPE) { - end = flow->fs_rule_size; - if (end > offset) { + if (offset < flow->fs_rule_size) { memmove(flow->fs_key_addr + offset + size, flow->fs_key_addr + offset, - end - offset); + flow->fs_rule_size - offset); memset(flow->fs_key_addr + offset, 0, size); @@ -662,9 +660,11 @@ dpaa2_flow_rule_insert_hole(struct dpaa2_dev_flow *flow, memmove(flow->fs_mask_addr + offset + size, flow->fs_mask_addr + offset, - end - offset); + flow->fs_rule_size - offset); memset(flow->fs_mask_addr + offset, 0, size); + flow->fs_rule_size += size; + } else { + flow->fs_rule_size = offset + size; } - flow->fs_rule_size += size; } @@ -1489,6 +1489,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, if (!(*key_addr) && - key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->qos_rule_size++; + key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT && + offset >= flow->qos_rule_size) + flow->qos_rule_size = offset + sizeof(uint8_t); *key_addr |= (1 << faf_bit_in_byte); @@ -1511,6 +1512,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, if (!(*key_addr) && - key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->fs_rule_size++; + key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT && + offset >= flow->fs_rule_size) + flow->fs_rule_size = offset + sizeof(uint8_t); *key_addr |= (1 << faf_bit_in_byte); @@ -1530,4 +1532,5 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, int offset; uint32_t pr_field = pr_offset << 16 | pr_size; + char offset_info[64], size_info[64], rule_size_info[64]; offset = dpaa2_flow_extract_key_offset(key_profile, @@ -1538,17 +1541,41 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, return -EINVAL; } + sprintf(offset_info, "offset(%d)", offset); + sprintf(size_info, "size(%d)", pr_size); if (dist_type & DPAA2_FLOW_QOS_TYPE) { + sprintf(rule_size_info, "qos rule size(%d)", + flow->qos_rule_size); memcpy((flow->qos_key_addr + offset), key, pr_size); memcpy((flow->qos_mask_addr + offset), mask, pr_size); - if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->qos_rule_size = offset + pr_size; + if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) { + if (offset >= flow->qos_rule_size) { + flow->qos_rule_size = offset + pr_size; + } else if ((offset + pr_size) > flow->qos_rule_size) { + DPAA2_PMD_ERR("%s < %s, but %s + %s > %s", + offset_info, rule_size_info, + offset_info, size_info, + rule_size_info); + return -EINVAL; + } + } } if (dist_type & DPAA2_FLOW_FS_TYPE) { + sprintf(rule_size_info, "fs rule size(%d)", + flow->fs_rule_size); memcpy((flow->fs_key_addr + offset), key, pr_size); memcpy((flow->fs_mask_addr + offset), mask, pr_size); - if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->fs_rule_size = offset + pr_size; + if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) { + if (offset >= flow->fs_rule_size) { + flow->fs_rule_size = offset + pr_size; + } else if ((offset + pr_size) > flow->fs_rule_size) { + DPAA2_PMD_ERR("%s < %s, but %s + %s > %s", + offset_info, rule_size_info, + offset_info, size_info, + rule_size_info); + return -EINVAL; + } + } } @@ -1564,4 +1591,5 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, { int offset; + char offset_info[64], size_info[64], rule_size_info[64]; if (dpaa2_flow_ip_address_extract(prot, field)) { @@ -1578,17 +1606,39 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, return -EINVAL; } + sprintf(offset_info, "offset(%d)", offset); + sprintf(size_info, "size(%d)", size); if (dist_type & DPAA2_FLOW_QOS_TYPE) { + sprintf(rule_size_info, "qos rule size(%d)", + flow->qos_rule_size); memcpy((flow->qos_key_addr + offset), key, size); memcpy((flow->qos_mask_addr + offset), mask, size); - if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->qos_rule_size = offset + size; + if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) { + if (offset >= flow->qos_rule_size) { + flow->qos_rule_size = offset + size; + } else if ((offset + size) > flow->qos_rule_size) { + DPAA2_PMD_ERR("%s: %s < %s, but %s + %s > %s", + __func__, offset_info, rule_size_info, + offset_info, size_info, rule_size_info); + return -EINVAL; + } + } } if (dist_type & DPAA2_FLOW_FS_TYPE) { + sprintf(rule_size_info, "fs rule size(%d)", + flow->fs_rule_size); memcpy((flow->fs_key_addr + offset), key, size); memcpy((flow->fs_mask_addr + offset), mask, size); - if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) - flow->fs_rule_size = offset + size; + if (key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) { + if (offset >= flow->fs_rule_size) { + flow->fs_rule_size = offset + size; + } else if ((offset + size) > flow->fs_rule_size) { + DPAA2_PMD_ERR("%s: %s < %s, but %s + %s > %s", + __func__, offset_info, rule_size_info, + offset_info, size_info, rule_size_info); + return -EINVAL; + } + } } @@ -1606,4 +1656,5 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, DPAA2_FLOW_MAX_KEY_SIZE : size; int offset, field; + char offset_info[64], size_info[64], rule_size_info[64]; field = extract_offset << DPAA2_FLOW_RAW_OFFSET_FIELD_SHIFT; @@ -1616,15 +1667,35 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, return -EINVAL; } + sprintf(offset_info, "offset(%d)", offset); + sprintf(size_info, "size(%d)", size); if (dist_type & DPAA2_FLOW_QOS_TYPE) { + sprintf(rule_size_info, "qos rule size(%d)", + flow->qos_rule_size); memcpy((flow->qos_key_addr + offset), key, size); memcpy((flow->qos_mask_addr + offset), mask, size); - flow->qos_rule_size = offset + size; + if (offset >= flow->qos_rule_size) { + flow->qos_rule_size = offset + size; + } else if ((offset + size) > flow->qos_rule_size) { + DPAA2_PMD_ERR("%s: %s < %s, but %s + %s > %s", + __func__, offset_info, rule_size_info, + offset_info, size_info, rule_size_info); + return -EINVAL; + } } if (dist_type & DPAA2_FLOW_FS_TYPE) { + sprintf(rule_size_info, "fs rule size(%d)", + flow->fs_rule_size); memcpy((flow->fs_key_addr + offset), key, size); memcpy((flow->fs_mask_addr + offset), mask, size); - flow->fs_rule_size = offset + size; + if (offset >= flow->fs_rule_size) { + flow->fs_rule_size = offset + size; + } else if ((offset + size) > flow->fs_rule_size) { + DPAA2_PMD_ERR("%s: %s < %s, but %s + %s > %s", + __func__, offset_info, rule_size_info, + offset_info, size_info, rule_size_info); + return -EINVAL; + } } -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-31 13:53:55.778674700 +0000 +++ 0118-net-dpaa2-fix-flow-rule-resizing.patch 2025-10-31 13:53:52.300524192 +0000 @@ -1 +1 @@ -From 3904f568b8e9987c82a4123776a62e4ca9857f1d Mon Sep 17 00:00:00 2001 +From fcc33d7ad35889c6f80315704bd4fa87e67b1238 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3904f568b8e9987c82a4123776a62e4ca9857f1d ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index 299c50dcdf..2e44bff766 100644 +index c94eb51ba5..810b6fae4b 100644 @@ -75 +76 @@ -@@ -1486,6 +1486,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, +@@ -1489,6 +1489,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, @@ -85 +86 @@ -@@ -1508,6 +1509,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, +@@ -1511,6 +1512,7 @@ dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, @@ -95 +96 @@ -@@ -1527,4 +1529,5 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1530,4 +1532,5 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, @@ -101 +102 @@ -@@ -1535,17 +1538,41 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1538,17 +1541,41 @@ dpaa2_flow_pr_rule_data_set(struct dpaa2_dev_flow *flow, @@ -147 +148 @@ -@@ -1561,4 +1588,5 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1564,4 +1591,5 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, @@ -153 +154 @@ -@@ -1575,17 +1603,39 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1578,17 +1606,39 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, @@ -197 +198 @@ -@@ -1603,4 +1653,5 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1606,4 +1656,5 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, @@ -203 +204 @@ -@@ -1613,15 +1664,35 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, +@@ -1616,15 +1667,35 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow,