Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2023 19:29:34 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f0852344e7ab - main - bhyve: Some fwctl simplifications.
Message-ID:  <202310131929.39DJTYiF082779@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0852344e7abf4d74508185e67a1b98d6cdbd026

commit f0852344e7abf4d74508185e67a1b98d6cdbd026
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-10-13 19:26:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
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;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310131929.39DJTYiF082779>