Coder Social home page Coder Social logo

pmj / virtio-net-osx Goto Github PK

View Code? Open in Web Editor NEW
230.0 30.0 24.0 1.23 MB

Mac OS X driver for a (virtualised) "virtio" network device. Virtio network devices are supported by KVM and VirtualBox. Fastest virtual network device for VirtualBox OSX Guests, allows kernel debugging of guests via gdb.

Shell 0.04% C++ 95.33% C 4.63%

virtio-net-osx's Issues

scp crash

Hello,

The driver works with an ssh logins or a ping to the vm well so far. But if one tries to copy files over ssh, crashing the entire network. I think that always happens when some traffic on the "Network Card" is generated.

I get in dmesg unfortunately not really an error message.
That is from time to time there:

kernel (0): virtio-net addPacketToQueue (): Warning! head mbuf 66 does not math mtu-seg 326

but not always.

Regards ralix

Yosemite: Cable Unplugged

OS X Yosemite 10.10.4:

qemu -netdev bridge,id=br0,br=br0 \
      -device virtio-net-pci,netdev=br0,id=mac_vnet0 \
      -netdev user,smb=/,id=user0 \
      -device virtio-net-pci,netdev=user0,id=mac_vnet1 \
      [ ... ]

both interfaces show in "Network" as "Not Connected", "Cable Unplugged" and in ifconfig as UP,RUNNING but inactive. Safari of course reports "You Are Not Connected to the Internet".

obviously the driver is running since the interfaces are present, but I checked by kextstat | grep virtio.

the same setup works correctly (i.e. Internet access, SMB) with e1000-82545em. specifying a single bridge device also does not work. nor does the -net nic,model=virtio syntax.

Not working with OS X Mavericks Server

Using QEMU/KVM, OS X 10.9.5.

To test, attach two network adapters to the VM, one the default e1000, and the other a virtio adapter.

Server.app refuses to acknowledge that the virtio adapter is connected. When editing the network configuration through the application, it will show the DHCP-provided settings, but will show the network as "Not Connected".
screen shot 2015-03-17 at 11 18 48 pm

In this screenshot, "Ethernet 2" is the virtio, "Ethernet" is the e1000.

Here's what's logged in system.log while Server.app is network checking:

Mar 17 23:20:56 moonside kernel[0]: flow_divert_kctl_disconnect (0): disconnecting group 1
Mar 17 23:20:56 moonside.local configd[26]: network changed: v4(en1!:10.0.0.72, en0-:10.0.0.5) DNS! Proxy+ SMB+
Mar 17 23:20:56 moonside kernel[0]: flow_divert_kctl_disconnect (0): disconnecting group 1

ifconfig (en0 = e1000 / en1 = virtio):

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
    ether 52:54:0e:8e:cc:7e 
    inet6 fe80::5054:eff:fe8e:cc7e%en0 prefixlen 64 scopeid 0x4 
    inet 10.0.0.5 netmask 0xfffffe00 broadcast 10.0.1.255
    nd6 options=1<PERFORMNUD>
    media: autoselect (1000baseT <full-duplex>)
    status: active
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=23<RXCSUM,TXCSUM,TSO4>
    ether 52:54:0e:8e:cc:8e 
    inet6 fe80::5054:eff:fe8e:cc8e%en1 prefixlen 64 scopeid 0x5 
    inet 10.0.0.72 netmask 0xfffffe00 broadcast 10.0.1.255
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active

VNC/Screen Sharing error

When i enable the virtio driver in my qemu args VNC terminates after password authentication with the error "failed to recv data from socket" (windows TightVNC client). However with the default qemu e1000 driver all works fine.

Other connectivity seems fine from my brief tests with virtio, but VNC definitely seems to be effected.

I also see a number of the messages bellow in the Kernel log, which don't appear when using the e1000 driver:

2014-12-27 18:15:25 +0000 kernel[0]: virtio-net addPacketToQueue(): Warning! head mbuf 54 does not match mtu-seg 314

I'm on kernel 3.17.6-1-ARCH (Arch Linux) and qemu 2.1.2 currently, and running OSX 10.9.5 with virtio drivers 0.9.4

Thanks very much.

Not working with MacOs Sierra

Host system:

Ubuntu 16.04

Guest:
Macos sierra

I installed the virtio driver installer, but, the device it's not reconigzed, shows: Cable unplugged

Network Utilities does not show input/output packet count.

I use your driver with VirtualBox (thanks!) and noticed network status is not updated.
I made small modification and it seems working.
Though link speed is not accurate ( always 1G), but prettier than 0.

diff --git a/virtio-net/virtio_net.cpp b/virtio-net/virtio_net.cpp
index 3332930..eeeb8f4 100644
--- a/virtio-net/virtio_net.cpp
+++ b/virtio-net/virtio_net.cpp
@@ -608,7 +608,11 @@ bool PJVirtioNet::updateLinkStatus()
    IONetworkMedium* medium = dict ? IONetworkMedium::getMediumWithType(dict, kIOMediumEthernetAuto) : 0;
    if (!medium)
        VIOLog("virtio-net updateLinkStatus: Warning, no medium found!\n");
-   setLinkStatus((link_is_up ? kIONetworkLinkActive : 0) | kIONetworkLinkValid, medium);
+    if(link_is_up)
+        setLinkStatus(kIONetworkLinkValid | kIONetworkLinkActive,
+                      medium,1000000000ul);
+    else
+       setLinkStatus(kIONetworkLinkValid, 0);
    return link_is_up;
 }

@@ -941,7 +945,11 @@ void PJVirtioNet::detectLinkStatusFeature(uint16_t device_specific_offset)
            status, (status & VIRTIO_NET_S_LINK_UP) ? "up" : "down");
        link_is_up = (status & VIRTIO_NET_S_LINK_UP) != 0;
    }
-   setLinkStatus((link_is_up ? kIONetworkLinkActive : 0) | kIONetworkLinkValid);
+    if(link_is_up)
+        setLinkStatus(kIONetworkLinkValid | kIONetworkLinkActive,
+                      getCurrentMedium(),1000000000ul);
+    else
+       setLinkStatus(kIONetworkLinkValid, 0);
 }

 bool PJVirtioNet::beginHandlingInterrupts()
@@ -1026,6 +1034,12 @@ bool PJVirtioNet::configureInterface(IONetworkInterface *netif)
        VIOLog("virtio-net configureInterface(): super failed\n");
        return false;
    }
+   // Get the generic network statistics structure.
+   IONetworkData * data = netif->getParameter(kIONetworkStatsKey);
+   if (!data || !(netStats = (IONetworkStats *) data->getBuffer())) {
+       VIOLog("virtio-net configureInterface(): getParameter(kIONetworkStatsKey) failed."); 
+       return false;
+   }
    return true;
 }

@@ -2198,6 +2212,7 @@ void PJVirtioNet::releaseSentPackets(bool from_debugger)
            virtio_net_packet* next = cur->next_free;

            freePacket(cur->mbuf);
+            netStats->outputPackets++;
            if (cur->mem)
            {
                packet_bufdesc_pool->setObject(cur->mem);
@@ -2254,6 +2269,7 @@ void PJVirtioNet::releaseSentPackets(bool from_debugger)
                    continue;
                }
                freePacket(packet->mbuf);
+                netStats->outputPackets++;
            }
            else
            {
@@ -2408,7 +2424,7 @@ void PJVirtioNet::handleReceivedPackets()
    }
    if (packets_submitted > 0)
    {
-       interface->flushInputQueue();
+       netStats->inputPackets += interface->flushInputQueue();
        //IOLog("virtio-net handleReceivedPackets(): %u received\n", packets_submitted);
    }
 }
diff --git a/virtio-net/virtio_net.h b/virtio-net/virtio_net.h
index 9c545b8..03b1aa8 100644
--- a/virtio-net/virtio_net.h
+++ b/virtio-net/virtio_net.h
@@ -320,6 +320,8 @@ protected:

    /// Low bit is atomically toggled on if the configuration change bit was detected in the interrupt handler
    volatile UInt8 received_config_change __attribute__((aligned(32)));
+private:
+   IONetworkStats * netStats;
 };

 #endif

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.