Date: Wed, 28 Aug 2024 18:35:23 GMT From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 1e584ca30e3a - main - cxgbe(4): Export the core suspend/resume functionality to other modules. Message-ID: <202408281835.47SIZNiN090761@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=1e584ca30e3a97eedf37368e7ad75c31f08be039 commit 1e584ca30e3a97eedf37368e7ad75c31f08be039 Author: Navdeep Parhar <np@FreeBSD.org> AuthorDate: 2024-08-28 17:18:03 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2024-08-28 18:20:26 +0000 cxgbe(4): Export the core suspend/resume functionality to other modules. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 2 ++ sys/dev/cxgbe/t4_main.c | 54 ++++++++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 3922bd3909fe..2769277e8411 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1392,6 +1392,8 @@ void release_tid(struct adapter *, int, struct sge_wrq *); int cxgbe_media_change(if_t); void cxgbe_media_status(if_t, struct ifmediareq *); void t4_os_cim_err(struct adapter *); +int suspend_adapter(struct adapter *); +int resume_adapter(struct adapter *); #ifdef KERN_TLS /* t6_kern_tls.c */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 5fedf10869d2..0606f383b879 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -2110,23 +2110,32 @@ stop_lld(struct adapter *sc) return (rc); } -static int -t4_suspend(device_t dev) +int +suspend_adapter(struct adapter *sc) { - struct adapter *sc = device_get_softc(dev); - - CH_ALERT(sc, "%s from thread %p.\n", __func__, curthread); stop_adapter(sc); stop_lld(sc); #ifdef TCP_OFFLOAD stop_all_uld(sc); #endif set_adapter_hwstatus(sc, false); - CH_ALERT(sc, "%s end (thread %p).\n", __func__, curthread); return (0); } +static int +t4_suspend(device_t dev) +{ + struct adapter *sc = device_get_softc(dev); + int rc; + + CH_ALERT(sc, "%s from thread %p.\n", __func__, curthread); + rc = suspend_adapter(sc); + CH_ALERT(sc, "%s end (thread %p).\n", __func__, curthread); + + return (rc); +} + struct adapter_pre_reset_state { u_int flags; uint16_t nbmcaps; @@ -2464,20 +2473,28 @@ done: return (rc); } -static int -t4_resume(device_t dev) +int +resume_adapter(struct adapter *sc) { - struct adapter *sc = device_get_softc(dev); - - CH_ALERT(sc, "%s from thread %p.\n", __func__, curthread); restart_adapter(sc); restart_lld(sc); #ifdef TCP_OFFLOAD restart_all_uld(sc); #endif + return (0); +} + +static int +t4_resume(device_t dev) +{ + struct adapter *sc = device_get_softc(dev); + int rc; + + CH_ALERT(sc, "%s from thread %p.\n", __func__, curthread); + rc = resume_adapter(sc); CH_ALERT(sc, "%s end (thread %p).\n", __func__, curthread); - return (0); + return (rc); } static int @@ -2512,12 +2529,7 @@ reset_adapter_with_pci_bus_reset(struct adapter *sc) static int reset_adapter_with_pl_rst(struct adapter *sc) { - stop_adapter(sc); - stop_lld(sc); -#ifdef TCP_OFFLOAD - stop_all_uld(sc); -#endif - set_adapter_hwstatus(sc, false); + suspend_adapter(sc); /* This is a t4_write_reg without the hw_off_limits check. */ MPASS(sc->error_flags & HW_OFF_LIMITS); @@ -2525,11 +2537,7 @@ reset_adapter_with_pl_rst(struct adapter *sc) F_PIORSTMODE | F_PIORST | F_AUTOPCIEPAUSE); pause("pl_rst", 1 * hz); /* Wait 1s for reset */ - restart_adapter(sc); - restart_lld(sc); -#ifdef TCP_OFFLOAD - restart_all_uld(sc); -#endif + resume_adapter(sc); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408281835.47SIZNiN090761>