From nobody Mon Nov 21 13:53:28 2022 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 4NG84843KZz4j5s6; Mon, 21 Nov 2022 13:53:28 +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 4NG8483B1yz47LK; Mon, 21 Nov 2022 13:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669038808; 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=1MF0WESG5lrdIzy8c351pfEh1woTymEACCHUD+8tYpA=; b=x9XQPAuYpAUHncsEKfLunRGX6u2x0UUfCAqqi52Nmg8IOy2JuzQhfmhl8RFHITGVeBxpjy d26CGpWcT43HGVf6wdbX+OqvvpZCkTofKcxHsyjcCarSr6jqNhVTDzY7syrFvmzENBHgDi 8P2bMqrOQSgJS52+yJU0AMq3LacPeHP2+n/kFSl8NP/ntk+u9o2DWH8NnlpYgOlB6l7qsH uwSrlAcjiriIYiRq0RLWn3skC/dOy4kicOnMFtrVro6ifTBpCstB9ZgprI45SqDNjpa1FD sMj7jACQHkkuLONoa6P4YvccwuZXyITIBWclTrFN8pFRzEykvWELwAo5/4bgKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669038808; 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=1MF0WESG5lrdIzy8c351pfEh1woTymEACCHUD+8tYpA=; b=A8qh0vVSIaBgS0bvrFd7/EDp/LGUs2fUijqlJ8LDp3e4o5HVAchdh4SHe8zrGZ3q9CFBDS ENh8yDPepdJGM2oGb+bK8YDKAfPFvOal3Vzvz6DbS4f+NCCUwju/FLUdeQwPHwIzUam/wh +4mFUojQcq5W2t6UhO2FEStBsOyJLANa3VT6Zts9MN8iDaZYK/uE6MDT4EsWq+COy/k1vc g1Ra6ne1I7hvQVncBEMMh4ZqUyLBDaNsHZ916Yg62b/9V7bfSq8IvCJmLdouXtRfpyUmm2 00yl7otvBEnH0znrWdIFfWnKMXJtV0Vk1AGOqZvP67L6iNuZhMfZfMjarPr55Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669038808; a=rsa-sha256; cv=none; b=wwzGqVQe6WuHNH1v2vjGxcZgFgge1eSrM8hIL4adrIUAoLSeyYCLTEpjbURwxGFn39/Nz9 T4Kq63O8rIQAIngRy8KMF7LuXR/zSn60qDvUNvnQudQpGuXOC/R5vKNxa6/3m7TSK9MkHk PsUyIXbIY611ferfNjgwq8Jf1LasM+ooEAMIr8ydKuaEVskscNoMq+Bl99nqbcq3Cz+iV8 msZuSmYZ0m1K4BiDuZxbQAYxB6JXoNYJ9ubdDMdbDX2Hxp+2oRimIm+SACcdkW4gI8lBc1 jJVksWlVqx2n03GI75b4nrah5lWjz0VHx9C0r/E3nRIZ5QfeDTbkaCbV2mZY2Q== 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 4NG84820Bvz153x; Mon, 21 Nov 2022 13:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ALDrSBU083492; Mon, 21 Nov 2022 13:53:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ALDrShO083491; Mon, 21 Nov 2022 13:53:28 GMT (envelope-from git) Date: Mon, 21 Nov 2022 13:53:28 GMT Message-Id: <202211211353.2ALDrShO083491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 055648ccb721 - stable/13 - bhyve: Simplify control flow in the xhci device model 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 055648ccb72174c7827e36ac15eafd860471968c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=055648ccb72174c7827e36ac15eafd860471968c commit 055648ccb72174c7827e36ac15eafd860471968c Author: Mark Johnston AuthorDate: 2022-11-14 20:08:45 +0000 Commit: Mark Johnston CommitDate: 2022-11-21 13:48:48 +0000 bhyve: Simplify control flow in the xhci device model We only need to call pci_xhci_xfer_complete() when handling a transfer to the control endpoint, so move that code into the epid == 1 block and eliminate a goto. Also remove an unneeded reinitialization of setup_trb. No functional change intended. MFC after: 1 week Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37287 (cherry picked from commit c4c368fb3ecc426660f79b1c25f18d0401ff96fc) --- usr.sbin/bhyve/pci_xhci.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c index 4bd0715d14ce..5502f95c3b46 100644 --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -1726,7 +1726,7 @@ pci_xhci_handle_transfer(struct pci_xhci_softc *sc, DPRINTF(("pci_xhci handle_transfer slot %u", slot)); retry: - err = 0; + err = XHCI_TRB_ERROR_INVALID; do_retry = 0; do_intr = 0; setup_trb = NULL; @@ -1850,24 +1850,26 @@ retry: goto errout; if (epid == 1) { - err = USB_ERR_NOT_STARTED; + int usberr; + if (dev->dev_ue->ue_request != NULL) - err = dev->dev_ue->ue_request(dev->dev_sc, xfer); - setup_trb = NULL; + usberr = dev->dev_ue->ue_request(dev->dev_sc, xfer); + else + usberr = USB_ERR_NOT_STARTED; + err = USB_TO_XHCI_ERR(usberr); + if (err == XHCI_TRB_ERROR_SUCCESS || + err == XHCI_TRB_ERROR_STALL || + err == XHCI_TRB_ERROR_SHORT_PKT) { + err = pci_xhci_xfer_complete(sc, xfer, slot, epid, + &do_intr); + if (err != XHCI_TRB_ERROR_SUCCESS) + do_retry = 0; + } + } else { /* handle data transfer */ pci_xhci_try_usb_xfer(sc, dev, devep, ep_ctx, slot, epid); err = XHCI_TRB_ERROR_SUCCESS; - goto errout; - } - - err = USB_TO_XHCI_ERR(err); - if ((err == XHCI_TRB_ERROR_SUCCESS) || - (err == XHCI_TRB_ERROR_STALL) || - (err == XHCI_TRB_ERROR_SHORT_PKT)) { - err = pci_xhci_xfer_complete(sc, xfer, slot, epid, &do_intr); - if (err != XHCI_TRB_ERROR_SUCCESS) - do_retry = 0; } errout: