пт, 21 янв. 2022 г. в 16:03, Akihiko Odaki <akihiko.od...@gmail.com>:
> On Fri, Jan 21, 2022 at 9:19 PM Vladislav Yaroshchuk > <yaroshchuk2...@gmail.com> wrote: > > > > > > чт, 20 янв. 2022 г. в 11:32, Roman Bolshakov <ro...@roolebo.dev>: > >> > >> On Thu, Jan 13, 2022 at 08:22:14PM +0300, Vladislav Yaroshchuk wrote: > >> > Create separate netdevs for each vmnet operating mode: > >> > - vmnet-host > >> > - vmnet-shared > >> > - vmnet-bridged > >> > > >> > >> Sure I'm late to the party but what if we add only one backend - vmnet > >> with default mode set to shared and all parameters are added there? > >> > >> The CLI would look more reasonable for the most typical use case: > >> -netdev vmnet,id=if1 -device virtio-net,netdev=if1 > >> > >> That would remove duplication of options in QAPI schema (e.g. isolated > >> is available in all backends now, altough I'm not sure if it makes sense > >> for bridged mode): > >> > >> -netdev vmnet,id=if1,isolated=yes > >> > >> start-address, end-address and subnet-mask are also used by both shared > >> and host modes. > >> > >> Bridged netdev would lool like: > >> > >> -netdev vmnet,id=if1,mode=bridged,ifname=en1 > >> > >> Checksum offloading also seems to be available for all backends from > >> Monterey. > >> > >> The approach might simplify integration of the changes to libvirt and > >> discovery of upcoming vmnet features via qapi. > >> > > > > I can rewrite this if it sounds more suitable to use > > single `vmnet` netdev instead of three different ones. > > We can discuss this with Markus as a QAPI reviewer. > > Markus, what is your opinion about single netdev? > > > > P.S. Seems we have enough time for discussion: > > I started fixing memory leaks found by Akihiko and > > met a strange deadlock on QEMU shutdown on > > `qemu_mutex_lock_iothread()` during careful > > interface destruction with added semaphore. > > Need to go deeper to understand what's the > > problem, it will take some time. > > > > Mentioned part of Akihiko's review: > > > https://patchew.org/QEMU/20220113172219.66372-1-yaroshchuk2...@gmail.com/20220113172219.66372-4-yaroshchuk2...@gmail.com/ > > > Actually I thought it would be tricky to implement. You mean single netdev type? Actually I thought it would be tricky to implement. A deadlock will > occur in a simple implementation if vmnet_send is already queued but > not executed yet when destructing: > - vmnet_send tries to lock the iothread and waits for the destructor to > unlock. > - vmnet_stop_interface waits for vmnet_send finishing. > > Sounds like that's what happens actually. With added semaphore: --- a/net/vmnet-common.m +++ b/net/vmnet-common.m @@ -320,13 +320,14 @@ void vmnet_cleanup_common(NetClientState *nc) "org.qemu.vmnet.destroy", DISPATCH_QUEUE_SERIAL ); - + dispatch_semaphore_t if_destroy_sem = dispatch_semaphore_create(0); vmnet_stop_interface( s->vmnet_if, if_destroy_q, ^(vmnet_return_t status) { + dispatch_semaphore_signal(if_destroy_sem); }); - + dispatch_semaphore_wait(if_destroy_sem, DISPATCH_TIME_FOREVER); for (int i = 0; i < VMNET_PACKETS_LIMIT; ++i) { g_free(s->iov_buf[i].iov_base); } -- I see this thread dump on deadlock: (lldb) bt all * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP * frame #0: 0x00007fff2037ebb2 libsystem_kernel.dylib`__semwait_signal + 10 frame #1: 0x00007fff202fec1a libsystem_c.dylib`nanosleep + 196 frame #2: 0x00007fff212c4bb8 Foundation`+[NSThread sleepForTimeInterval:] + 170 frame #3: 0x0000000101ebce3a qemu-system-x86_64`-[QemuCocoaAppController applicationWillTerminate:](self=0x00007fa9f91a1de0, _cmd="applicationWillTerminate:", aNotification=@"NSApplicationWillTerminateNotification") at cocoa.m:1202:5 frame #4: 0x00007fff204a00cd CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 frame #5: 0x00007fff2053bb1c CoreFoundation`___CFXRegistrationPost_block_invoke + 49 frame #6: 0x00007fff2053ba9a CoreFoundation`_CFXRegistrationPost + 454 frame #7: 0x00007fff2047134e CoreFoundation`_CFXNotificationPost + 736 frame #8: 0x00007fff211e1bb8 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 59 frame #9: 0x00007fff22f585b3 AppKit`-[NSApplication terminate:] + 1377 frame #10: 0x0000000101ebcf1f qemu-system-x86_64`-[QemuCocoaAppController windowShouldClose:](self=0x00007fa9f91a1de0, _cmd="windowShouldClose:", sender=0x00007fa9f91a7810) at cocoa.m:1231:5 frame #11: 0x00007fff230417c9 AppKit`__19-[NSWindow __close]_block_invoke + 153 frame #12: 0x00007fff23041723 AppKit`-[NSWindow __close] + 284 frame #13: 0x00007fff22ed12bb AppKit`-[NSApplication(NSResponder) sendAction:to:from:] + 288 frame #14: 0x00007fff22ed115f AppKit`-[NSControl sendAction:to:] + 86 frame #15: 0x00007fff22ed1091 AppKit`__26-[NSCell _sendActionFrom:]_block_invoke + 131 frame #16: 0x00007fff22ed0f98 AppKit`-[NSCell _sendActionFrom:] + 171 frame #17: 0x00007fff22ed0ede AppKit`-[NSButtonCell _sendActionFrom:] + 96 frame #18: 0x00007fff22ecdfc7 AppKit`NSControlTrackMouse + 1820 frame #19: 0x00007fff22ecd883 AppKit`-[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 130 frame #20: 0x00007fff22ecd74a AppKit`-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 697 frame #21: 0x00007fff22ecca72 AppKit`-[NSControl mouseDown:] + 722 frame #22: 0x00007fff22ecae5e AppKit`-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4961 frame #23: 0x00007fff22e3a648 AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2594 frame #24: 0x00007fff22e39a06 AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 347 frame #25: 0x00007fff22e37e14 AppKit`-[NSApplication(NSEvent) sendEvent:] + 352 frame #26: 0x0000000101ebec29 qemu-system-x86_64`-[QemuApplication sendEvent:](self=0x00007fa9f90374e0, _cmd="sendEvent:", event=0x00007fa9f6ef1920) at cocoa.m:1582:9 frame #27: 0x00007fff23110be1 AppKit`-[NSApplication _handleEvent:] + 65 frame #28: 0x00007fff22ca0c8e AppKit`-[NSApplication run] + 623 frame #29: 0x0000000101ebef45 qemu-system-x86_64`main(argc=3, argv=0x00007ffeedd71a20) at cocoa.m:1947:5 frame #30: 0x00007fff203ccf3d libdyld.dylib`start + 1 thread #2 frame #0: 0x00007fff2037ecde libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x00007fff203b1e49 libsystem_pthread.dylib`_pthread_cond_wait + 1298 frame #2: 0x00000001026b7837 qemu-system-x86_64`qemu_futex_wait(ev=0x0000000102e88eb8, val=4294967295) at qemu-thread-posix.c:386:9 frame #3: 0x00000001026b77b0 qemu-system-x86_64`qemu_event_wait(ev=0x0000000102e88eb8) at qemu-thread-posix.c:481:9 frame #4: 0x00000001026c56be qemu-system-x86_64`call_rcu_thread(opaque=0x0000000000000000) at rcu.c:261:21 frame #5: 0x00000001026b7b76 qemu-system-x86_64`qemu_thread_start(args=0x00007fa9f9105320) at qemu-thread-posix.c:556:9 frame #6: 0x00007fff203b18fc libsystem_pthread.dylib`_pthread_start + 224 frame #7: 0x00007fff203ad443 libsystem_pthread.dylib`thread_start + 15 thread #3 frame #0: 0x00007fff2037c2f6 libsystem_kernel.dylib`semaphore_wait_trap + 10 frame #1: 0x00007fff20207c9b libdispatch.dylib`_dispatch_sema4_wait + 16 frame #2: 0x00007fff2020816d libdispatch.dylib`_dispatch_semaphore_wait_slow + 98 frame #3: 0x0000000101f6ac1b qemu-system-x86_64`vmnet_cleanup_common(nc=0x00007fa9f7019400) at vmnet-common.m:330:5 frame #4: 0x0000000101f5c6cd qemu-system-x86_64`qemu_cleanup_net_client(nc=0x00007fa9f7019400) at net.c:361:9 frame #5: 0x0000000101f5c4cf qemu-system-x86_64`qemu_del_net_client(nc=0x00007fa9f7019400) at net.c:417:13 frame #6: 0x0000000101f5e751 qemu-system-x86_64`net_cleanup at net.c:1447:13 frame #7: 0x000000010228f548 qemu-system-x86_64`qemu_cleanup at runstate.c:820:5 frame #8: 0x0000000101e9950d qemu-system-x86_64`qemu_main(argc=3, argv=0x00007ffeedd71a20, envp=0x00007ffeedd71a40) at main.c:51:5 frame #9: 0x0000000101ebefb4 qemu-system-x86_64`call_qemu_main(opaque=0x0000000000000000) at cocoa.m:1897:14 frame #10: 0x00000001026b7b76 qemu-system-x86_64`qemu_thread_start(args=0x00007fa9f9105320) at qemu-thread-posix.c:556:9 frame #11: 0x00007fff203b18fc libsystem_pthread.dylib`_pthread_start + 224 frame #12: 0x00007fff203ad443 libsystem_pthread.dylib`thread_start + 15 thread #4 frame #0: 0x00007fff20384e22 libsystem_kernel.dylib`__sigwait + 10 frame #1: 0x00007fff203b1fff libsystem_pthread.dylib`sigwait + 29 frame #2: 0x00000001026b3541 qemu-system-x86_64`sigwait_compat(opaque=0x00007fa9f6d0a3f0) at compatfd.c:36:15 frame #3: 0x00000001026b7b76 qemu-system-x86_64`qemu_thread_start(args=0x00007fa9f6d09ec0) at qemu-thread-posix.c:556:9 frame #4: 0x00007fff203b18fc libsystem_pthread.dylib`_pthread_start + 224 frame #5: 0x00007fff203ad443 libsystem_pthread.dylib`thread_start + 15 thread #7 frame #0: 0x00007fff2037e4ca libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x00007fff203af2ab libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 76 frame #2: 0x00007fff203ad192 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 204 frame #3: 0x00007fff203b1ee1 libsystem_pthread.dylib`_pthread_cond_wait + 1450 frame #4: 0x00000001026b6d92 qemu-system-x86_64`qemu_cond_wait_impl(cond=0x00007fa9f6c2edf0, mutex=0x0000000102e758f0, file="../softmmu/cpus.c", line=423) at qemu-thread-posix.c:195:11 frame #5: 0x000000010227c716 qemu-system-x86_64`qemu_wait_io_event(cpu=0x00007fa9f949a000) at cpus.c:423:9 frame #6: 0x000000010239c94e qemu-system-x86_64`mttcg_cpu_thread_fn(arg=0x00007fa9f949a000) at tcg-accel-ops-mttcg.c:123:9 frame #7: 0x00000001026b7b76 qemu-system-x86_64`qemu_thread_start(args=0x00007fa9f6c2f5e0) at qemu-thread-posix.c:556:9 frame #8: 0x00007fff203b18fc libsystem_pthread.dylib`_pthread_start + 224 frame #9: 0x00007fff203ad443 libsystem_pthread.dylib`thread_start + 15 thread #8 frame #0: 0x00007fff2037d95e libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x00007fff203ae4c1 libsystem_pthread.dylib`_pthread_wqthread + 414 frame #2: 0x00007fff203ad42f libsystem_pthread.dylib`start_wqthread + 15 thread #9, queue = 'org.qemu.vmnet.if_queue' frame #0: 0x00007fff2037e4ca libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x00007fff203af2ab libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 76 frame #2: 0x00007fff203ad192 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 204 frame #3: 0x00000001026b67ea qemu-system-x86_64`qemu_mutex_lock_impl(mutex=0x0000000102e758f0, file="../net/vmnet-common.m", line=91) at qemu-thread-posix.c:80:11 frame #4: 0x000000010227c9d2 qemu-system-x86_64`qemu_mutex_lock_iothread_impl(file="../net/vmnet-common.m", line=91) at cpus.c:497:5 frame #5: 0x0000000101f6ae9e qemu-system-x86_64`vmnet_send(nc=0x00007fa9f7019400, event_id=VMNET_INTERFACE_PACKETS_AVAILABLE, event=0x00007fa9f6d3b860) at vmnet-common.m:91:5 frame #6: 0x0000000101f6acf3 qemu-system-x86_64`__vmnet_register_event_callback_block_invoke(.block_descriptor=0x00007fa9f9034240, event_id=VMNET_INTERFACE_PACKETS_AVAILABLE, event=0x00007fa9f6d3b860) at vmnet-common.m:121:15 frame #7: 0x00007fff6f385a3d vmnet`__vmnet_interface_set_event_callback_block_invoke_3 + 195 frame #8: 0x00007fff20207806 libdispatch.dylib`_dispatch_client_callout + 8 frame #9: 0x00007fff2020a1b0 libdispatch.dylib`_dispatch_continuation_pop + 423 frame #10: 0x00007fff2021a564 libdispatch.dylib`_dispatch_source_invoke + 2061 frame #11: 0x00007fff2020d493 libdispatch.dylib`_dispatch_lane_serial_drain + 263 frame #12: 0x00007fff2020e0ad libdispatch.dylib`_dispatch_lane_invoke + 366 frame #13: 0x00007fff20217c0d libdispatch.dylib`_dispatch_workloop_worker_thread + 811 frame #14: 0x00007fff203ae45d libsystem_pthread.dylib`_pthread_wqthread + 314 frame #15: 0x00007fff203ad42f libsystem_pthread.dylib`start_wqthread + 15 thread #11, name = 'com.apple.NSEventThread' frame #0: 0x00007fff2037c2ba libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x00007fff2037c62c libsystem_kernel.dylib`mach_msg + 60 frame #2: 0x00007fff204aab2f CoreFoundation`__CFRunLoopServiceMachPort + 316 frame #3: 0x00007fff204a920f CoreFoundation`__CFRunLoopRun + 1328 frame #4: 0x00007fff204a861c CoreFoundation`CFRunLoopRunSpecific + 563 frame #5: 0x00007fff22e3623a AppKit`_NSEventThread + 124 frame #6: 0x00007fff203b18fc libsystem_pthread.dylib`_pthread_start + 224 frame #7: 0x00007fff203ad443 libsystem_pthread.dylib`thread_start + 15 Though I doubt it is the cause of your deadlock. This deadlock would > not happen frequently since vmnet_send will not be queued if the > device is not used. > > Having two-three connected nics causes deadlock almost every time. With only one nic it happens one time out of two or three. An interesting thing is that using qemu_send_packet() instead of qemu_send_packet_async() fixes the problem. Hope to start investigating this next week. Regards, > Akihiko Odaki > > > > > > >> Thanks, > >> Roman > >> > >> > Signed-off-by: Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > --- > >> > net/clients.h | 11 ++++ > >> > net/meson.build | 7 +++ > >> > net/net.c | 10 ++++ > >> > net/vmnet-bridged.m | 25 +++++++++ > >> > net/vmnet-common.m | 20 +++++++ > >> > net/vmnet-host.c | 24 ++++++++ > >> > net/vmnet-shared.c | 25 +++++++++ > >> > net/vmnet_int.h | 25 +++++++++ > >> > qapi/net.json | 133 > +++++++++++++++++++++++++++++++++++++++++++- > >> > 9 files changed, 278 insertions(+), 2 deletions(-) > >> > create mode 100644 net/vmnet-bridged.m > >> > create mode 100644 net/vmnet-common.m > >> > create mode 100644 net/vmnet-host.c > >> > create mode 100644 net/vmnet-shared.c > >> > create mode 100644 net/vmnet_int.h > >> > > >> > diff --git a/net/net.c b/net/net.c > >> > index f0d14dbfc1..1dbb64b935 100644 > >> > --- a/net/net.c > >> > +++ b/net/net.c > >> > @@ -1021,6 +1021,11 @@ static int (* const > net_client_init_fun[NET_CLIENT_DRIVER__MAX])( > >> > #ifdef CONFIG_L2TPV3 > >> > [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3, > >> > #endif > >> > +#ifdef CONFIG_VMNET > >> > + [NET_CLIENT_DRIVER_VMNET_HOST] = net_init_vmnet_host, > >> > + [NET_CLIENT_DRIVER_VMNET_SHARED] = net_init_vmnet_shared, > >> > + [NET_CLIENT_DRIVER_VMNET_BRIDGED] = net_init_vmnet_bridged, > >> > +#endif /* CONFIG_VMNET */ > >> > }; > >> > > >> > > >> > @@ -1106,6 +1111,11 @@ void show_netdevs(void) > >> > #endif > >> > #ifdef CONFIG_VHOST_VDPA > >> > "vhost-vdpa", > >> > +#endif > >> > +#ifdef CONFIG_VMNET > >> > + "vmnet-host", > >> > + "vmnet-shared", > >> > + "vmnet-bridged", > >> > #endif > >> > }; > >> > > >> > diff --git a/net/vmnet-bridged.m b/net/vmnet-bridged.m > >> > new file mode 100644 > >> > index 0000000000..4e42a90391 > >> > --- /dev/null > >> > +++ b/net/vmnet-bridged.m > >> > @@ -0,0 +1,25 @@ > >> > +/* > >> > + * vmnet-bridged.m > >> > + * > >> > + * Copyright(c) 2021 Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > + * > >> > + * This work is licensed under the terms of the GNU GPL, version 2 > or later. > >> > + * See the COPYING file in the top-level directory. > >> > + * > >> > + */ > >> > + > >> > +#include "qemu/osdep.h" > >> > +#include "qapi/qapi-types-net.h" > >> > +#include "vmnet_int.h" > >> > +#include "clients.h" > >> > +#include "qemu/error-report.h" > >> > +#include "qapi/error.h" > >> > + > >> > +#include <vmnet/vmnet.h> > >> > + > >> > +int net_init_vmnet_bridged(const Netdev *netdev, const char *name, > >> > + NetClientState *peer, Error **errp) > >> > +{ > >> > + error_setg(errp, "vmnet-bridged is not implemented yet"); > >> > + return -1; > >> > +} > >> > diff --git a/net/vmnet-common.m b/net/vmnet-common.m > >> > new file mode 100644 > >> > index 0000000000..532d152840 > >> > --- /dev/null > >> > +++ b/net/vmnet-common.m > >> > @@ -0,0 +1,20 @@ > >> > +/* > >> > + * vmnet-common.m - network client wrapper for Apple vmnet.framework > >> > + * > >> > + * Copyright(c) 2021 Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > + * Copyright(c) 2021 Phillip Tennen <phil...@axleos.com> > >> > + * > >> > + * This work is licensed under the terms of the GNU GPL, version 2 > or later. > >> > + * See the COPYING file in the top-level directory. > >> > + * > >> > + */ > >> > + > >> > +#include "qemu/osdep.h" > >> > +#include "qapi/qapi-types-net.h" > >> > +#include "vmnet_int.h" > >> > +#include "clients.h" > >> > +#include "qemu/error-report.h" > >> > +#include "qapi/error.h" > >> > + > >> > +#include <vmnet/vmnet.h> > >> > + > >> > diff --git a/net/vmnet-host.c b/net/vmnet-host.c > >> > new file mode 100644 > >> > index 0000000000..4a5ef99dc7 > >> > --- /dev/null > >> > +++ b/net/vmnet-host.c > >> > @@ -0,0 +1,24 @@ > >> > +/* > >> > + * vmnet-host.c > >> > + * > >> > + * Copyright(c) 2021 Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > + * > >> > + * This work is licensed under the terms of the GNU GPL, version 2 > or later. > >> > + * See the COPYING file in the top-level directory. > >> > + * > >> > + */ > >> > + > >> > +#include "qemu/osdep.h" > >> > +#include "qapi/qapi-types-net.h" > >> > +#include "vmnet_int.h" > >> > +#include "clients.h" > >> > +#include "qemu/error-report.h" > >> > +#include "qapi/error.h" > >> > + > >> > +#include <vmnet/vmnet.h> > >> > + > >> > +int net_init_vmnet_host(const Netdev *netdev, const char *name, > >> > + NetClientState *peer, Error **errp) { > >> > + error_setg(errp, "vmnet-host is not implemented yet"); > >> > + return -1; > >> > +} > >> > diff --git a/net/vmnet-shared.c b/net/vmnet-shared.c > >> > new file mode 100644 > >> > index 0000000000..f8c4a4f3b8 > >> > --- /dev/null > >> > +++ b/net/vmnet-shared.c > >> > @@ -0,0 +1,25 @@ > >> > +/* > >> > + * vmnet-shared.c > >> > + * > >> > + * Copyright(c) 2021 Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > + * > >> > + * This work is licensed under the terms of the GNU GPL, version 2 > or later. > >> > + * See the COPYING file in the top-level directory. > >> > + * > >> > + */ > >> > + > >> > +#include "qemu/osdep.h" > >> > +#include "qapi/qapi-types-net.h" > >> > +#include "vmnet_int.h" > >> > +#include "clients.h" > >> > +#include "qemu/error-report.h" > >> > +#include "qapi/error.h" > >> > + > >> > +#include <vmnet/vmnet.h> > >> > + > >> > +int net_init_vmnet_shared(const Netdev *netdev, const char *name, > >> > + NetClientState *peer, Error **errp) > >> > +{ > >> > + error_setg(errp, "vmnet-shared is not implemented yet"); > >> > + return -1; > >> > +} > >> > diff --git a/net/vmnet_int.h b/net/vmnet_int.h > >> > new file mode 100644 > >> > index 0000000000..c5982259a4 > >> > --- /dev/null > >> > +++ b/net/vmnet_int.h > >> > @@ -0,0 +1,25 @@ > >> > +/* > >> > + * vmnet_int.h > >> > + * > >> > + * Copyright(c) 2021 Vladislav Yaroshchuk <yaroshchuk2...@gmail.com> > >> > + * > >> > + * This work is licensed under the terms of the GNU GPL, version 2 > or later. > >> > + * See the COPYING file in the top-level directory. > >> > + * > >> > + */ > >> > +#ifndef VMNET_INT_H > >> > +#define VMNET_INT_H > >> > + > >> > +#include "qemu/osdep.h" > >> > +#include "vmnet_int.h" > >> > +#include "clients.h" > >> > + > >> > +#include <vmnet/vmnet.h> > >> > + > >> > +typedef struct VmnetCommonState { > >> > + NetClientState nc; > >> > + > >> > +} VmnetCommonState; > >> > + > >> > + > >> > +#endif /* VMNET_INT_H */ > >> > diff --git a/qapi/net.json b/qapi/net.json > >> > index 7fab2e7cd8..b922e2e34f 100644 > >> > --- a/qapi/net.json > >> > +++ b/qapi/net.json > >> > @@ -452,6 +452,120 @@ > >> > '*vhostdev': 'str', > >> > '*queues': 'int' } } > >> > > >> > +## > >> > +# @NetdevVmnetHostOptions: > >> > +# > >> > +# vmnet (host mode) network backend. > >> > +# > >> > +# Allows the vmnet interface to communicate with other vmnet > >> > +# interfaces that are in host mode and also with the host. > >> > +# > >> > +# @start-address: The starting IPv4 address to use for the interface. > >> > +# Must be in the private IP range (RFC 1918). Must be > >> > +# specified along with @end-address and @subnet-mask. > >> > +# This address is used as the gateway address. The > >> > +# subsequent address up to and including end-address > are > >> > +# placed in the DHCP pool. > >> > +# > >> > +# @end-address: The DHCP IPv4 range end address to use for the > >> > +# interface. Must be in the private IP range (RFC > 1918). > >> > +# Must be specified along with @start-address and > >> > +# @subnet-mask. > >> > +# > >> > +# @subnet-mask: The IPv4 subnet mask to use on the interface. Must > >> > +# be specified along with @start-address and > @subnet-mask. > >> > +# > >> > +# @isolated: Enable isolation for this interface. Interface isolation > >> > +# ensures that vmnet interface is not able to communicate > >> > +# with any other vmnet interfaces. Only communication with > >> > +# host is allowed. Available since macOS Big Sur 11.0. > >> > +# > >> > +# @net-uuid: The identifier (UUID) to uniquely identify the isolated > >> > +# network vmnet interface should be added to. If > >> > +# set, no DHCP service is provided for this interface and > >> > +# network communication is allowed only with other > interfaces > >> > +# added to this network identified by the UUID. Available > >> > +# since macOS Big Sur 11.0. > >> > +# > >> > +# Since: 7.0 > >> > +## > >> > +{ 'struct': 'NetdevVmnetHostOptions', > >> > + 'data': { > >> > + '*start-address': 'str', > >> > + '*end-address': 'str', > >> > + '*subnet-mask': 'str', > >> > + '*isolated': 'bool', > >> > + '*net-uuid': 'str' }, > >> > + 'if': 'CONFIG_VMNET' } > >> > + > >> > +## > >> > +# @NetdevVmnetSharedOptions: > >> > +# > >> > +# vmnet (shared mode) network backend. > >> > +# > >> > +# Allows traffic originating from the vmnet interface to reach the > >> > +# Internet through a network address translator (NAT). > >> > +# The vmnet interface can communicate with the host and with > >> > +# other shared mode interfaces on the same subnet. If no DHCP > >> > +# settings, subnet mask and IPv6 prefix specified, the interface can > >> > +# communicate with any of other interfaces in shared mode. > >> > +# > >> > +# @start-address: The starting IPv4 address to use for the interface. > >> > +# Must be in the private IP range (RFC 1918). Must be > >> > +# specified along with @end-address and @subnet-mask. > >> > +# This address is used as the gateway address. The > >> > +# subsequent address up to and including end-address > are > >> > +# placed in the DHCP pool. > >> > +# > >> > +# @end-address: The DHCP IPv4 range end address to use for the > >> > +# interface. Must be in the private IP range (RFC > 1918). > >> > +# Must be specified along with @start-address and > @subnet-mask. > >> > +# > >> > +# @subnet-mask: The IPv4 subnet mask to use on the interface. Must > >> > +# be specified along with @start-address and > @subnet-mask. > >> > +# > >> > +# @isolated: Enable isolation for this interface. Interface isolation > >> > +# ensures that vmnet interface is not able to communicate > >> > +# with any other vmnet interfaces. Only communication with > >> > +# host is allowed. Available since macOS Big Sur 11.0. > >> > +# > >> > +# @nat66-prefix: The IPv6 prefix to use into guest network. Must be a > >> > +# unique local address i.e. start with fd00::/8 and > have > >> > +# length of 64. > >> > +# > >> > +# Since: 7.0 > >> > +## > >> > +{ 'struct': 'NetdevVmnetSharedOptions', > >> > + 'data': { > >> > + '*start-address': 'str', > >> > + '*end-address': 'str', > >> > + '*subnet-mask': 'str', > >> > + '*isolated': 'bool', > >> > + '*nat66-prefix': 'str' }, > >> > + 'if': 'CONFIG_VMNET' } > >> > + > >> > +## > >> > +# @NetdevVmnetBridgedOptions: > >> > +# > >> > +# vmnet (bridged mode) network backend. > >> > +# > >> > +# Bridges the vmnet interface with a physical network interface. > >> > +# > >> > +# @ifname: The name of the physical interface to be bridged. > >> > +# > >> > +# @isolated: Enable isolation for this interface. Interface isolation > >> > +# ensures that vmnet interface is not able to communicate > >> > +# with any other vmnet interfaces. Only communication with > >> > +# host is allowed. Available since macOS Big Sur 11.0. > >> > +# > >> > +# Since: 7.0 > >> > +## > >> > +{ 'struct': 'NetdevVmnetBridgedOptions', > >> > + 'data': { > >> > + 'ifname': 'str', > >> > + '*isolated': 'bool' }, > >> > + 'if': 'CONFIG_VMNET' } > >> > + > >> > ## > >> > # @NetClientDriver: > >> > # > >> > @@ -460,10 +574,16 @@ > >> > # Since: 2.7 > >> > # > >> > # @vhost-vdpa since 5.1 > >> > +# @vmnet-host since 7.0 > >> > +# @vmnet-shared since 7.0 > >> > +# @vmnet-bridged since 7.0 > >> > ## > >> > { 'enum': 'NetClientDriver', > >> > 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', > >> > - 'bridge', 'hubport', 'netmap', 'vhost-user', > 'vhost-vdpa' ] } > >> > + 'bridge', 'hubport', 'netmap', 'vhost-user', > 'vhost-vdpa', > >> > + { 'name': 'vmnet-host', 'if': 'CONFIG_VMNET' }, > >> > + { 'name': 'vmnet-shared', 'if': 'CONFIG_VMNET' }, > >> > + { 'name': 'vmnet-bridged', 'if': 'CONFIG_VMNET' }] } > >> > > >> > ## > >> > # @Netdev: > >> > @@ -477,6 +597,9 @@ > >> > # Since: 1.2 > >> > # > >> > # 'l2tpv3' - since 2.1 > >> > +# 'vmnet-host' - since 7.0 > >> > +# 'vmnet-shared' - since 7.0 > >> > +# 'vmnet-bridged' - since 7.0 > >> > ## > >> > { 'union': 'Netdev', > >> > 'base': { 'id': 'str', 'type': 'NetClientDriver' }, > >> > @@ -492,7 +615,13 @@ > >> > 'hubport': 'NetdevHubPortOptions', > >> > 'netmap': 'NetdevNetmapOptions', > >> > 'vhost-user': 'NetdevVhostUserOptions', > >> > - 'vhost-vdpa': 'NetdevVhostVDPAOptions' } } > >> > + 'vhost-vdpa': 'NetdevVhostVDPAOptions', > >> > + 'vmnet-host': { 'type': 'NetdevVmnetHostOptions', > >> > + 'if': 'CONFIG_VMNET' }, > >> > + 'vmnet-shared': { 'type': 'NetdevVmnetSharedOptions', > >> > + 'if': 'CONFIG_VMNET' }, > >> > + 'vmnet-bridged': { 'type': 'NetdevVmnetBridgedOptions', > >> > + 'if': 'CONFIG_VMNET' } } } > >> > > >> > ## > >> > # @RxState: > >> > -- > >> > 2.23.0 > >> > > > > > > > > > -- > > Best Regards, > > > > Vladislav Yaroshchuk > -- Best Regards, Vladislav Yaroshchuk