From nobody Wed Aug 28 18:35:23 2024 X-Original-To: dev-commits-src-main@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 4WvClH56hLz5MWqY; Wed, 28 Aug 2024 18:35:23 +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 4WvClH4bvgz4kyv; Wed, 28 Aug 2024 18:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724870123; 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=+MCHFtwQWgw1KTM/sk+nGNy1ev6c2VMVRWg6/drIh34=; b=qY0KpgUrVg+rQAwFqcQOLUb1eGmjPTJBCv9VQpdAcX9aO1ifITdsjIcE+B3fjgnHdze45c WU6spVTQ2gIUB3Lu+5tLxqt9FCM0zf05kiMECidjZTEe3GeU+0QctR77ErXaxAd1+UaBdZ WOOl5gkUVLGMXyUGQIeTVmLdhWwtsfNscHLXQIrRBIEPQBgF/QSYEtWu4qUr55Z/jDfzn3 POFQ4peluLRaRkQ0G/HkkQ+KydlB3RvfGZlHBRnLwGjv2WjjOGeiI2UTMgmWFSg05xP1lb qp1ol0qJ7JPlvpfIHWZmFbg+w/hJkL524dvnhoWGbD1TG9Xb6EfqthXKW3Ip+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724870123; a=rsa-sha256; cv=none; b=kmYi2B5ZlahPU+RxEkhDxAchVsOn8g6LTwvqCGl8qnT4tNGEqjWf/BMZtR7/8IzlcH+GdR +bEglzH+SrCT485lrriVFoOuxSMxgObV2fBRDz23724RXbl0rUyPKHnCiLk7h5b/LdsYF5 aSipohQAXU+Ey9pACnjQYIewNCpdyUyXBi2SFG4uasnFGGxeHq0GKNv+wV8zjRLdHmnDx3 9oGrIPED8OtHiANOMVLPFKj5ZKgPoUT+IsqXmWZFVB737TFAn0J2QD5LTJQg24h+DZ6o/p Eq/MHiQdz90gJvB7RKqKIa5UL1b2zlgtpEG6Ys9MJC3cecVd3r46AqxfChnZWw== 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=1724870123; 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=+MCHFtwQWgw1KTM/sk+nGNy1ev6c2VMVRWg6/drIh34=; b=ykNN+0xd47VIcuyyXfdfOPcvQVyyqZ5pFJaLI18tDhyTVn/4yDkmLMGrIr11ttfyu1kg3X aZcquPgpsZcH17YibJR1BKMBRxQ9ISwJWTXcpa4Gj5uwTJhweNRc6ERIN6bqGWk8T+k4gr mlV6G1Yr1E4nIyJdxstgF52J1Y6AhYp4NlfQT3jW3FEc+IhFSRStkDZt6v44Iyd30/df+R /7cYT87iWkEVtQImRjR4slpU4xnpi1EOHb20i/17Hh1lIN46voN9oeRrhTuKGwAxpV0KIG zHmH/r2WO5KXS/bcEKrsYefFj2q7EburyWfD/rsuKWn77VrRaG7CQ9HyyPOeyQ== 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 4WvClH4C9Lzkt2; Wed, 28 Aug 2024 18:35:23 +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 47SIZNen090764; Wed, 28 Aug 2024 18:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47SIZNiN090761; Wed, 28 Aug 2024 18:35:23 GMT (envelope-from git) Date: Wed, 28 Aug 2024 18:35:23 GMT Message-Id: <202408281835.47SIZNiN090761@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: 1e584ca30e3a - main - cxgbe(4): Export the core suspend/resume functionality to other modules. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 1e584ca30e3a97eedf37368e7ad75c31f08be039 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=1e584ca30e3a97eedf37368e7ad75c31f08be039 commit 1e584ca30e3a97eedf37368e7ad75c31f08be039 Author: Navdeep Parhar AuthorDate: 2024-08-28 17:18:03 +0000 Commit: Navdeep Parhar 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); }