From nobody Mon Oct 21 18:39:21 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 4XXPGx6Fmcz5Zd2D; Mon, 21 Oct 2024 18:39:21 +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 4XXPGx59dqz4Fqp; Mon, 21 Oct 2024 18:39:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535961; 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=uA0on8Z4bPyZzzg8TEYWQukcQ0DRYVzjSzxBTkuj/FQ=; b=qfiuyYLKWDIvPb9YlVbwgXuXSIGvQFZ6y9Vyi2NdQn1fhtJXQ0J4vD7C94tV+cRLNX6Z4m Qr4Ju4OIS1PbA2E+t3x5brasA/TfyUwbWrrAhVUPZzkfglndrBy1h3mojYgbsTHZWK0LwU RDfWW3g5u+hsFPja6BKZ9AQ377++KgTJyiu6GPGGE2RcVwqri+ymgG7QwRdQVAwOSft2tU ycZgfpkNvj4r3fRGY2A8fAkQLspu7hyzLgWeQJ/XMVz+W4u7ZuG2/uZ1mmvdi2s7m+/46j gaFzN8l+ysi8sTp/WR1Rfzdjec2jO4XylSxNplADl+Kgupm9dmC9EU20XOha8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535961; 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=uA0on8Z4bPyZzzg8TEYWQukcQ0DRYVzjSzxBTkuj/FQ=; b=VDxSAV6+Vv169ylMPyCvAfV012Pp0wlWCjHKpplOpN4eTnGz5ni1IC/eJN3vzvgxubylLO jw9Scmt5E1OBUqOY6FXNLlJjm68FWiM+KnrKmD/L6bs6g/+ZDNY5VyMKOCO71/kmv67wPo lXZIgEML+SS+eH2yXuwJYOp01bbIPPAmlKMRtRhhAwW0c8g0DbWFPxXdUNkFrQXDI24Ups ZS040a6uC6VHI6FuTdcwbg2VGEeQRqSsMLX0pb9bRr3vCMtHEUDjnCsRx0+tbsubSWe14V 6GDhW2DBStkLZrRGKGwFugxcuqByjcxdRitszVHKsgVN1Xq4Y7M8OeehfJltkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535961; a=rsa-sha256; cv=none; b=e628B0yUisQOihqyMg25oMRA4C2R9quq6ArsmsV6BtiSQvtnCb5uVu6o1pABOpNpVlY39D cwR2jmcfdbh9HCaJJI36mtAAspmSWkQrYB2xmUWriaxznfH9SPd5pRP9LDf3UWB5wSSkcy K+00/iUsOaitWqcJvE/347T6AeEJPB/8l01UzEQmNcpA6hbVOrMxH4qZPVEzBWz9abEFQc 7y8Z7dYIEmTEPsZG0vABVwAQgQnv+s7IO0yGXMiwtbIU/XHLWcSHM0k/QmkcIeWyD2+bBX NGNNMKyMnooiRq2drt0dZG5aSqlmZ0GcCk+8EmSIgzll7HnI9823xW++p1j6CA== 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 4XXPGx4mzXzhjK; Mon, 21 Oct 2024 18:39:21 +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 49LIdLUs036676; Mon, 21 Oct 2024 18:39:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdLXn036672; Mon, 21 Oct 2024 18:39:21 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:21 GMT Message-Id: <202410211839.49LIdLXn036672@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: cd2ae696295f - stable/14 - cxgbe/iw_cxgbe: Replace the fatal error flag with a stopped flag. 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: cd2ae696295f22db7ee72f528cea646c9c6cdcfb Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2ae696295f22db7ee72f528cea646c9c6cdcfb commit cd2ae696295f22db7ee72f528cea646c9c6cdcfb Author: Navdeep Parhar AuthorDate: 2024-08-28 18:41:10 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:07:49 +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. Sponsored by: Chelsio Communications (cherry picked from commit 8254a276ad893ae2a1b35fcbbad255f06e29b8c6) --- 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 77158eb855df..2ca2fcb8041f 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -1089,7 +1089,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); @@ -2717,8 +2717,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; } @@ -2830,8 +2830,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;