From nobody Fri Oct 13 19:29:34 2023 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 4S6c5V3b3Rz4wgLq; Fri, 13 Oct 2023 19:29:34 +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 4S6c5V36r0z4X9L; Fri, 13 Oct 2023 19:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697225374; 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=yUVWt4Jvt65dVCm0+8VCFrJExom1TYMecNCN5bxE1hs=; b=YzdhR3iVubKFmYXQSfAISx9zXKGZjXKZEATGA8sXFWCh1f0NxIP2VWhglmo4zczAiI7lkS DG8OAFkU0o+c2zqNi4Bjm7FBTNP3TwDRetANKg9frmO5AcSJC00+MXrRCl+U3jUIUHM9ef lRk6dPd2pE7UAuN8FqiJkMQ5CNvlV1IzHolLmI6DjGh7fm6JwiBwW1I/SSj9+NtlTHZkD+ c3kDpEjvUOuMVfq3ArYHZ0riGVOE4N1JmkQKF/eGZ8WQzohFDWXNbStfCR6Odvf3FNPFcQ wST0iuXfRvJAAoZdPmmViDN4IyJE1qtNIJucdS+kifPlzF13elSK6R/lf8SLPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697225374; a=rsa-sha256; cv=none; b=MhVonK9LijfgFcgxBbMV/gvFkqCeNNih1hu1MGD5POSBADndV1mQMI+Ht2ziOj7xNr6SQq B8HbabXVtGcmoL4PP+eTwF9lzIngGlPgW78VnZF0ZoWRUsez1bA07ADGBkYVQQlZeiq6F1 Zz/eHQPLFJdfzWt6YiXKEjt5adRJ+v11nmqbmdRG+73lZNYdNoI568eoBhgSHAgm4klDPb brkLlJY34SqWjIK7Xqjq1FVDN/plvmEplFr0lst5gS3lAsf70yTlSTvxy8v4i/ts/7RELf m6utHQVEAr5Z/BWIld2MxRl6vYiWUrdNWEWOyRWRk+6CE5Sd3PJumgXfLeCdrg== 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=1697225374; 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=yUVWt4Jvt65dVCm0+8VCFrJExom1TYMecNCN5bxE1hs=; b=MrAfxzTvJ9BINLvWEhVlPzvxsWTR3iTnZ6szoPU7Do2KGGz8wWdUACLti1HO6j9+nOQPrf 0Vr5Cw9Cx4tGeU9i2IC+iLQTlCuk9ZqxqmH2zh1xPGSaIq2wGbEHkw6lk25gCQgel/DEu0 8xRS9vkWSOLsQbGpwEhi8EbblFUVfxTnNbszVJae3Bq1L/XMmcKpn15CB8i59ZPNGz+dp5 CJPUEgAH2wL0R6j8gRgC4LweUysplAF+ZBaM4IHxdvKXxq3BiVZRUb5KYcFb6gErraTzgT HkWwT2ISjbFtO6vtnH8ZZeIb/BNrdAcospOeBBZsd2vj4hwB9EwcEqNOjairgw== 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 4S6c5V2C57z10wk; Fri, 13 Oct 2023 19:29:34 +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 39DJTYOc082782; Fri, 13 Oct 2023 19:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39DJTYiF082779; Fri, 13 Oct 2023 19:29:34 GMT (envelope-from git) Date: Fri, 13 Oct 2023 19:29:34 GMT Message-Id: <202310131929.39DJTYiF082779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f0852344e7ab - main - bhyve: Some fwctl simplifications. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0852344e7abf4d74508185e67a1b98d6cdbd026 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f0852344e7abf4d74508185e67a1b98d6cdbd026 commit f0852344e7abf4d74508185e67a1b98d6cdbd026 Author: John Baldwin AuthorDate: 2023-10-13 19:26:22 +0000 Commit: John Baldwin CommitDate: 2023-10-13 19:26:22 +0000 bhyve: Some fwctl simplifications. - Collapse IDENT_SEND/IDENT_WAIT states down to a single state. - Remove unused 'len' argument to op_data callback. The value passed in (total amount of remaining data to receive) didn't seem very useful and no op_data implementations used it. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D41286 --- usr.sbin/bhyve/amd64/fwctl.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/usr.sbin/bhyve/amd64/fwctl.c b/usr.sbin/bhyve/amd64/fwctl.c index 01b16c38f3a7..5e930cdb2051 100644 --- a/usr.sbin/bhyve/amd64/fwctl.c +++ b/usr.sbin/bhyve/amd64/fwctl.c @@ -63,8 +63,7 @@ * Back-end state-machine */ static enum state { - IDENT_WAIT, - IDENT_SEND, + IDENT, REQ, RESP } be_state; @@ -75,7 +74,7 @@ static u_int ident_idx; struct op_info { int op; int (*op_start)(uint32_t len); - void (*op_data)(uint32_t data, uint32_t len); + void (*op_data)(uint32_t data); int (*op_result)(struct iovec **data); void (*op_done)(struct iovec *data); }; @@ -120,7 +119,7 @@ errop_start(uint32_t len __unused) } static void -errop_data(uint32_t data __unused, uint32_t len __unused) +errop_data(uint32_t data __unused) { /* ignore */ @@ -192,7 +191,7 @@ fget_start(uint32_t len) } static void -fget_data(uint32_t data, uint32_t len __unused) +fget_data(uint32_t data) { assert(fget_cnt + sizeof(uint32_t) <= sizeof(fget_str)); @@ -347,7 +346,7 @@ fwctl_request_data(uint32_t value) else rinfo.req_size -= sizeof(uint32_t); - (*rinfo.req_op->op_data)(value, rinfo.req_size); + (*rinfo.req_op->op_data)(value); if (rinfo.req_size < sizeof(uint32_t)) { fwctl_request_done(); @@ -360,7 +359,6 @@ fwctl_request_data(uint32_t value) static int fwctl_request(uint32_t value) { - int ret; ret = 0; @@ -451,12 +449,11 @@ fwctl_reset(void) /* Discard partially-received request. */ memset(&rinfo, 0, sizeof(rinfo)); break; - case IDENT_WAIT: - case IDENT_SEND: + case IDENT: break; } - be_state = IDENT_SEND; + be_state = IDENT; ident_idx = 0; } @@ -472,7 +469,7 @@ fwctl_inb(void) retval = 0xff; switch (be_state) { - case IDENT_SEND: + case IDENT: retval = sig[ident_idx++]; if (ident_idx >= sizeof(sig)) be_state = REQ; @@ -580,5 +577,5 @@ fwctl_init(void) ops[OP_GET_LEN] = &fgetlen_info; ops[OP_GET] = &fgetval_info; - be_state = IDENT_WAIT; + be_state = IDENT; }