On Oct 22, 2009, at 19:43, ext Mark McLoughlin wrote: > Hey, > Over a year ago we added some code to qemu-kvm.git which takes > advantage of the recent tun/tap IFF_VNET_HDR feature in order to allow > virtio-net to send and receive packets with partial checksums and > segmentation offloaded: > > http://article.gmane.org/gmane.comp.emulators.kvm.devel/20440 > > "This allows us to pass larger packets and packets with > partial checkums between the guest and the host, greatly > increasing the achievable bandwidth." > > Unfortunately, that implementation was quite hacky as it > made some assumptions that would break if e.g. you added another > network client to a vlan where the feature had enabled. > > Now that we have the -netdev parameter, we can more safely > pair the NIC and backend, allowing us to negatiate features like > this. > > What follows is a somewhat cleaned up version of the code > from qemu-kvm.git. Further cleanups are probably possible, but I > think this much is mergeable. Some points of discussion:
I think this patch set has broken the QEMU build on OS X. The reason is that there are some definitions in tap-linux.h which only gets included in net.c if __linux__ is defined but the other parts of net.c which utilize definitions from tap-linux.h get compiled in nevertheless. It compiles if all definitions (except for the extra includes) from tap-linux.h are included for OS X as well. I've attached below a sample of the compiler output. Regards, Juha --- [...] CC net.o net.c: In function ‘tap_receive_iov’: net.c:1391: error: variable ‘hdr’ has initializer but incomplete type net.c:1391: warning: excess elements in struct initializer net.c:1391: warning: (near initialization for ‘hdr’) net.c:1391: error: storage size of ‘hdr’ isn’t known net.c:1391: warning: unused variable ‘hdr’ net.c: In function ‘tap_receive_raw’: net.c:1409: error: variable ‘hdr’ has initializer but incomplete type net.c:1409: warning: excess elements in struct initializer net.c:1409: warning: (near initialization for ‘hdr’) net.c:1409: error: storage size of ‘hdr’ isn’t known net.c:1409: warning: unused variable ‘hdr’ net.c: In function ‘tap_send’: net.c:1484: error: invalid application of ‘sizeof’ to incomplete type ‘struct virtio_net_hdr’ net.c:1485: error: invalid application of ‘sizeof’ to incomplete type ‘struct virtio_net_hdr’ net.c: In function ‘tap_set_sndbuf’: net.c:1511: error: ‘TUNSETSNDBUF’ undeclared (first use in this function) net.c:1511: error: (Each undeclared identifier is reported only once net.c:1511: error: for each function it appears in.) net.c: In function ‘tap_probe_vnet_hdr’: net.c:1552: error: ‘TUNGETIFF’ undeclared (first use in this function) net.c:1557: error: ‘IFF_VNET_HDR’ undeclared (first use in this function) net.c: In function ‘tap_set_offload’: net.c:1567: error: ‘TUN_F_CSUM’ undeclared (first use in this function) net.c:1569: error: ‘TUN_F_TSO4’ undeclared (first use in this function) net.c:1571: error: ‘TUN_F_TSO6’ undeclared (first use in this function) net.c:1573: error: ‘TUN_F_TSO_ECN’ undeclared (first use in this function) net.c:1575: error: ‘TUN_F_UFO’ undeclared (first use in this function) net.c:1578: error: ‘TUNSETOFFLOAD’ undeclared (first use in this function) net.c: In function ‘net_tap_fd_init’: net.c:1623: error: ‘TUN_F_CSUM’ undeclared (first use in this function) net.c:1623: error: ‘TUN_F_UFO’ undeclared (first use in this function) net.c:1624: error: ‘TUNSETOFFLOAD’ undeclared (first use in this function) make[1]: *** [net.o] Error 1 make: *** [build-all] Error 2