Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2023 19:00:19 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 67d6141e1581 - stable/14 - bhyve: Some fwctl simplifications.
Message-ID:  <202310241900.39OJ0JXq032881@gitrepo.freebsd.org>

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

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

commit 67d6141e1581897d0fd1e1ecf35a99d088b10f97
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-10-13 19:26:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-10-24 18:43:45 +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
    
    (cherry picked from commit f0852344e7abf4d74508185e67a1b98d6cdbd026)
---
 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?202310241900.39OJ0JXq032881>