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 A556743337 for ; Wed, 15 Nov 2023 12:45:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A036B406BA; Wed, 15 Nov 2023 12:45:59 +0100 (CET) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mails.dpdk.org (Postfix) with ESMTP id A7B16406BA for ; Wed, 15 Nov 2023 12:45:57 +0100 (CET) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-32dc918d454so4038347f8f.2 for ; Wed, 15 Nov 2023 03:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700048757; x=1700653557; 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=Vr9YNPlO93/HBN3diW7T+lQFN/RhVdXdG+ScLT3NS1s=; b=LKeLszYMwivd7WTfnNjNmlGNceOEBC9WiYaXDSDUT+u+REHVfaxtphIiNq18YjmDeS ogAkFss4c6kw5ZQy5Ja8+LGhd8/d2oONfQMPozltOh8ImJ0t+ghumYKOQ8IhTvpD3uUa b1e40AYjUL/1e0L3Vif2jYlF/r7GBS0Typ9XLKmaRuansflCIafZFWWCw7DBw3jrPgpi jfHUfLSaJt8jwjc7/t//6633NejKvB/Y/RDcaZr5fh3qJqQsXlh/EhdD0BKHUZYkjyqu I2uZy9gWOVCrkOWe8XyW/mP5AZ3putJc8/RC3nTwiQ49Lc7I8EeQPwQHIxivc0+Fm25H hHlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700048757; x=1700653557; 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=Vr9YNPlO93/HBN3diW7T+lQFN/RhVdXdG+ScLT3NS1s=; b=gZTI7FM65Z4TID+kKDX4WpidVanmuWlFwAJrhznQv4X4/X9v7sND2tcWBtkXFyqAkz 94xWR8moXt92GxYg3medQ0IFDY77ROj6L92XOhsDLOsgK0QSPYIJV1MbCDCKAIiS80oi 6ByG1oPUwzPmuuF6sJElvAjcobb2Orjg+Xf9DjT85JderaTDpY79d4gU0KImkSrg9CSr dJFOPr1E6umDBrzKFWtwuRiTZWoDrtX7O641bCmjm3y24qzQax3meX4sILhFceyunoq1 lwAwfr4V5lDOeQ17TiaYCt6AfaEYSXS3RRBzA1QwQ/NmDpGo7f3h1YEy0jKjiOELgxlu iOPw== X-Gm-Message-State: AOJu0Yy6401wBuI0C5uUODwXl0yNEdgq9QBTSw5aGzl4e55E5BzxsKDz 7dzgqIGKRQ/teWD/B4eWYdw= X-Google-Smtp-Source: AGHT+IGvNF2ju5hNw7J+OcZe+7NUatVm25JUt+5Fw8fH6vgeIhk4NpGybfFYTKgvk/ASPeLpwr4aAQ== X-Received: by 2002:adf:f8cf:0:b0:32d:b8f8:2b18 with SMTP id f15-20020adff8cf000000b0032db8f82b18mr8926393wrq.32.1700048757287; Wed, 15 Nov 2023 03:45:57 -0800 (PST) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id g5-20020a5d46c5000000b0032f7e832cabsm10354094wrs.90.2023.11.15.03.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 03:45:56 -0800 (PST) From: luca.boccassi@gmail.com To: Dariusz Sosnowski Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix hairpin queue unbind' has been queued to stable release 20.11.10 Date: Wed, 15 Nov 2023 11:45:11 +0000 Message-Id: <20231115114515.2355140-12-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231115114515.2355140-1-luca.boccassi@gmail.com> References: <20231108192535.922238-37-luca.boccassi@gmail.com> <20231115114515.2355140-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 20.11.10 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/17/23. 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/7243435622b41dd4a9fe1d0e59f62903886353ca Thanks. Luca Boccassi --- >From 7243435622b41dd4a9fe1d0e59f62903886353ca Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski Date: Thu, 9 Nov 2023 20:01:09 +0200 Subject: [PATCH] net/mlx5: fix hairpin queue unbind [ upstream commit ab2439f80bdf94e2382efe941cf827da6710b5d7 ] Let's take an application with the following configuration: - It uses 2 ports. - Each port has 3 Rx queues and 3 Tx queues. - On each port, Rx queues have a following purposes: - Rx queue 0 - SW queue, - Rx queue 1 - hairpin queue, bound to Tx queue on the same port, - Rx queue 2 - hairpin queue, bound to Tx queue on another port. - On each port, Tx queues have a following purposes: - Tx queue 0 - SW queue, - Tx queue 1 - hairpin queue, bound to Rx queue on the same port, - Tx queue 2 - hairpin queue, bound to Rx queue on another port. - Application configured all of the hairpin queues for manual binding. After ports are configured and queues are set up, if the application does the following API call sequence: 1. rte_eth_dev_start(port_id=0) 2. rte_eth_hairpin_bind(tx_port=0, rx_port=0) 3. rte_eth_hairpin_bind(tx_port=0, rx_port=1) mlx5 PMD fails to modify SQ and logs this error: mlx5_common: mlx5_devx_cmds.c:2079: mlx5_devx_cmd_modify_sq(): Failed to modify SQ using DevX This error was caused by an incorrect unbind operation taken during error handling inside call (3). (3) fails, because port 1 (Rx side of the hairpin) was not started. As a result of this failure, PMD goes into error handling, where all previously bound hairpin queues are unbound. This is incorrect, since this error handling procedure in rte_eth_hairpin_bind() implementation assumes that all hairpin queues are bound to the same rx_port, which is not the case. The following sequence of function calls appears: - rte_eth_hairpin_queue_peer_unbind(rx_port=**1**, rx_queue=1, 0), - mlx5_hairpin_queue_peer_unbind(dev=**port 0**, tx_queue=1, 1). Which violates the hairpin queue destroy flow, by unbinding Tx queue 1 on port 0, before unbinding Rx queue 1 on port 1. This patch fixes that behavior, by filtering Tx queues on which error handling is done to only affect: - hairpin queues (it also reduces unnecessary debug log messages), - hairpin queues connected to the rx_port which is currently processed. Fixes: 37cd4501e873 ("net/mlx5: support two ports hairpin mode") Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_trigger.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 93181d6c93..fb61094e45 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -820,6 +820,11 @@ error: txq_ctrl = mlx5_txq_get(dev, i); if (txq_ctrl == NULL) continue; + if (txq_ctrl->type != MLX5_TXQ_TYPE_HAIRPIN || + txq_ctrl->hairpin_conf.peers[0].port != rx_port) { + mlx5_txq_release(dev, i); + continue; + } rx_queue = txq_ctrl->hairpin_conf.peers[0].queue; rte_eth_hairpin_queue_peer_unbind(rx_port, rx_queue, 0); mlx5_hairpin_queue_peer_unbind(dev, i, 1); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-11-15 11:44:14.122525380 +0000 +++ 0012-net-mlx5-fix-hairpin-queue-unbind.patch 2023-11-15 11:44:13.602388184 +0000 @@ -1 +1 @@ -From ab2439f80bdf94e2382efe941cf827da6710b5d7 Mon Sep 17 00:00:00 2001 +From 7243435622b41dd4a9fe1d0e59f62903886353ca Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ab2439f80bdf94e2382efe941cf827da6710b5d7 ] + @@ -56 +57,0 @@ -Cc: stable@dpdk.org @@ -65 +66 @@ -index 7694140537..4b5becc10c 100644 +index 93181d6c93..fb61094e45 100644 @@ -68 +69 @@ -@@ -845,6 +845,11 @@ error: +@@ -820,6 +820,11 @@ error: @@ -72 +73 @@ -+ if (!txq_ctrl->is_hairpin || ++ if (txq_ctrl->type != MLX5_TXQ_TYPE_HAIRPIN ||