From nobody Fri Jan 05 04:53:25 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T5rgn3rGsz56Ghn; Fri, 5 Jan 2024 04:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T5rgn3Kpzz4Vtm; Fri, 5 Jan 2024 04:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704430405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CjBApzJjgCa23YtbODfuOu126tOdTTIp97q7/UeWiQs=; b=vjGnwEEEfpOzoDK26ugOKfbixiIg5tmznbpomp6CYtlo8YJCO8Ks7toVlr11r7ElWEFp6m mNHuip5xzTB6lLRdKeAdAObWYegdXnrOTj/zuDiX+GryMvMxBlRC5jlv4cjF/riWeiqnMv F/23xnOJwHTD1Rflbf+KQrVE4fF+EvVQR82DJtZE6aslkV1S79asrVwnHO0PE5yAJ5aDG4 VG5v7+qhG8JZ4F3oQ7Tz6pSGNFddvdBmpUh/So/7PT47TRigtxsDT3pRuWsTv+JmViW3cm q+1jlVBpoGCX0gzfEY6JLA+MJthzYpB5op7bjXltP0eVycUnmkLRzFo98f0rTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704430405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CjBApzJjgCa23YtbODfuOu126tOdTTIp97q7/UeWiQs=; b=cqHpAaAg73v8RGiss4QcuBhHQGJYPjXrv/9SRUEfcC19k1u2K0vJ4uq8VLaBanrT42G/ZO tdRSDYf6q4dMO8pKEza1D6BNOwxpGcJtvVfSJnw2HNpBqhdrfB7t9/vIKhK+QgC69BwTcB dQ+RbSr9JUNXWLELlvloGH66vwWauq6J94PXDW2ppW+yHtkJGy9kPHVeoy73yS3wWaXb7j hZRKe3VRS+Y5BMCXKh688Gz5QOYgB9Ty1zB2f87fF4MyXpFC6GeigUok0/q7gh0ZgLNBn7 cG7fJ+OpeDZDTJ3ZJBp0sO+AWfadzP4IEAbhykvIluKU+ADWfVzG1gOktqxT/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704430405; a=rsa-sha256; cv=none; b=AvCweBWeQztAQiUxsIHlFB4Y/Zqvp22Ftm9VbOELEZbjXVbrzI+l7pjrQDPSYHpUa3OcDf FZEf7mje1FGKNXI6WFG/3uEyv7lRQXjoMRqw3nHRf+Xvsq6ScAvj8di88ewT4jZO6O1aWC BO9ewxFSOywEy3XRR9VThEx7+GzLoj6J1ZVZe91dE8+f/6KTKIlMNCuHZ1Zm6FIV5beoaO gDJIu4ellyDFhGOr3YtaEZIpDF9lGNgnVFjI8hv7Xf0RRZKeimU+8yYiwRe3JIrRLsGhoA MGTNEdeDmMAqhmOTyEkmkrcPHPOG/IlqhoAn1q5UOBtVmXOoAHSGezaGjOwmbw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T5rgn2P2LzkX1; Fri, 5 Jan 2024 04:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4054rPt0079381; Fri, 5 Jan 2024 04:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4054rPuF079378; Fri, 5 Jan 2024 04:53:25 GMT (envelope-from git) Date: Fri, 5 Jan 2024 04:53:25 GMT Message-Id: <202401050453.4054rPuF079378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 987446fa39e8 - main - mlx5(4): only detach IOV children if iov was successfully initialized List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 987446fa39e8f6887ea16ad49f00f699b2efd210 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=987446fa39e8f6887ea16ad49f00f699b2efd210 commit 987446fa39e8f6887ea16ad49f00f699b2efd210 Author: Konstantin Belousov AuthorDate: 2023-12-29 03:14:56 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-05 04:52:39 +0000 mlx5(4): only detach IOV children if iov was successfully initialized Reported by: jwd Sponsored by: NVidia networking MFC after: 1 week --- sys/dev/mlx5/driver.h | 2 ++ sys/dev/mlx5/mlx5_core/mlx5_main.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index 9daa1235bd9c..6ebe4171a503 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -736,6 +736,8 @@ struct mlx5_core_dev { bool dump_copyout; struct mtx dump_lock; + bool iov_pf; + struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; int pwr_status; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index f6dc1158f085..6b9b63a24714 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1719,7 +1719,9 @@ static int init_one(struct pci_dev *pdev, pci_iov_schema_add_uint64(vf_schema, iov_port_guid_name, 0, 0); err = pci_iov_attach(bsddev, pf_schema, vf_schema); - if (err != 0) { + if (err == 0) { + dev->iov_pf = true; + } else { device_printf(bsddev, "Failed to initialize SR-IOV support, error %d\n", err); @@ -1753,8 +1755,11 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_priv *priv = &dev->priv; #ifdef PCI_IOV - pci_iov_detach(pdev->dev.bsddev); - mlx5_eswitch_disable_sriov(priv->eswitch); + if (dev->iov_pf) { + pci_iov_detach(pdev->dev.bsddev); + mlx5_eswitch_disable_sriov(priv->eswitch); + dev->iov_pf = false; + } #endif if (mlx5_unload_one(dev, priv, true)) {