git: 7aeec281b8b2 - main - cxgbe(4): Always report link-down on an abrupt stop.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Sep 2024 05:16:43 UTC
The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=7aeec281b8b2620d7d88c9abdfadd7e20a485b9c commit 7aeec281b8b2620d7d88c9abdfadd7e20a485b9c Author: Navdeep Parhar <np@FreeBSD.org> AuthorDate: 2024-09-05 02:28:09 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2024-09-05 04:54:30 +0000 cxgbe(4): Always report link-down on an abrupt stop. This fixes a regression in 5241b210a4e1 where the driver stopped reporting link down after a fatal error unless t4_reset_on_fatal_err was also set. Fixes: 5241b210a4e1 cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 0606f383b879..540edbb568c0 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -1920,6 +1920,9 @@ t4_detach_common(device_t dev) static inline int stop_adapter(struct adapter *sc) { + struct port_info *pi; + int i; + if (atomic_testandset_int(&sc->error_flags, ilog2(ADAP_STOPPED))) { CH_ALERT(sc, "%s from %p, flags 0x%08x,0x%08x, EALREADY\n", __func__, curthread, sc->flags, sc->error_flags); @@ -1927,7 +1930,24 @@ stop_adapter(struct adapter *sc) } CH_ALERT(sc, "%s from %p, flags 0x%08x,0x%08x\n", __func__, curthread, sc->flags, sc->error_flags); - return (t4_shutdown_adapter(sc)); + t4_shutdown_adapter(sc); + for_each_port(sc, i) { + pi = sc->port[i]; + PORT_LOCK(pi); + if (pi->up_vis > 0 && pi->link_cfg.link_ok) { + /* + * t4_shutdown_adapter has already shut down all the + * PHYs but it also disables interrupts and DMA so there + * won't be a link interrupt. Update the state manually + * if the link was up previously and inform the kernel. + */ + pi->link_cfg.link_ok = false; + t4_os_link_changed(pi); + } + PORT_UNLOCK(pi); + } + + return (0); } static inline int @@ -2020,20 +2040,6 @@ stop_lld(struct adapter *sc) for_each_port(sc, i) { pi = sc->port[i]; pi->vxlan_tcam_entry = false; - - PORT_LOCK(pi); - if (pi->up_vis > 0) { - /* - * t4_shutdown_adapter has already shut down all the - * PHYs but it also disables interrupts and DMA so there - * won't be a link interrupt. So we update the state - * manually and inform the kernel. - */ - pi->link_cfg.link_ok = false; - t4_os_link_changed(pi); - } - PORT_UNLOCK(pi); - for_each_vi(pi, j, vi) { vi->xact_addr_filt = -1; mtx_lock(&vi->tick_mtx);