net/vmnet: implement bridged mode (vmnet-bridged)
Hi:
I develop a custom os use qemu and use macos as host, I use the net argument '-net nic,model=pcnet -net tap,ifname=tap0,script=no,downscript=no’ when run the qemu-system-i386,then I can get the network device in my custom os:
pci_device_dump: vendor id: 0x1022
pci_device_dump: device id: 0x2000
pci_device_dump: class code: 0x20000
pci_device_dump: revision id: 0x10
pci_device_dump: multi function: 0
pci_device_dump: card bus CIS pointer: 0
pci_device_dump: subsystem vendor id: 0
pci_device_dump: subsystem device id: 0
pci_device_dump: expansion ROM base address: feb80000
pci_device_dump: capability list pointer: 0
pci_device_dump: irq line: 11
pci_device_dump: irq pin: 1
pci_device_dump: min Gnt: 6
pci_device_dump: max Lat: 255
pci_device_dump: bar 0:
pci_device_bar_dump: type: io base address
pci_device_bar_dump: base address: c000
pci_device_bar_dump: len: 20
pci_device_dump: bar 1:
pci_device_bar_dump: type: mem base address
pci_device_bar_dump: base address: febd1000
pci_device_bar_dump: len: 20
I can send a message to the host from my custom os in qemu, but can’t receive a message from the host.
so I rebuild the qemu use this patch, then I use the argument '-netdev vmnet-bridged,id=vmnet,ifname=en0’ run the qemu-system-i386 again, this time, I can’t get the network device either, I don’t know why, how to use vmnet-bridged to send message to host from my custom os and receive a message from the host, what should I do? thanks a lot!
вс, 23 янв. 2022 г. в 07:51, 李士林 <[email protected]>:
Quoted 7 lines
Hi:
I develop a custom os use qemu and use macos as host, I use the net
argument '-net nic,model=pcnet -net tap,ifname=tap0,script=no,downscript=no’ when run the qemu-system-i386,then I can get the network device in my custom os:
Please notice that -net is a legacy option
https://wiki.qemu.org/Documentation/Networking#The_legacy_-net_option
Quoted 23 lines
pci_device_dump: vendor id: 0x1022 pci_device_dump: device id: 0x2000 pci_device_dump: class code: 0x20000 pci_device_dump: revision id: 0x10
pci_device_dump: multi function: 0
pci_device_dump: card bus CIS pointer: 0
pci_device_dump: subsystem vendor id: 0
pci_device_dump: subsystem device id: 0
pci_device_dump: expansion ROM base address:feb80000
pci_device_dump: capability list pointer: 0
pci_device_dump: irq line: 11
pci_device_dump: irq pin: 1
pci_device_dump: min Gnt: 6
pci_device_dump: max Lat: 255
pci_device_dump: bar 0:
pci_device_bar_dump: type: io base address
pci_device_bar_dump: base address: c000
pci_device_bar_dump: len: 20
pci_device_dump: bar 1:
pci_device_bar_dump: type: mem base address
pci_device_bar_dump: base address:febd1000
pci_device_bar_dump: len: 20
Quoted 4 lines
I can send a message to the host from my custom os in qemu, but can’t receive a message from the host.
This is known issue:
https://gitlab.com/qemu-project/qemu/-/issues/335
Quoted 5 lines
so I rebuild the qemu use this patch, then I use the argument '-netdev vmnet-bridged,id=vmnet,ifname=en0’ run the qemu-system-i386 again, this time, I can’t get the network device either, I don’t know why, how to use vmnet-bridged to send message to host from my custom os and receive a message from the host, what should I do? thanks a lot!
It's normal behavior since you've specified a
network backend only. See the corresponding
QEMU documentation section:
https://wiki.qemu.org/Documentation/Networking#Network_Backends
Currently you have:-netdev vmnet-bridged,id=vmnet,ifname=en0
You need add a device:
-netdev vmnet-bridged,id=vmnet,ifname=en0 -device pcnet,netdev=vmnet
Supported devices can be listed with -device help:qemu-system-xxx -device help
--
Best Regards,
Vladislav Yaroshchuk