monitor: only run coroutine commands in qemu_aio_context
[qemu/kevin.git] / net / vmnet_int.h
bloba8a033dc9687da1390644566b2f180ba9ba7a85d
1 /*
2 * vmnet_int.h
4 * Copyright(c) 2022 Vladislav Yaroshchuk <vladislav.yaroshchuk@jetbrains.com>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
10 #ifndef VMNET_INT_H
11 #define VMNET_INT_H
13 #include "vmnet_int.h"
14 #include "clients.h"
16 #include <vmnet/vmnet.h>
17 #include <dispatch/dispatch.h>
19 /**
20 * From vmnet.framework documentation
22 * Each read/write call allows up to 200 packets to be
23 * read or written for a maximum of 256KB.
25 * Each packet written should be a complete
26 * ethernet frame.
28 * https://developer.apple.com/documentation/vmnet
30 #define VMNET_PACKETS_LIMIT 200
32 typedef struct VmnetState {
33 NetClientState nc;
34 interface_ref vmnet_if;
36 uint64_t mtu;
37 uint64_t max_packet_size;
39 dispatch_queue_t if_queue;
41 QEMUBH *send_bh;
43 struct vmpktdesc packets_buf[VMNET_PACKETS_LIMIT];
44 int packets_send_current_pos;
45 int packets_send_end_pos;
47 struct iovec iov_buf[VMNET_PACKETS_LIMIT];
49 VMChangeStateEntry *change;
50 } VmnetState;
52 const char *vmnet_status_map_str(vmnet_return_t status);
54 int vmnet_if_create(NetClientState *nc,
55 xpc_object_t if_desc,
56 Error **errp);
58 ssize_t vmnet_receive_common(NetClientState *nc,
59 const uint8_t *buf,
60 size_t size);
62 void vmnet_cleanup_common(NetClientState *nc);
64 #endif /* VMNET_INT_H */