Article View: linux.kernel.netdev
Article #3084Re: [PATCH net-next] net/mlx5: Add reset_prepare and reset_done callbacks
From: Narcisa Vasile
Date: Wed, 14 Oct 2026 06:38
Date: Wed, 14 Oct 2026 06:38
49 lines
10434 bytes
10434 bytes
On Sun, Oct 11, 2026 at 12:48:09PM +0300, Tariq Toukan wrote:
> From: Akiva Goldberger <agoldberger@nvidia.com>
>
> Currently, the mlx5_core driver registers only the error_detected,
> slot_reset and resume PCI error handlers. Add the reset_prepare and
> reset_done callbacks, which are triggered by the PCI core before and
> after a PCI reset, respectively. These callbacks let mlx5 quiesce and
> restore device resources and commands around a PCI reset, so the driver
> no longer relies on the reset happening while the device is otherwise
> idle.
>
> Additionally, add a device flag to indicate when a PCI reset is in
> progress to serialize PCI reset flows with other reset flows, namely FW
> reset. This flag also indicates to the reset_prepare and reset_done
> callbacks when to do a full unload/reload of the driver. When the
> callbacks are triggered by the hot-reset FW reset method, they leave the
> teardown and reload to the FW reset.
>
> Signed-off-by: Akiva Goldberger <agoldberger@nvidia.com>
> Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>
> +static void mlx5_pci_reset_prepare(struct pci_dev *pdev)
> +{
> + mlx5_drain_health_wq(dev);
> + mlx5_unload_one(dev, false);
> + mlx5_pci_disable_device(dev);
This disables bus-mastering, after which pci_save_state snapshots it in
the disabled state. reset_done() re-enables it but the snapshot remains
stale.
If a FW error later triggers the sw recovery through mlx5_pci_slot_reset(),
the stale snapshot is re-applied with pci_restore_state().
Would this disable bus mastering again and block the driver recovery?
Should pci_set_master(pdev); and pci_restore_state(pdev); be reordered
in mlx5_pci_slot_reset()?
> +}
> +
> +static void mlx5_pci_reset_done(struct pci_dev *pdev)
> +{
> + err = mlx5_pci_enable_device(dev);
> + if (err) {
> + mlx5_core_err(dev, "%s: mlx5_pci_enable_device failed, err = %d\n",
> + __func__, err);
nit: mlx5_core_err already prints __func__
> + goto clear_pci_reset_flag;
> + }
Technical Details
Message-ID:
<as8jYneJ32Hl++uj@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346045-linux-kernel-netdev=dewy.ruReferences:
<20261011094809.790798-1-tariqt@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346045-linux-kernel-netdev=dewy.ru
From: narcisav.kernel@gmail.com (Narcisa Vasile)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net/mlx5: Add reset_prepare and reset_done
callbacks
Date: Tue, 13 Oct 2026 23:38:26 -0700
Organization: Usenet Network
Message-ID: <as8jYneJ32Hl++uj@gmail.com>
References: <20261011094809.790798-1-tariqt@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="2235029"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nyh0akHiNZWl0OhecLcOBWD9XCw= sha256:zfhbGP+oBXOFSCg9hK0mma+NoRhtRUHq3yOfLBHVOCM=
sha1:rMNmVVxdEZl4nqhqW5dO/gtmch8= sha256:ii+xNrCHj8/G5pXHFgSak67xI9uirb+u5vxU00m6wM8=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id DD381110046; Wed, 14 Oct 2026 09:44:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.747
X-Spam-Status: No, score=-0.747 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, FSL_HELO_FAKE=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id wp-OkGndCWpR;
Wed, 14 Oct 2026 09:44:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346045-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id C027C10FFC4; Wed, 14 Oct 2026 09:44:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 87FE22C4C1; Wed, 14 Oct 2026 06:38:38 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6DE41D214;
Wed, 14 Oct 2026 06:38:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FgVBtJ9j"
X-Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00B78426D03
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 06:38:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791959918; cv=none; b=o++wLluBC76kfUZTis0z4mxhCNi8iaLfM3y9GJbZxgFSge2j5EPJadkytCCA9EGCauCsWELikZHYxDluGJT/hLgtbgiSKLAkOyxfr4URxAwtyvyZtkfuLnfzYvOlAFiC6eh17gQ1F8nXdLDcixcLPVTqcp4wyUHdPCNZ1Ux9UB8=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791959918; c=relaxed/simple;
bh=SKywH8MNPdivYCGdEihmGK/lbFOotmv3FlQiIRwxB38=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=LbcUNHhkHi7PL3KqyVRM7PrWZe+7GAypcZ08lLDFKczJOheqMFJe0czczJBlcywye8frE2KkP+oCrkd+vKPB2NnBh/lTneIAMkP3Rb6aiOux32QlPCf0XdMDc/msH8LTGfc/uYGEih8l9ioquFiU067tzriXKqFE6nMAxrtRQlE=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FgVBtJ9j; arc=none smtp.client-ip=209.85.210.180
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-8897e83332fso2490957b3a.1
for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 23:38:36 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1791959916; x=1792564716; darn=vger.kernel.org;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=nNh/M3sOC7N/J+QZXKtdURAz2jbnsRv3OJdxTJpbjNA=;
b=FgVBtJ9jCXmdaP5e3WAWbfof7fN7N51BmddrCgDw7cFxTdijC0Q/XwO0C4D1dgXw9a
sd1t16LLhaNYYjcngY/Sx4+iiCxRvjToJ0zzj3ebYiVDPrqQgefXcolGWSh6bOs8du/c
JHNIphpyNCVF0AdepgS4yii2MW5R34qCAhUA3UARxpmXR5Bshc/yURzE9yIUiAu35g8k
PDzqeUuslZ5xM/twWMrmegNzdoTfEPeDLLMyFAaeeVmdCD57I79iZFRGkbfqJggSaAHR
g4yasJuzG8zk21NIePzy9ypVImvdZDBCAmaih7TRiWEchoDdRb04gzJ2a62ZeMPiyaPu
z5Nw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1791959916; x=1792564716;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=nNh/M3sOC7N/J+QZXKtdURAz2jbnsRv3OJdxTJpbjNA=;
b=LvzCtuVmTtda8skrozQNfCBeHvT9E2zki7S2L0xbPC09Y33MzPouRRCsryKs+2UhDf
9LFijXldRTqF4OSpEDOhfIWx5eaJ943MFpz93QvygRUsYcAfMIMCsGwYqPANExy3oB0h
Ffd0K8AgTBSK9ARBV6JEObYkMUYMz7lwChPLgtqitdTmTJ621WJAim5sZ2Yrb5CqHf/R
weTLm8uYOlqPctIyjftjhVtDNENY1D0Bvvz7TL3m5na4ANg4dgw7VeSppGtj6dpQL1eZ
U+20cZgIl2Avx4uwqSQfCcwe1V8cFr8zZReKIOfTEVYDJEh0pXokDfrigMhjSZNdyirJ
uBBg==
X-Forwarded-Encrypted: i=1; AKwUvBzePjbPuVBbDx9OkAzJZf2LN/w+a6XGbXawAy8wa6E3qlL935ITQGvkg3/kfJbVazv/PYMWS1s=@vger.kernel.org
X-Gm-Message-State: AFq9FYIPrxEOkGxqfGuXxPIqjUMKjEf47cFados8476IohGBNyRirVnW
GDCmQpvx3E3nhIAtfvVEcvhytQjopOP6VNX61l41630DAOK7iv6DCcYk
X-Gm-Gg: AYBFou3DD5P7jRJhyZhvzbQte7y4CcC7e20KO+6ntP6pgt2Tq0mTKi1+QuZ1c8AuY4G
sNf71MP96LLHZG61UHfAU4bpzWpeSQzB/jIzSYkw2uXfKLeRruAw2Aspv3U1iaKB9immxTI0nrx
c9VaR6GqCaFc7Xnwi/FHsCI0sazd2xoqaoyvltr3cZouzFlmNDfh2SEAETcvd8CryKmeNRCLCMV
E3jkMS4o50uklNnS5hWr7GnVLnp7EOjGcSKi0vgsTAcbvQgocuxjwshalvryInv3ImF8rKuHe8n
A7ytJ0Rb/9csZwrtedJY+MGItHGkw+LeXuRvT98HlHyyxF0L+hwCjdkS29Ej8XdAyBIOfenL9rU
vb/J/L/7w3DE2fJ5f35ptRcdtcISJllJu7vhb4grr7JOERON6dZHDRpmatdjygu5EZOVp9TaKtB
mumquuJeI19NpliifBxI0Q3N2OC5iwfUmakdH5QDGUwrAwANQOF2/4ToSW6501lkf2BDioqpc=
X-Received: by 2002:a05:6a20:a120:b0:3d3:ad6e:9ce1 with SMTP id adf61e73a8af0-3e16bd54a69mr8958658637.15.1791959916302;
Tue, 13 Oct 2026 23:38:36 -0700 (PDT)
X-Received: from gmail.com ([2a03:2880:7ff:4d::])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-89d802a4314sm701933b3a.11.2026.10.13.23.38.35
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 13 Oct 2026 23:38:35 -0700 (PDT)
X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org,
Paolo Abeni <pabeni@redhat.com>,
Akiva Goldberger <agoldberger@nvidia.com>,
Gal Pressman <gal@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
open list <linux-kernel@vger.kernel.org>,
linux-rdma@vger.kernel.org, Mark Bloch <mbloch@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261011094809.790798-1-tariqt@nvidia.com>