From nobody Wed Aug 28 19:30:46 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 4WvDzC0VxCz5MbmR; Wed, 28 Aug 2024 19:30:47 +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 4WvDzB6vZjz4ssm; Wed, 28 Aug 2024 19:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724873447; 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=7Tgd7dlx9vKtxjxjHHiEKl+pzZHy9KrklmKGa9VjSDY=; b=A/8I2nmezuJkg94jMTMvk4VhxzDifqkrGnH+SdLvrVis6MTN84CaiKmHFz+/vrffuHWdYT m5Fbq9bOKWI1afZHVWHpbPLe8FIYIXp0GOGdFjZDSxQn/KZP1NjCXfnI45zbEBT35gYMXT sXZVHkRIGYpiK/u8pnA55gvQU7z0TIFTvpC4CcDlt3wuNhogjcmJaQxsewrmNf83nKktGA 1qe401TX8sCPjeDqhtOReMi03Kf3NXtP5KC2FC/IRJFvf39B215lwezMuj5Q9T0DpVb0tz fG5lbsa2PxWR71ua8JTb7wUyLhTPpYg7noMo0FWUkE6hKEpNgdjEyKH7C+U0bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724873447; a=rsa-sha256; cv=none; b=okFIbrriAXbdlDl/OVMj4viAzTz3oXYeVDwZvawtGzr6vLUmEY+TJ8yJ4uUDncm1I/CZ1G qbqh5tnxldk2w7Uq/zqURDFDiWd7xaDC9wjfdydkuL16vHqkD+LNqnsLifq6KfWiMpUoir hZrnh856T6Oj3Z6NITyzqaFBO0uHn/vjDCVozyc7D6ijc6UlQVGL3FHkOq4oa0FPPp4qNo s48VHi5cr8gadoNmOWCrrc9e61lfgGjfycQk8h3PeqDW3pBLqssiy7Rl2ZRMmsM961OgoC CHOv6oSATbq1exNbZf/Knh2sDDluzbBUAOApQu9onpTXb+ZNHfJTBmbdEJ8ONg== 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=1724873447; 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=7Tgd7dlx9vKtxjxjHHiEKl+pzZHy9KrklmKGa9VjSDY=; b=vpc3wKVOLZHKkNsvBrQT+TpDzMUYpgJrW/2heYePQ8rLQVSPcBFOXPkZSKInB77FlYBSK7 HDsQDQ8plyf6FS3URPsVDaYiyESq+T482Xtn9pIlV3DZflmuuvaZ+qCLGuICt7Lyj5QLwI LqZ9aUIiQi9evFUWiRM4TTlFqyXRIo1rcpm9ToCYtgtp4bZOAavYd/crX8tloOEw35QvUf oVQCipLZKj8R6Gzwnr8p0oqfN3OvCs2T4vxwzI2b2xRCeSe1JQkY+4l0241E+3WTn3MAjw jVlkdzwZj0POpiuIiq0Koj2kGQnV3fHQ3MHH4oAfM9M2GkfX3avDcOKG4N7bYw== 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 4WvDzB6VhmzmMR; Wed, 28 Aug 2024 19:30:46 +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 47SJUkC5085657; Wed, 28 Aug 2024 19:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47SJUkGH085654; Wed, 28 Aug 2024 19:30:46 GMT (envelope-from git) Date: Wed, 28 Aug 2024 19:30:46 GMT Message-Id: <202408281930.47SJUkGH085654@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: 8254a276ad89 - main - cxgbe/iw_cxgbe: Replace the fatal error flag with a stopped flag. 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: 8254a276ad893ae2a1b35fcbbad255f06e29b8c6 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=8254a276ad893ae2a1b35fcbbad255f06e29b8c6 commit 8254a276ad893ae2a1b35fcbbad255f06e29b8c6 Author: Navdeep Parhar AuthorDate: 2024-08-28 18:41:10 +0000 Commit: Navdeep Parhar CommitDate: 2024-08-28 19:19:23 +0000 cxgbe/iw_cxgbe: Replace the fatal error flag with a stopped flag. Now that suspend/resume is supported by the base driver, a fatal error isn't the only reason that the RNIC can stop abruptly. Also, this state is no longer permanent as it's possible to resume operations after a stop. Rename the flag and associated routines to match the new state of affairs. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/iw_cxgbe/cm.c | 10 +++++----- sys/dev/cxgbe/iw_cxgbe/device.c | 11 ++++++++--- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 10 +++++----- sys/dev/cxgbe/iw_cxgbe/mem.c | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index e0e48fdff9ba..257dec81f384 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -1080,7 +1080,7 @@ c4iw_so_upcall(struct socket *so, void *arg, int waitflag) * Wake up any threads waiting in rdma_init()/rdma_fini(), * with locks held. */ - if (so->so_error || (ep->com.dev->rdev.flags & T4_FATAL_ERROR)) + if (so->so_error || c4iw_stopped(&ep->com.dev->rdev)) c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); add_ep_to_req_list(ep, C4IW_EVENT_SOCKET); @@ -2708,8 +2708,8 @@ c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) CTR3(KTR_IW_CXGBE, "%s: cm_id %p, backlog %s", __func__, cm_id, backlog); - if (c4iw_fatal_error(&dev->rdev)) { - CTR2(KTR_IW_CXGBE, "%s: cm_id %p, fatal error", __func__, + if (c4iw_stopped(&dev->rdev)) { + CTR2(KTR_IW_CXGBE, "%s: cm_id %p, stopped", __func__, cm_id); return -EIO; } @@ -2821,8 +2821,8 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) rdev = &ep->com.dev->rdev; - if (c4iw_fatal_error(rdev)) { - CTR3(KTR_IW_CXGBE, "%s:ced1 fatal error %p %s", __func__, ep, + if (c4iw_stopped(rdev)) { + CTR3(KTR_IW_CXGBE, "%s:ced1 stopped %p %s", __func__, ep, states[ep->com.state]); if (ep->com.state != DEAD) { send_abort(ep); diff --git a/sys/dev/cxgbe/iw_cxgbe/device.c b/sys/dev/cxgbe/iw_cxgbe/device.c index 209d12767a1c..3c4d269f6c69 100644 --- a/sys/dev/cxgbe/iw_cxgbe/device.c +++ b/sys/dev/cxgbe/iw_cxgbe/device.c @@ -335,9 +335,8 @@ c4iw_stop(struct adapter *sc) if (iwsc) { struct ib_event event = {0}; - device_printf(sc->dev, - "iWARP driver received FATAL ERROR event.\n"); - iwsc->rdev.flags |= T4_FATAL_ERROR; + device_printf(sc->dev, "iWARP driver stopped.\n"); + iwsc->rdev.flags |= T4_IW_STOPPED; event.event = IB_EVENT_DEVICE_FATAL; event.device = &iwsc->ibdev; ib_dispatch_event(&event); @@ -349,6 +348,12 @@ c4iw_stop(struct adapter *sc) static int c4iw_restart(struct adapter *sc) { + struct c4iw_dev *iwsc = sc->iwarp_softc; + + if (iwsc) { + device_printf(sc->dev, "iWARP driver restarted.\n"); + iwsc->rdev.flags &= ~T4_IW_STOPPED; + } return (0); } diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 5715b7e53863..ca2595b65b02 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -116,7 +116,7 @@ struct c4iw_dev_ucontext { }; enum c4iw_rdev_flags { - T4_FATAL_ERROR = (1<<0), + T4_IW_STOPPED = (1<<0), T4_STATUS_PAGE_DISABLED = (1<<1), }; @@ -167,9 +167,9 @@ struct c4iw_rdev { struct workqueue_struct *free_workq; }; -static inline int c4iw_fatal_error(struct c4iw_rdev *rdev) +static inline int c4iw_stopped(struct c4iw_rdev *rdev) { - return rdev->flags & T4_FATAL_ERROR; + return rdev->flags & T4_IW_STOPPED; } static inline int c4iw_num_stags(struct c4iw_rdev *rdev) @@ -214,7 +214,7 @@ c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp, int timedout = 0; struct timeval t1, t2; - if (c4iw_fatal_error(rdev)) { + if (c4iw_stopped(rdev)) { wr_waitp->ret = -EIO; goto out; } @@ -240,7 +240,7 @@ c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp, "seconds - tid %u qpid %u\n", func, device_get_nameunit(sc->dev), t2.tv_sec, t2.tv_usec, hwtid, qpid); - if (c4iw_fatal_error(rdev)) { + if (c4iw_stopped(rdev)) { wr_waitp->ret = -EIO; break; } diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index 5b8c7391514f..348cd3985e87 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -256,7 +256,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, u32 stag_idx; static atomic_t key; - if (c4iw_fatal_error(rdev)) + if (c4iw_stopped(rdev)) return -EIO; stag_state = stag_state > 0;