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 EAA15A0524 for ; Fri, 5 Feb 2021 12:37:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DEE424067B; Fri, 5 Feb 2021 12:37:23 +0100 (CET) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mails.dpdk.org (Postfix) with ESMTP id 5A9F9188A40 for ; Fri, 5 Feb 2021 12:37:22 +0100 (CET) Received: by mail-wm1-f46.google.com with SMTP id j21so2947614wmj.0 for ; Fri, 05 Feb 2021 03:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D6rREsVNx5m+cJlhnu5XOxFpbYs1lLkgMyKv3HyJDKg=; b=a0Q7iUl8mG4cf0Yf/mS3IJeiR3VheW1v60M2IM5oWnBFGb8bz3DFO1xlX6XUNVWmj/ uUTEuQRyRhiKFjeR5G8cRDv8PmCUm+99Xt2YeZ5Ccmz6eHaGfbAwDCyi1RH4BT1bLCmz eiAlw92UFi+GJ+MiZy04mgRjwkIiQBzuVoban9q/9Et86bW4D4CBXm4pbEHMfJ0QqBci KKsPkNRtvNpwzCZYOrdy1imM9/D7jiwP0829zPXO5Ggt7jQvSWsg0MzW8DuFaMslNQYB KqDiBHRGg1HILFh/2VbT8I+MVEzkOwRsfKQcUN2uRwOiK/9Y3o7t73EVmpEkuIpBbch0 YaMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D6rREsVNx5m+cJlhnu5XOxFpbYs1lLkgMyKv3HyJDKg=; b=B59KgJnTeRr9KtVDuUFsQTChgNXccmOVP0wKNpZku+edep0xHc8dS3vy8qzOI0FHdv k78VsHfqtvi7TM36CYlQsaCCjvBR4RiCNLIsr2zs6nFesbSLm/o5RINURF6zeYkyYmMY s8z9+yOi3FC4uc/RKhtACR+m/fSmSExaVXhs+cEIpOZWFaaMSicNeioRIaSykum+UWLv gmuNwzcTQ+K9PVnDWOBDEnE4Ak5/sX/y3D0YRfIQgwsYkvuK6rFvL4+jJdk5n9ZeXEGP Qnyqnn8APBTq9xd+IqLghcKdZaKDAGMJC5YOvU+WlKvRcI2NMSOYqhl3Ncf66w67aHKh xAoA== X-Gm-Message-State: AOAM533GlpiQLErUVMSeQ29EDtRy7zEjrYSH2TP4JfI6tnNQCIFGFIGG 0eFnbQBPACuAZZhaClnLjkQ= X-Google-Smtp-Source: ABdhPJzULBSSXVLO9S1UemdQ0hXMupK4qXvcYYLrDzkxgddQFuYRvvzNevadFJLhIoyzkkJlrRv+Zw== X-Received: by 2002:a1c:99d1:: with SMTP id b200mr3192859wme.37.1612525042081; Fri, 05 Feb 2021 03:37:22 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t15sm8446670wmi.48.2021.02.05.03.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:37:21 -0800 (PST) From: luca.boccassi@gmail.com To: Michael Baum Cc: David Marchand , Matan Azrad , dpdk stable Date: Fri, 5 Feb 2021 11:18:33 +0000 Message-Id: <20210205111920.1272063-227-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx4: fix device detach' has been queued to stable release 20.11.1 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. 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/8fd290074d7cb8e48715d7a3b797f0ac55a70d62 Thanks. Luca Boccassi --- >From 8fd290074d7cb8e48715d7a3b797f0ac55a70d62 Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Wed, 20 Jan 2021 08:14:50 +0000 Subject: [PATCH] net/mlx4: fix device detach [ upstream commit 8e1630e0f1985beb7e48429e3a7614f4732b0e68 ] When mlx4 device is probed, 2 different ethdev ports may be created for the 2 physical ports of the device. Wrongly, when the device is removed, the created ports are not released. Close and release the ethdev ports in remove process. Bugzilla ID: 488 Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") Reported-by: David Marchand Signed-off-by: Michael Baum Acked-by: Matan Azrad Tested-by: David Marchand --- drivers/net/mlx4/mlx4.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index d5d8c96351..7460afa859 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -375,8 +375,10 @@ mlx4_dev_close(struct rte_eth_dev *dev) struct mlx4_priv *priv = dev->data->dev_private; unsigned int i; - if (rte_eal_process_type() != RTE_PROC_PRIMARY) + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + rte_eth_dev_release_port(dev); return 0; + } DEBUG("%p: closing device \"%s\"", (void *)dev, ((priv->ctx != NULL) ? priv->ctx->device->name : "")); @@ -1123,6 +1125,36 @@ error: return -err; } +/** + * DPDK callback to remove a PCI device. + * + * This function removes all Ethernet devices belong to a given PCI device. + * + * @param[in] pci_dev + * Pointer to the PCI device. + * + * @return + * 0 on success, the function cannot fail. + */ +static int +mlx4_pci_remove(struct rte_pci_device *pci_dev) +{ + uint16_t port_id; + int ret = 0; + + RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) { + /* + * mlx4_dev_close() is not registered to secondary process, + * call the close function explicitly for secondary process. + */ + if (rte_eal_process_type() == RTE_PROC_SECONDARY) + ret |= mlx4_dev_close(&rte_eth_devices[port_id]); + else + ret |= rte_eth_dev_close(port_id); + } + return ret == 0 ? 0 : -EIO; +} + static const struct rte_pci_id mlx4_pci_id_map[] = { { RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, @@ -1147,6 +1179,7 @@ static struct rte_pci_driver mlx4_driver = { }, .id_table = mlx4_pci_id_map, .probe = mlx4_pci_probe, + .remove = mlx4_pci_remove, .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV, }; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:39.188736444 +0000 +++ 0227-net-mlx4-fix-device-detach.patch 2021-02-05 11:18:29.202698652 +0000 @@ -1 +1 @@ -From 8e1630e0f1985beb7e48429e3a7614f4732b0e68 Mon Sep 17 00:00:00 2001 +From 8fd290074d7cb8e48715d7a3b797f0ac55a70d62 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8e1630e0f1985beb7e48429e3a7614f4732b0e68 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 27af426363..f520d32456 100644 +index d5d8c96351..7460afa859 100644