From nobody Mon Oct 21 18:39:20 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 4XXPGw6dRKz5Zcwc; Mon, 21 Oct 2024 18:39:20 +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 4XXPGw47LFz4G4W; Mon, 21 Oct 2024 18:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535960; 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=6Jju3y0c8R3wOwy+dFScvUCAPwqGSQmMNVfFIpq7wHc=; b=oB0ikBGz3vbL9IbT4hbtxYwmc1DeQzc9vyRU2R07TsXnX0yohPmKM7NHuzokmBR2mVJn1H JYbWo9XqBCsGSMNMF1um+u+0hQkqFulMA5OD+XP+0S0IEClJRLa/cKxRfjNObYO1Z3vKjK mi5TZ91/CmJ04vFtamsmmDPHGQlHcLC9wG9yGLj6S2N4LyE6HVbY1ucaGcJKvxHPq03G3O xkQ3YAYElKaqM5dGnMVAGmaqgSSscNmBHKhDBHcXRybJ1Mty2T6dKVxs/j9kXkz4wkkHpE WtcWnmSQgrlBafbZf/rzBlGkaG94LaP3PvjoU0BhozsLod/vg/KNoC4Kh96kCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535960; 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=6Jju3y0c8R3wOwy+dFScvUCAPwqGSQmMNVfFIpq7wHc=; b=uLtUccAZudqSyIYBIO54ysEMZ/Is7tNByNId1Un8xNrQGwTcoXO+kj+g2pj/v6TXFykbmZ awfbem1mC5vELHLT6RJw39ZniWEVTX+mUyXfyoEdR/mAWQAIujjWJt116weTNtULzNwDdn 1HWO4gSer0psyIxXHp92MqgZJFK62nx3JSAjZ+m/V1ooGPZhi7XGA2zyre6c2w5T/iQJud YH5vBZ4JQeZh88rGv9Nxf3vuLZJYa45QyghwC91HoCcUoxHXduyJTn+Go01VTgJk3NT/Dz 1jLCWdxu0L4DpMIcAXoEtmryVVCgfBSsFXEXIHk84R7Y3g7/kAQZIUmFzrx+Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535960; a=rsa-sha256; cv=none; b=OZAsC+zgXI5ecWqNlWJj8a2ENwS81QhycxxUHI5xfU99x+LFpxtkCg7R5JPhpZYcMunJCL 08MZfttuLxSS6zthBWpCfejd93L2Mr5yJE+6gCoP7F3TefNuRdjWPRdfE+uTuFYd7uyf8g 6ZsEfEBFkE0yeFvdai3zA9+4ccOLXT3uMAVYpEN5T0kDk75MCz2ZPVscPx/xlTU7yxHidU hCEfwwjZddBH9Gi1tozIfnAZFYpLS3Scsbfo2TMB/ycPNS0be78AWDioglBSSWuYhbCK1A /JBXgXSmSrpFL1rf8fjxNYqIgvSu2RqTyZXTtooRchkXyb8At+l9NfmIBLixjQ== 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 4XXPGw3lSWzh8B; Mon, 21 Oct 2024 18:39:20 +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 49LIdKUk036613; Mon, 21 Oct 2024 18:39:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdKHD036610; Mon, 21 Oct 2024 18:39:20 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:20 GMT Message-Id: <202410211839.49LIdKHD036610@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: a7b24758d035 - stable/14 - cxgbe(4): Export the core suspend/resume functionality to other modules. 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/stable/14 X-Git-Reftype: branch X-Git-Commit: a7b24758d035a48cb3638e9a77db039361eb1c7a Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=a7b24758d035a48cb3638e9a77db039361eb1c7a commit a7b24758d035a48cb3638e9a77db039361eb1c7a Author: Navdeep Parhar AuthorDate: 2024-08-28 17:18:03 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:07:20 +0000 cxgbe(4): Export the core suspend/resume functionality to other modules. Sponsored by: Chelsio Communications (cherry picked from commit 1e584ca30e3a97eedf37368e7ad75c31f08be039) --- 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 7531168ca36d..f3841a23df71 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); }