From nobody Thu Sep 05 05:16:43 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 4Wznf4295Cz5V5gc; Thu, 05 Sep 2024 05:16:44 +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 4Wznf418hhz55cm; Thu, 5 Sep 2024 05:16:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725513404; 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=ffcKx3Dhzc0EHBPDd2GV8rGjVz3Ob+mt5NoUBNoGDRY=; b=m4/2glEvCT9DliI5zx86lapBLvxkQNptWQyFqqnvpIxHS3ahPClEtf8DVgEIwbqsXw0d9S S7g+cqtOexQqKJXa2xYxmFIifwIPc8eoXR1FQtLxXhJxITuKQMrS9LfBWUG5sbNQ31HmKK fyhXBsqeH4xSufKRWEm5E2+3D1UAUx3hFatTuyI6U9Zmy9H/HgE0nuhcvtT/he39Xc5k9R jeGyDDbiZ9NxlexXJevH5ECiuwg+qyOjmtm3FQMkavd5K6aegDS/EItaS+R+ZUpWoGrLV+ oIReU8au1TI+ftbuXC+usz5zr6EKnBY1fj4/HSFIf+muFEmqOEcfP76VLAOIdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725513404; a=rsa-sha256; cv=none; b=dBPgp4UtUZPQwKWsuU5xDOuh9OTNgBQ5WRVkiBfxBz5/cMoZBuxcyBDOAGaSfcmkB6gRar KrQHuKP0SwVNdXt/IJ4mag4zIjj2BFcyuOi7YeA6xghixA+Qoc/2Ws/E4RIDEyVkvSgWsg oMdnnfU2gvwdl5pE9mJto/F7I1bxAVa5JEYuaWKdsqZ6/C61Tv8RgLBdEMEowXKq1JOvEO r43n+lRFrsHQii+gtBHfVmd/OAsgPufY11T01y1PUeIjuN/e3gTJGJPrIvdP7N6vaTUomc RpWMsC/BUEOe4LdPm4aK0jTbKXZjskaCBqSNLXVm8x3MhoQwsKgimDWEwJ1waQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725513404; 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=ffcKx3Dhzc0EHBPDd2GV8rGjVz3Ob+mt5NoUBNoGDRY=; b=OtFphtbR83S636DaS2sBlrrwa6MfxtEDLuxgNZ/nCG7glmDoUDEGYHQi6I6DS7uD+uRxu8 IQYxXPaIbo9qvMFbKphsFWT8YK3XLhmM/FeQrxB1ski2k7ioFmL8ZfiJiXDDzjx/CJd849 FZMX4O50UTgKt9EZAlPxaHxNITLfsNQmMkDOM2uvKLOBnayHUs5UsLEXalXKqlcErxxvLN 82+28HiRijpAHB+wOE2/SckI5EwWsiEhrQDKt9ACbin9Z6+4xZ8qv96O1VJKvxuB4dCOcv 7+l3J3QVbKLzSnM0cPTFgrHu8QCKzfPSFdBPoV54gybAzQnYhwMOcWQZc98+qg== 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 4Wznf40W3tzvW3; Thu, 5 Sep 2024 05:16:44 +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 4855Ghkj085176; Thu, 5 Sep 2024 05:16:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4855GhXb085173; Thu, 5 Sep 2024 05:16:43 GMT (envelope-from git) Date: Thu, 5 Sep 2024 05:16:43 GMT Message-Id: <202409050516.4855GhXb085173@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 7aeec281b8b2 - main - cxgbe(4): Always report link-down on an abrupt stop. 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/main X-Git-Reftype: branch X-Git-Commit: 7aeec281b8b2620d7d88c9abdfadd7e20a485b9c Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=7aeec281b8b2620d7d88c9abdfadd7e20a485b9c commit 7aeec281b8b2620d7d88c9abdfadd7e20a485b9c Author: Navdeep Parhar AuthorDate: 2024-09-05 02:28:09 +0000 Commit: Navdeep Parhar 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);