The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=d668a0b0abe4b079ac2a0d9cd0d7b71bd4a043c6
commit d668a0b0abe4b079ac2a0d9cd0d7b71bd4a043c6 Author: Navdeep Parhar <n...@freebsd.org> AuthorDate: 2024-07-26 22:39:35 +0000 Commit: Navdeep Parhar <n...@freebsd.org> CommitDate: 2024-08-21 18:47:15 +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. MFC after: 1 week Sponsored by: Chelsio Communications --- 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 57c1eeceab22..5fedf10869d2 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");