Virtio drivers (virtio-net)

Tim Bisson bissont at
Sun Jan 23 02:59:36 PST 2011

Hi All,

There's been some activity in the FreeBSD mailing lists about the virtio 
drivers. A couple of people presented their drivers:

We took a look at these drivers and found that the first link seemed to 
be a really clean implementation of the virtio infrastructure and 
virtio-net driver. We decided to stop the porting effort of the 
NetBSD-based virtio drivers and instead use the FreeBSD ones. We 
successfully ported the FreeBSD virtio infrastructure and virtio-net 
driver, which now works and is ready for more testers.

In order to port this driver, we had to make some changes to the kernel: 
essentially add kern/subr_sglist.c from FreeBSD and make a probe 
interface public. The patch file is in the top-level directory of the 
git tree and was diff'd from master this morning. The file name is:

Regarding the original virtio-blk driver we ported from NetBSD. I will 
probably port this to the new virtio-infrastructure, unless the FreeBSD 
virtio-blk driver is posted on the FreeBSD mailing list in the near future.

Here's a link to the code:
and some notes:
Regarding performance, I don't have a good explanation yet, but 
emulation with the re driver is actually faster than virtio on a simle 
scp test:

re driver
$ time scp .
200m                       100%  200MB  15.4MB/s   00:13
virtio driver
$ time scp .
200m                       100%  200MB  11.8MB/s   00:17
ifconfig from dbsd vm for above test
$ ifconfig
    inet6 fe80::5054:ff:fe03:9900%re0 prefixlen 64 scopeid 0x1
    inet netmask 0xffffff00 broadcast
    ether 52:54:00:03:99:00
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
faith0: flags=8002<BROADCAST,MULTICAST> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
    inet6 fe80::5054:ff:fe33:3bd3%vtnet0 prefixlen 64 scopeid 0x6
    inet netmask 0xffffff00 broadcast
    ether 52:54:00:33:3b:d3
Comments and suggestions are always welcome.

More information about the Kernel mailing list