Merge tag 'pull-aspeed-20220714' of https://github.com/legoater/qemu into staging
[qemu/ar7.git] / net / vmnet_int.h
blobadf6e8c20d5d7780be0e5b7bcba34ecde08731fc
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 "qemu/osdep.h"
14 #include "vmnet_int.h"
15 #include "clients.h"
17 #include <vmnet/vmnet.h>
18 #include <dispatch/dispatch.h>
20 /**
21 * From vmnet.framework documentation
23 * Each read/write call allows up to 200 packets to be
24 * read or written for a maximum of 256KB.
26 * Each packet written should be a complete
27 * ethernet frame.
29 * https://developer.apple.com/documentation/vmnet
31 #define VMNET_PACKETS_LIMIT 200
33 typedef struct VmnetState {
34 NetClientState nc;
35 interface_ref vmnet_if;
37 uint64_t mtu;
38 uint64_t max_packet_size;
40 dispatch_queue_t if_queue;
42 QEMUBH *send_bh;
44 struct vmpktdesc packets_buf[VMNET_PACKETS_LIMIT];
45 int packets_send_current_pos;
46 int packets_send_end_pos;
48 struct iovec iov_buf[VMNET_PACKETS_LIMIT];
49 } VmnetState;
51 const char *vmnet_status_map_str(vmnet_return_t status);
53 int vmnet_if_create(NetClientState *nc,
54 xpc_object_t if_desc,
55 Error **errp);
57 ssize_t vmnet_receive_common(NetClientState *nc,
58 const uint8_t *buf,
59 size_t size);
61 void vmnet_cleanup_common(NetClientState *nc);
63 #endif /* VMNET_INT_H */