Opened 11 years ago

Closed 6 years ago

#9800 closed enhancement (fixed)

Virtio network driver

Reported by: korli Owned by: phoudoin
Priority: normal Milestone: R1
Component: Drivers/Network Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

A Virtio driver for the device type network is missing

Change History (9)

comment:1 by korli, 11 years ago

Type: bugenhancement

comment:2 by kallisti5, 10 years ago

This would be really nice. I have a OpenStack farm that uses virtio network devices.. if we had a virtio driver, we could do cloud Haiku instances :-). Haiku vm's in OpenStack run great with the virtio disk driver.

PCI: [dom 0, bus  0] bus   0, device  3, function  0: vendor 1af4, device 1000, revision 00
PCI:   class_base 02, class_function 00, class_api 00
PCI:   vendor 1af4: Red Hat, Inc
PCI:   device 1000: Virtio network device
PCI:   info: Network controller (Ethernet controller)
PCI:   line_size 00, latency 00, header_type 00, BIST 00
PCI:   ROM base host f2030000, pci f2030000, size 00010000
PCI:   cardbus_CIS 00000000, subsystem_id 0001, subsystem_vendor_id 1af4
PCI:   interrupt_line 0b, interrupt_pin 01, min_grant 00, max_latency 00
PCI:   base reg 0: host 0000c040, pci 0000c040, size 00000020, flags 01
PCI:   base reg 1: host f2020000, pci f2020000, size 00001000, flags 00
PCI:   base reg 2: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 3: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 4: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 5: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   Capabilities: MSI-X

comment:3 by mmlr, 9 years ago

Regarding networking with OpenStack there is an easy way to get around the need for virtio_net until it is available:

Depending on the hypervisor, the emulated network card can be changed with the hw_vif_model property on the bootable image. It can be set when uploading the initial image with glance using --property hw_vif_model=e1000. VMs booted from that image (or from volumes created with the image as a source) inherit the property and the hypervisor will then emulate the following device:

PCI: [dom 0, bus  0] bus   0, device  3, function  0: vendor 8086, device 100e, revision 03
PCI:   class_base 02, class_function 00, class_api 00
PCI:   vendor 8086: Intel Corporation
PCI:   device 100e: 82540EM Gigabit Ethernet Controller (QEMU Virtual Machine)
PCI:   info: Network controller (Ethernet controller)
PCI:   line_size 00, latency 00, header_type 00, BIST 00
PCI:   ROM base host feb80000, pci feb80000, size 00040000
PCI:   cardbus_CIS 00000000, subsystem_id 1100, subsystem_vendor_id 1af4
PCI:   interrupt_line 0b, interrupt_pin 01, min_grant 00, max_latency 00
PCI:   base reg 0: host febc0000, pci febc0000, size 00020000, flags 00
PCI:   base reg 1: host 0000c000, pci 0000c000, size 00000040, flags 01
PCI:   base reg 2: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 3: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 4: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   base reg 5: host 00000000, pci 00000000, size 00000000, flags 00
PCI:   Capabilities: (not supported)

This one is supported by the ipro1000 (lem) driver and allows Haiku to use networking within an otherwise stock OpenStack. I have only tested this with deployments that use KVM as the hypervisor, but the documentation for the property (http://docs.openstack.org/cli-reference/content/chapter_cli-glance-property.html) lists the e1000 value as valid for VMWare and Xen as well.

I've successfully used Haiku in a private OpenStack deployment (Icehouse and Juno releases) and a OpenStack based public cloud (CityCloud, Juno release).

comment:4 by waddlesplash, 7 years ago

Google Compute Engine now allows for custom VM image uploads, but the virtualized hardware requires are very specific, and virtio-net is the only supported network card (https://cloud.google.com/compute/docs/images/building-custom-os).

I've got a good chunk of Compute Engine credits (and am willing to spend more) to run package builders for HaikuPorts on, but without a working virtio-net driver, this isn't possible. (The existing donated boxes either (1) are too under-powered, or (2) have too slow a connection to baron.)

@korli, will you have time to work on the virtio-net driver in the near future? Is there some way I could sponsor your development of it?

comment:5 by phoudoin, 7 years ago

BTW, currently our virtio_pci bus controler don't support virtio 1.0 yet, only legacy virtio API. To detect a virtio pci device is v1 or legacy, simply check it's device ID. If it's > 0x103F, it's v1.

comment:6 by waddlesplash, 7 years ago

I added the virtio_net driver to the image and rebuilt haiku.hpkg, and upon install/reboot I confirmed that /system/add-ons/kernel/drivers/net/virtio_net: exists (and is not a symlink), but the driver isn't loaded and the following messages appear in my syslog:

KERN: module: Search for drivers/network/virtio_net/driver_v1 failed.
KERN: Last message repeated 23 times.

Anyone have a clue as to what's going on here?

comment:7 by phoudoin, 7 years ago

It's not using legacy driver API but the new device manager API. The driver should be put in system/add- ons/kernel/network/virtio_net

comment:8 by waddlesplash, 7 years ago

Owner: changed from nobody to phoudoin
Status: newassigned

Yep, I figured that out this morning, thanks to Diver. Works like a charm -- I did some testing of it, and then added it to the image in hrev51394.

Leaving this open so that you can close it and claim the bounty. :)

comment:9 by phoudoin, 6 years ago

Resolution: fixed
Status: assignedclosed

@korli improved largely virtio_net performance in hrev51905.

Guess it's time to close this ticket.

Note: See TracTickets for help on using tickets.