From nobody Mon Oct 21 18:39:26 2024 X-Original-To: dev-commits-src-branches@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 4XXPH25N6Mz5Zd0N; Mon, 21 Oct 2024 18:39:26 +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 4XXPH23T9Fz4GJV; Mon, 21 Oct 2024 18:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535966; 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=be6LBkm/z2lKTYZ8wtuUX5nf22OimBSOgp7AJiSMd4g=; b=anFPj7oDChsXIhCaD+QRWzaGGsB60rw+r75PtsxkKK19zgVOwCLmBoUuwNoiptNjn60/zO 8h5iDT9gIl5h4w1FfT64GfCnwhEh/z2Ish6Kd0RBTXzL5caA1lCurSU7JS3FRPp9KE/Bnz jh6uk8TqV6cbgBboXlT1B3a2PGM0gxZCH4LuvYVoBU0ushZZ916W8Cm0FYpLNYiQO2uKQ7 w/WoxsnJftCY7m1yfspG0ObO4Jj/m0Zq9zq9xbAcFyLOVUb7ZC37UHRsZEOVCHX+BAGu+2 o5cEYmpsIrKjmfhg3lWulus+JtwqgM81rV4HUxnjOu9bbFIvtal5K416fz1y7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535966; 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=be6LBkm/z2lKTYZ8wtuUX5nf22OimBSOgp7AJiSMd4g=; b=Db3/0ZN6ZQW/L5t9z8ZUYCxh8Eki0Wq9OPYEXZiTbZkuqP5kUHt+V94afiyAF4iat+tmDF ZZf8+BxD//n1FvMbzoGShKS1SyDY3WkgpvT8RM3Fb9SGtoQRkBM/PAsFmV6U6VGcNWRRQ7 w3y5qqptu3sS55zFzLOMxXfnJSI96AhXxesXHkMfD96t9S9Jv3ZF6Z0fqb4wcEFbu1SeCu Mgk5TVRhPElVynUNyJwWnA5/ucKUjXP6flZiVAxMtk1kD+NboPbld23hhJMjcxGn5zMSTu wjT1SqkM9cGr4vEMyBdVmrNMwxBL+nPA/HAHFHb7Foow3/vWEbWQjECijAZGng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535966; a=rsa-sha256; cv=none; b=c3EFk1DcrFbR9u7Ci/2xXOSQXZli9s3V3yWCvVAdwDmy1jgmQiCkS24cKKHoIvZBdO6uK0 WjmWayvTACJZxbww/+rGya/97gpOHpfszIuHU1h1U9L0M9tAyeXrIHPZvBzIFNfcAmRcbU Q7Ag8C0RO7aNyxGt9wS5nBxLTxzqzfWWI4OE3TPjGPQYaXO9HiERf2rBmVbrvWlRkhva2m Ah2CdfuOKsSrSeZo10/nSCG+61NLOy351YUsv1v8J8A3/5FHPPEbzgPM0vGT9Y5Nd+DPFM LJDDd79ThFDgAlYAz0BqncD29Qxp3ge4wDAswqR7w7jJyM9kwb40k5cJ1zMnzg== 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 4XXPH21rbczhVl; Mon, 21 Oct 2024 18:39:26 +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 49LIdQ93036899; Mon, 21 Oct 2024 18:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdQHR036896; Mon, 21 Oct 2024 18:39:26 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:26 GMT Message-Id: <202410211839.49LIdQHR036896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 3301201fc925 - stable/14 - cxgbe(4): Always report link-down on an abrupt stop. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3301201fc925a98b5ebdafe3f0cded5beef40d4f Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3301201fc925a98b5ebdafe3f0cded5beef40d4f commit 3301201fc925a98b5ebdafe3f0cded5beef40d4f Author: Navdeep Parhar AuthorDate: 2024-09-05 02:28:09 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:09:14 +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. Sponsored by: Chelsio Communications (cherry picked from commit 7aeec281b8b2620d7d88c9abdfadd7e20a485b9c) --- 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 f3841a23df71..4184900780a1 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);