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 3ACA945C9B for ; Tue, 12 Nov 2024 23:09:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31B4C4064C; Tue, 12 Nov 2024 23:09:02 +0100 (CET) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 48CB34064C for ; Tue, 12 Nov 2024 23:09:01 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so50446015e9.3 for ; Tue, 12 Nov 2024 14:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731449341; x=1732054141; 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=MxKWUs2PCo1ivfxTp2r05hQaXFgH1Pity1tLL7YLJaI=; b=CJzuD3L52igGvbPM5dWOVw/B6GW88p2HUopNjfu+OCWefTtchCtvEzWscs/L8CLz2K JJrPmtUmHLDtzYnklPsvcEyCsMb7tLI8btSL0PLQKmwzTp3Lg5eZOufLjxdH+eB0qwwD eYey/LnOljN8ac5cqXNmsHnWtiqBooKd4B1JGJjQ158ULKOegUIgCzbJQf48nn6cbBQa MYslj55Uqjuo2f7Lfq+8WyMatcpqemBq6ntpUngdUqLBtHgKaoVjFVvie/qsHRgCOR7d gyKR+tPoOlFrGkL2RTNFhwPRaZGLgyH8geAxGZG4lWwzmjOnW6Wl5whRFLGUtDqpcJNz jsHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731449341; x=1732054141; 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=MxKWUs2PCo1ivfxTp2r05hQaXFgH1Pity1tLL7YLJaI=; b=U8i0PNwMHiFfuP1jLwCZXfgW2Hg84EZzSBF8BTUJ1TIlQK81JrIyXSNyBWT4+PPTqn 6ihLDeYP3i1p4UKDrZB1PoIAvtZ/Jc2wGdmWnsi9rf1gdF702TTOPbwgRVFQDAkRpMo7 AOoP5cYunEObbTg8eIW21lbZikE/GB4z1/+TgJWqT/cvqnyM4xWf6PPDmLZQi8NvMibb uwPCcYFCxGEagUap4bAU62MmHc/YNxgusO64jxgwV4UODorkikdxv2tDGgAD4hhISMii 2PfdT1sq3KtOdwlUGqOwjh3PcC0YPmRzrPyZEkhCcOgtqHC30KAW3r/SLiX9SPgtoa6R NPYQ== X-Forwarded-Encrypted: i=1; AJvYcCXLmAnRuIDODY/uKNfAvzh/Y3PvDcgG4g+8Ar8PK3Qp9vTIwnY600Pi48h5BGg6a+8VLJZjGuA=@dpdk.org X-Gm-Message-State: AOJu0YyP9W1Fsu+AclZqWkg+stDWBLBY1F/ke6HHIMAuYK+cIdwW+yqp VHT3PEibugqWXZg2079oQaYL/RB6unI8ojvWlvonD12lj8faiGWB X-Google-Smtp-Source: AGHT+IEylutSGEgRK3FiCvrUb/zW3R3VErqufgxJ+XYkrVZaAGQIwULR2UJcacKqUapRO72PXR7Keg== X-Received: by 2002:a05:600c:3b19:b0:431:5a93:4e3c with SMTP id 5b1f17b1804b1-432cce77fe7mr38254275e9.16.1731449340697; Tue, 12 Nov 2024 14:09:00 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:e89d:e9a1:da72:2f9d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed9ea653sm16235076f8f.65.2024.11.12.14.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 14:09:00 -0800 (PST) From: luca.boccassi@gmail.com To: Gagandeep Singh Cc: Hemant Agrawal , dpdk stable Subject: patch 'net/dpaa2: fix memory corruption in TM' has been queued to stable release 22.11.7 Date: Tue, 12 Nov 2024 22:07:27 +0000 Message-ID: <20241112220754.666489-17-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112220754.666489-1-luca.boccassi@gmail.com> References: <20241023211704.1216956-79-luca.boccassi@gmail.com> <20241112220754.666489-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.7 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/14/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/6d54a1e341c5b271c7b44c91c44384d88ab4dd68 Thanks. Luca Boccassi --- >From 6d54a1e341c5b271c7b44c91c44384d88ab4dd68 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 23 Oct 2024 17:29:47 +0530 Subject: [PATCH] net/dpaa2: fix memory corruption in TM [ upstream commit d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 ] driver was reserving memory in an array for 8 queues only, but it can support many more queues configuration. This patch fixes the memory corruption issue by defining the queue array with correct size. Fixes: 72100f0dee21 ("net/dpaa2: support level 2 in traffic management") Signed-off-by: Gagandeep Singh Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_tm.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c index 8fe5bfa013..0633259624 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -684,6 +684,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, struct dpaa2_tm_node *leaf_node, *temp_leaf_node, *channel_node; struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private; int ret, t; + bool conf_schedule = false; /* Populate TCs */ LIST_FOREACH(channel_node, &priv->nodes, next) { @@ -757,7 +758,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, } LIST_FOREACH(channel_node, &priv->nodes, next) { - int wfq_grp = 0, is_wfq_grp = 0, conf[DPNI_MAX_TC]; + int wfq_grp = 0, is_wfq_grp = 0, conf[priv->nb_tx_queues]; struct dpni_tx_priorities_cfg prio_cfg; memset(&prio_cfg, 0, sizeof(prio_cfg)); @@ -767,6 +768,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, if (channel_node->level_id != CHANNEL_LEVEL) continue; + conf_schedule = false; LIST_FOREACH(leaf_node, &priv->nodes, next) { struct dpaa2_queue *leaf_dpaa2_q; uint8_t leaf_tc_id; @@ -789,6 +791,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, if (leaf_node->parent != channel_node) continue; + conf_schedule = true; leaf_dpaa2_q = (struct dpaa2_queue *)dev->data->tx_queues[leaf_node->id]; leaf_tc_id = leaf_dpaa2_q->tc_index; /* Process sibling leaf nodes */ @@ -829,8 +832,8 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, goto out; } is_wfq_grp = 1; - conf[temp_leaf_node->id] = 1; } + conf[temp_leaf_node->id] = 1; } if (is_wfq_grp) { if (wfq_grp == 0) { @@ -851,6 +854,9 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, } conf[leaf_node->id] = 1; } + if (!conf_schedule) + continue; + if (wfq_grp > 1) { prio_cfg.separate_groups = 1; if (prio_cfg.prio_group_B < prio_cfg.prio_group_A) { @@ -864,6 +870,16 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, prio_cfg.prio_group_A = 1; prio_cfg.channel_idx = channel_node->channel_id; + DPAA2_PMD_DEBUG("########################################\n"); + DPAA2_PMD_DEBUG("Channel idx = %d\n", prio_cfg.channel_idx); + for (t = 0; t < DPNI_MAX_TC; t++) + DPAA2_PMD_DEBUG("tc = %d mode = %d, delta = %d\n", t, + prio_cfg.tc_sched[t].mode, + prio_cfg.tc_sched[t].delta_bandwidth); + + DPAA2_PMD_DEBUG("prioritya = %d, priorityb = %d, separate grps" + " = %d\n", prio_cfg.prio_group_A, + prio_cfg.prio_group_B, prio_cfg.separate_groups); ret = dpni_set_tx_priorities(dpni, 0, priv->token, &prio_cfg); if (ret) { ret = -rte_tm_error_set(error, EINVAL, @@ -871,15 +887,6 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, "Scheduling Failed\n"); goto out; } - DPAA2_PMD_DEBUG("########################################\n"); - DPAA2_PMD_DEBUG("Channel idx = %d\n", prio_cfg.channel_idx); - for (t = 0; t < DPNI_MAX_TC; t++) { - DPAA2_PMD_DEBUG("tc = %d mode = %d ", t, prio_cfg.tc_sched[t].mode); - DPAA2_PMD_DEBUG("delta = %d\n", prio_cfg.tc_sched[t].delta_bandwidth); - } - DPAA2_PMD_DEBUG("prioritya = %d\n", prio_cfg.prio_group_A); - DPAA2_PMD_DEBUG("priorityb = %d\n", prio_cfg.prio_group_B); - DPAA2_PMD_DEBUG("separate grps = %d\n\n", prio_cfg.separate_groups); } return 0; -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-12 22:06:59.236237019 +0000 +++ 0017-net-dpaa2-fix-memory-corruption-in-TM.patch 2024-11-12 22:06:58.659307077 +0000 @@ -1 +1 @@ -From d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 Mon Sep 17 00:00:00 2001 +From 6d54a1e341c5b271c7b44c91c44384d88ab4dd68 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index fb8c384ca4..ab3e355853 100644 +index 8fe5bfa013..0633259624 100644 @@ -82,2 +83,2 @@ -+ DPAA2_PMD_DEBUG("########################################"); -+ DPAA2_PMD_DEBUG("Channel idx = %d", prio_cfg.channel_idx); ++ DPAA2_PMD_DEBUG("########################################\n"); ++ DPAA2_PMD_DEBUG("Channel idx = %d\n", prio_cfg.channel_idx); @@ -85 +86 @@ -+ DPAA2_PMD_DEBUG("tc = %d mode = %d, delta = %d", t, ++ DPAA2_PMD_DEBUG("tc = %d mode = %d, delta = %d\n", t, @@ -90 +91 @@ -+ " = %d", prio_cfg.prio_group_A, ++ " = %d\n", prio_cfg.prio_group_A, @@ -99,2 +100,2 @@ -- DPAA2_PMD_DEBUG("########################################"); -- DPAA2_PMD_DEBUG("Channel idx = %d", prio_cfg.channel_idx); +- DPAA2_PMD_DEBUG("########################################\n"); +- DPAA2_PMD_DEBUG("Channel idx = %d\n", prio_cfg.channel_idx); @@ -103 +104 @@ -- DPAA2_PMD_DEBUG("delta = %d", prio_cfg.tc_sched[t].delta_bandwidth); +- DPAA2_PMD_DEBUG("delta = %d\n", prio_cfg.tc_sched[t].delta_bandwidth); @@ -105,3 +106,3 @@ -- DPAA2_PMD_DEBUG("prioritya = %d", prio_cfg.prio_group_A); -- DPAA2_PMD_DEBUG("priorityb = %d", prio_cfg.prio_group_B); -- DPAA2_PMD_DEBUG("separate grps = %d", prio_cfg.separate_groups); +- DPAA2_PMD_DEBUG("prioritya = %d\n", prio_cfg.prio_group_A); +- DPAA2_PMD_DEBUG("priorityb = %d\n", prio_cfg.prio_group_B); +- DPAA2_PMD_DEBUG("separate grps = %d\n\n", prio_cfg.separate_groups);