Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2024 18:39:19 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ccd65f200cb1 - stable/14 - cxgbe(4): reset routine for general use.
Message-ID:  <202410211839.49LIdJJu036546@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=ccd65f200cb12e1f6ebf11d59899d24f8e58b43a

commit ccd65f200cb12e1f6ebf11d59899d24f8e58b43a
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-07-26 22:39:35 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410211839.49LIdJJu036546>