From nobody Mon Oct 21 18:39:25 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 4XXPH14Wrgz5Zd2L; Mon, 21 Oct 2024 18:39:25 +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 4XXPH111y8z4GLZ; Mon, 21 Oct 2024 18:39:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535965; 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=jIRtHyYYLiu9H6mZcF5+MvzPszJMFPRkuYWGqwbmITI=; b=kBJHp/rMbvYOVCc4lgR9+8JTkfMBbdetG2XFlAwpXyEMJOewp9mSB6FA2P8IcrdTCYEP2M 8PSHdFtzQkkD/mvXeKzBix1K6zsnQXPHZL3WZs+KvkE0hF85QdesAMyzQs6EnvdD37Gl+z CTJYcAwpWylpPYI6g5gJl5Wu/lckQCjDM+jjfESk32y+auZo3a/YfEeWVY7oNQFSbXhtnb yvWheWc4Z6LBIMeVPYyIhH5xeuqsKMXY3K6a2xMWmf4P9x4JUPOnCTUOm7OkV+JU4BWxmS QHwGiqvteVKh0v+Mb60C/Q1TC3VT9q8/kk8P/AnFDpLOm1LyRqMvuTMewZt7mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535965; 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=jIRtHyYYLiu9H6mZcF5+MvzPszJMFPRkuYWGqwbmITI=; b=kmNZg6ZMlDfpU3n4SBx9gAHkWdotqRZNc/DrxtIQggbXPAKzmQBhK5CIfkIXW/++rxW9OD v5UtbgtMQIfqIkjiSpq7uWfbAJOGG09dl6Ayv4tIKbrtKYA0Sug+4X9bJ1sQMtY1bLL6rQ vhLsLPhTWxooZh5Dp3zbeDcujazSJwwPi/0Z0c37LlE+F0W17GtqeI4MP1HkuUSIMc7vlG 3TXBN7cOLUi4Dopb1wqrcDLUSTur7L6DDHGgJUFfvFCvr+AOFdRmthp3RekIthbZdfjdoJ UlUt33ejeXmqsNA0sT56FkHfba+qpSCzwKARj0R1uoCe2/cfs+vKQmxr3KK+uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535965; a=rsa-sha256; cv=none; b=wJ9kEWQaRZar4pCFi3Y12u5hDJCSHUxEPsKs8cLtIQvrxdCYnv2Vs8ugf96LdGo1Oa8I2M I+iDeaXO2xqkX1fvoxzif1qbo/5MLOjJVPnKcp+Jr5oEh1x2H3kxUg3Yreq59aZzhsIHY6 c1LueFdd01kpnaZc+wOBFB4Idsz3I4HTLnzoWs74P2QHzxJdKeDz8jY1B5DQkLpBkHdINn dJ8NSUiEZFj94lAqrb3vl06m6rcA8I9QGc3v1cWnjlc+qNNKbXzaYEPkmnVggxWDEJ8054 RX4SeLodm+G2ZEL1+NNcHHODj/kbNVRhPrSWZNfiPQ++9RxHE2OXiAFnu40Nbw== 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 4XXPH10b1Fzh9W; Mon, 21 Oct 2024 18:39:25 +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 49LIdPoG036843; Mon, 21 Oct 2024 18:39:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdPTq036840; Mon, 21 Oct 2024 18:39:25 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:25 GMT Message-Id: <202410211839.49LIdPTq036840@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: c7550138e5b5 - stable/14 - cxgbe/iw_cxgbe: Fail early in some callbacks when the RNIC is stopped. 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: c7550138e5b55f77bf5c8a7907c2f5f6134b4ddd Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=c7550138e5b55f77bf5c8a7907c2f5f6134b4ddd commit c7550138e5b55f77bf5c8a7907c2f5f6134b4ddd Author: Navdeep Parhar AuthorDate: 2024-08-30 00:23:16 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:08:56 +0000 cxgbe/iw_cxgbe: Fail early in some callbacks when the RNIC is stopped. Stop allocating new resources when the RNIC is stopped but continue to allow previously allocated resources to be freed. Note that t4_tom's uld_stop tears down all TOE connections, including those being used for iWARP, and that triggers the cleanup of iWARP resources. Fail post_send/post_recv early too to avoid the SQ doorbell. Sponsored by: Chelsio Communications (cherry picked from commit 9fdb683d92b36cbd20bbd8d61f0c1138f8348dd4) --- sys/dev/cxgbe/iw_cxgbe/cm.c | 2 ++ sys/dev/cxgbe/iw_cxgbe/cq.c | 4 ++++ sys/dev/cxgbe/iw_cxgbe/mem.c | 3 +++ sys/dev/cxgbe/iw_cxgbe/provider.c | 2 ++ sys/dev/cxgbe/iw_cxgbe/qp.c | 7 +++++++ 5 files changed, 18 insertions(+) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index cf4a8f1aa87b..a343014f0b6d 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -2611,6 +2611,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id); + if (__predict_false(c4iw_stopped(&dev->rdev))) + return -EIO; if ((conn_param->ord > c4iw_max_read_depth) || (conn_param->ird > c4iw_max_read_depth)) { diff --git a/sys/dev/cxgbe/iw_cxgbe/cq.c b/sys/dev/cxgbe/iw_cxgbe/cq.c index 9339d083cae3..197f2bcf8af0 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cq.c +++ b/sys/dev/cxgbe/iw_cxgbe/cq.c @@ -106,6 +106,8 @@ create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, struct wrqe *wr; u64 cq_bar2_qoffset = 0; + if (__predict_false(c4iw_stopped(rdev))) + return -EIO; cq->cqid = c4iw_get_cqid(rdev, uctx); if (!cq->cqid) { ret = -ENOMEM; @@ -1037,6 +1039,8 @@ int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) unsigned long flag; chp = to_c4iw_cq(ibcq); + if (__predict_false(c4iw_stopped(chp->cq.rdev))) + return -EIO; spin_lock_irqsave(&chp->lock, flag); t4_arm_cq(&chp->cq, (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED); diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index 348cd3985e87..4a1adc118b7c 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -621,6 +621,9 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, php = to_c4iw_pd(pd); rhp = php->rhp; + if (__predict_false(c4iw_stopped(&rhp->rdev))) + return ERR_PTR(-EIO); + if (mr_type != IB_MR_TYPE_MEM_REG || max_num_sg > t4_max_fr_depth(&rhp->rdev, use_dsgl)) return ERR_PTR(-EINVAL); diff --git a/sys/dev/cxgbe/iw_cxgbe/provider.c b/sys/dev/cxgbe/iw_cxgbe/provider.c index 729733a040d5..511caa436969 100644 --- a/sys/dev/cxgbe/iw_cxgbe/provider.c +++ b/sys/dev/cxgbe/iw_cxgbe/provider.c @@ -231,6 +231,8 @@ c4iw_allocate_pd(struct ib_pd *pd, struct ib_udata *udata) CTR4(KTR_IW_CXGBE, "%s: ibdev %p, pd %p, data %p", __func__, ibdev, pd, udata); rhp = (struct c4iw_dev *) ibdev; + if (__predict_false(c4iw_stopped(&rhp->rdev))) + return -EIO; pdid = c4iw_get_resource(&rhp->rdev.resource.pdid_table); if (!pdid) return -EINVAL; diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index 3aab07755101..0e374bc961c4 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -138,6 +138,9 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, struct wrqe *wr; u64 sq_bar2_qoffset = 0, rq_bar2_qoffset = 0; + if (__predict_false(c4iw_stopped(rdev))) + return -EIO; + wq->sq.qid = c4iw_get_qpid(rdev, uctx); if (!wq->sq.qid) return -ENOMEM; @@ -785,6 +788,8 @@ int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, qhp = to_c4iw_qp(ibqp); rdev = &qhp->rhp->rdev; + if (__predict_false(c4iw_stopped(rdev))) + return -EIO; spin_lock_irqsave(&qhp->lock, flag); if (t4_wq_in_error(&qhp->wq)) { spin_unlock_irqrestore(&qhp->lock, flag); @@ -920,6 +925,8 @@ int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, u16 idx = 0; qhp = to_c4iw_qp(ibqp); + if (__predict_false(c4iw_stopped(&qhp->rhp->rdev))) + return -EIO; spin_lock_irqsave(&qhp->lock, flag); if (t4_wq_in_error(&qhp->wq)) { spin_unlock_irqrestore(&qhp->lock, flag);