From nobody Fri Jan 19 17:17:43 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 4TGmX81Gmzz56xTB; Fri, 19 Jan 2024 17:17:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGmX76pQVz4N5n; Fri, 19 Jan 2024 17:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705684664; 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=34XDjztCNxgU7LWCJhOJdKpD8Sig86ORoqkXcFVIeW4=; b=bstWyVTz1Ys0WPDwKTCdmovp5XRgh4JQBPCq9iQqGZ1PQq7nvSQrwqfCv2tvy/ywblRWYU 6F7T43GygvfuMA+9qcQgrVIFCLTf1RZjqtaPdBmb31evPsWz0trsgPoWKeyiB8NWzpNKGw MgQASX5rlx8SsAlH86+4WsbA+W+puTuUQyAJLoM0lHyBYNB5nEKwrxYqB4hQDG8c5c8Lj2 vHTmGnzp95zgtnCoMnKlpn44mkIPm6zIP1AHQeUybG9TFC1rl6lrSIVAbRwD5Iel2GcdCH f9z4MXR7MrrVbjtO0AydDGuCna2YZDFCP29dbYdVI6vJAvZd0c4GA6gv4bqOyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705684664; 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=34XDjztCNxgU7LWCJhOJdKpD8Sig86ORoqkXcFVIeW4=; b=s8ICritXn4SG66si2ky+JQE4fVt0pdj0BVnYzuoVfbfKBcaHGGlWkBe6U/ACaRzmnqOcNE PTf8AAmaf53o6NSraw5GcSx+4XfsYmh7g748XJMwe7n8sg6xi3L2iJYPA4NO++PMSVQDmb RRdX0yGZ/RbvEBoUcmmU5zt5+CEA5WID4/hGT6V5nQmrJBO0jAE60w6BywDtjU9gRq3ma9 3RWkYP5opm2XW4sOgXepmE5PUgXZ4FgqR7UcLewIilVHJpVNtJEd8QpY0V5UPAI+OxFaXv irlY9aN4C3CxRdDxHFYouDuQ4Nk9kdKzHsqO2vAbJ85LMUhJ3lU+5iE6GmGM7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705684664; a=rsa-sha256; cv=none; b=SoqGe4VujuYcLJlvuXzriyv49fP7+QpKEdOZh39EfPAYEPW+FUknIfrJE0v1952eTun7Pp oipLafCwiyESfdDdA3XixhSzMGla7uNRamAdKyWrHLndR7YXi0cF2O7nZVmhRI89B/fXiq F0coYFsULA0WrnOxtdXlGK4EG6j5nUr1Pe89qasN0NyjkYn5Q2bJMy7FegnIsMYYPZ6c2k IzS6fHRoHB8XVvkgmpI4E3G5NY0pcH0ly4URSFkw5Cte/ecDif3jRp0UCIo5JVZD0nygIx cm44tu+Z9VjOmRqlA7UT8mp9oq3yWmlI7mQZvR6ppwsFkGJhCXa04GRXVGOpDw== 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 4TGmX75vvcz10v1; Fri, 19 Jan 2024 17:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40JHHhYx097403; Fri, 19 Jan 2024 17:17:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40JHHhUd097400; Fri, 19 Jan 2024 17:17:43 GMT (envelope-from git) Date: Fri, 19 Jan 2024 17:17:43 GMT Message-Id: <202401191717.40JHHhUd097400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: ac7d9eaf066b - stable/14 - mpi3mr: Replace can't happen DataLength == 0 with an assert 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ac7d9eaf066bc844a91d33cbaf16ed70bc39d06d Auto-Submitted: auto-generated The branch stable/14 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ac7d9eaf066bc844a91d33cbaf16ed70bc39d06d commit ac7d9eaf066bc844a91d33cbaf16ed70bc39d06d Author: Warner Losh AuthorDate: 2023-11-29 01:50:47 +0000 Commit: Alexander Motin CommitDate: 2024-01-19 17:16:50 +0000 mpi3mr: Replace can't happen DataLength == 0 with an assert Replace the test for DataLength == 0 with an assert. It can't happen, but an assert doesn't hurt. Emacs removed some trailing white space too. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42807 (cherry picked from commit 2361a0056fc16b5e11df2aa948aaa633ac01d685) --- sys/dev/mpi3mr/mpi3mr_cam.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c index ebbc67af78ba..4d17bb2338e5 100644 --- a/sys/dev/mpi3mr/mpi3mr_cam.c +++ b/sys/dev/mpi3mr/mpi3mr_cam.c @@ -99,7 +99,6 @@ extern int mpi3mr_register_events(struct mpi3mr_softc *sc); extern void mpi3mr_add_sg_single(void *paddr, U8 flags, U32 length, bus_addr_t dma_addr); -extern void mpi3mr_build_zero_len_sge(void *paddr); static U32 event_count; @@ -148,6 +147,9 @@ static void mpi3mr_prepare_sgls(void *arg, KASSERT(nsegs <= MPI3MR_SG_DEPTH && nsegs > 0, ("%s: bad SGE count: %d\n", device_get_nameunit(sc->mpi3mr_dev), nsegs)); + KASSERT(scsiio_req->DataLength != 0, + ("%s: Data segments (%d), but DataLength == 0\n", + device_get_nameunit(sc->mpi3mr_dev), nsegs)); simple_sgl_flags = MPI3_SGE_FLAGS_ELEMENT_TYPE_SIMPLE | MPI3_SGE_FLAGS_DLAS_SYSTEM; @@ -158,13 +160,6 @@ static void mpi3mr_prepare_sgls(void *arg, sg_local = (U8 *)&scsiio_req->SGL; - if (scsiio_req->DataLength == 0) { - /* XXX we don't ever get here when DataLength == 0, right? cm->data is NULL */ - /* This whole if can likely be removed -- we handle it in mpi3mr_request_map */ - mpi3mr_build_zero_len_sge(sg_local); - goto enqueue; - } - sges_left = nsegs; sges_in_segment = (sc->facts.op_req_sz - @@ -215,7 +210,6 @@ fill_in_last_segment: i++; } -enqueue: /* * Now that we've created the sgls, we send the request to the device. * Unlike in Linux, dmaload isn't guaranteed to load every time, but @@ -880,10 +874,10 @@ mpi3mr_scsiio_timeout(void *data) return; /* - * task abort and target reset has failed. So issue Controller reset(soft reset) + * task abort and target reset has failed. So issue Controller reset(soft reset) * through OCR thread context */ - trigger_reset_from_watchdog(sc, MPI3MR_TRIGGER_SOFT_RESET, MPI3MR_RESET_FROM_SCSIIO_TIMEOUT); + trigger_reset_from_watchdog(sc, MPI3MR_TRIGGER_SOFT_RESET, MPI3MR_RESET_FROM_SCSIIO_TIMEOUT); return; } @@ -977,7 +971,7 @@ mpi3mr_action_scsiio(struct mpi3mr_cam_softc *cam_sc, union ccb *ccb) } if (targ->dev_handle == 0x0) { - mpi3mr_dprint(sc, MPI3MR_ERROR, "%s NULL handle for target 0x%x\n", + mpi3mr_dprint(sc, MPI3MR_ERROR, "%s NULL handle for target 0x%x\n", __func__, csio->ccb_h.target_id); mpi3mr_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); xpt_done(ccb);