Opened 6 years ago

Closed 10 months 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:
Has a Patch: no Platform: All

Description

A Virtio driver for the device type network is missing

Change History (9)

comment:1 Changed 6 years ago by korli

Type: bugenhancement

comment:2 Changed 5 years ago by kallisti5

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 Changed 4 years ago by mmlr

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 Changed 21 months ago by waddlesplash

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 Changed 20 months ago by phoudoin

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 Changed 18 months ago by waddlesplash

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 Changed 18 months ago by phoudoin

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 Changed 18 months ago by waddlesplash

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 Changed 10 months ago by phoudoin

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.