From nobody Mon Oct 21 18:39:19 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 4XXPGv6CJ0z5Zd2C; Mon, 21 Oct 2024 18:39:19 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXPGv32H1z4G4M; Mon, 21 Oct 2024 18:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535959; 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=XqBZ9OBMNJLMKHTmJxYMREjf8pBzypslMRWvqF44um4=; b=tlDEGN9dtX7niPdQiSoH0Tq0eoPrCGjgHbe/pFfDF9DyvhHyWsVFMXMxzJBX67K8mNU/Zw E8ifqijk0rJsOc4xT0P566E4E7GR+Qsgu1MTfuiPjv4HGF5lnKki8MfCe3a8qzsQ8Ma7OP 4iYlynILeepWuCF0YatUR18b4x344E5EvI03kSTYnApBzHvMlCy0AF3ypjD29Akx5TYBGl w24suxWzPcwmua3MR6oKSXfXU4hIcfiL61Qvg8uPcN47eksB0xZhy3AxtkiC+dtmH/DBFT aLbGe21QJ1CVNFcedV/82cnReGXl85o6ARnYoSW4zcOkx5+VNcHM7WMfb+9Z1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535959; 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=XqBZ9OBMNJLMKHTmJxYMREjf8pBzypslMRWvqF44um4=; b=Jo1IjIPPlX5pgLDXDLipmXyrNDE/gFMYBChXF8Tfp3OYjYZfcBeu5OGlermSgTv9dfQSmZ V7CZYRQdDNGnSdZje2qJa7biBIQDgm+Kh0rq/qEUL1i+yKnlfCbT8Zdv4vxdziELAYOQls lOebABHp8bHyszj/Ijv1nvZPOspmeYhOl4kg3wEm6vkmYM+s0tgF4Tbmwid6+DobTkZPc8 9paIkLPCn5G4zM9rEB52sJAwH1RpadUlpsyecURXG5BcvluvFW/8VjlDDngmCDz/00alzH bz1eC66hg+btQK61kxqUagIQEsclL9PmbxL6VpSVnRkM7sUj6M6DswmlY32YDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535959; a=rsa-sha256; cv=none; b=VHfs42Ap1gBk2P+F5049CDwF2xmuMHwCv7Na4G/DzNwWMQl9OTF1FYE41d8w9CO+ur6gU2 UqYew1ZrGxO6A+eVKBB3KW9IhGD8VAd8z/34r0AFqqL4HYo0ceQsWhDWRUO3U1za4yrvOy fk1w9mUV07xXs3oZnrZ18EiCho6kTfdLpgySNDlMFFXRpU9ERbbVls9NcHJSk4W5dpAt7K piUFVOko41A0BeKtjiwWInfthArnULRzRmm/jkS225DHKRbkpLdX14aWI3y2n94iUYm7/Q +etyIk933VTEpGY7//iwcA76aRLjzpMCOIyDte+aV0sr+8tcxsWzqlPvQfrRFA== 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 4XXPGv2fT3zh89; Mon, 21 Oct 2024 18:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49LIdJGl036549; Mon, 21 Oct 2024 18:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdJJu036546; Mon, 21 Oct 2024 18:39:19 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:19 GMT Message-Id: <202410211839.49LIdJJu036546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: ccd65f200cb1 - stable/14 - cxgbe(4): reset routine for general use. 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ccd65f200cb12e1f6ebf11d59899d24f8e58b43a Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ccd65f200cb12e1f6ebf11d59899d24f8e58b43a commit ccd65f200cb12e1f6ebf11d59899d24f8e58b43a Author: Navdeep Parhar AuthorDate: 2024-07-26 22:39:35 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:06:40 +0000 cxgbe(4): reset routine for general use. Add a reset_adapter wrapper that picks the most suitable reset routine internally. Use it in the fatal error handler as well as the sysctl based reset. Sponsored by: Chelsio Communications (cherry picked from commit d668a0b0abe4b079ac2a0d9cd0d7b71bd4a043c6) --- sys/dev/cxgbe/t4_main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 4a9e64efcacf..7531168ca36d 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -2534,6 +2534,15 @@ reset_adapter_with_pl_rst(struct adapter *sc) return (0); } +static inline int +reset_adapter(struct adapter *sc) +{ + if (vm_guest == 0) + return (reset_adapter_with_pci_bus_reset(sc)); + else + return (reset_adapter_with_pl_rst(sc)); +} + static void reset_adapter_task(void *arg, int pending) { @@ -2544,10 +2553,7 @@ reset_adapter_task(void *arg, int pending) if (pending > 1) CH_ALERT(sc, "%s: pending %d\n", __func__, pending); - if (vm_guest == 0) - rc = reset_adapter_with_pci_bus_reset(sc); - else - rc = reset_adapter_with_pl_rst(sc); + rc = reset_adapter(sc); if (rc != 0) { CH_ERR(sc, "adapter did not reset properly, rc = %d, " "flags 0x%08x -> 0x%08x, err_flags 0x%08x -> 0x%08x.\n", @@ -3650,7 +3656,7 @@ fatal_error_task(void *arg, int pending) if (t4_reset_on_fatal_err) { CH_ALERT(sc, "resetting adapter after fatal error.\n"); - rc = reset_adapter_with_pci_bus_reset(sc); + rc = reset_adapter(sc); if (rc == 0 && t4_panic_on_fatal_err) { CH_ALERT(sc, "reset was successful, " "system will NOT panic.\n");