• Apollon Oikonomopoulos's avatar
    KVM: Add auxiliary functions to handle tap devices · 199b2053
    Apollon Oikonomopoulos authored
    
    
    Add two new functions, _OpenTap and _ProbeTapVnetHdr, to
    hypervisors.hv_kvm.
    
    _ProbeTapVnetHdr checks if the host kernel supports the virtio net header
    (IFF_VNET_HDR) feature. This feature allows KVM to ask the the host kernel to
    perform checksumming and segmentation offload of the data passing through a
    guest's virtio NIC, using a special header[1] prepended to data sent through
    the tap interface. A qemu-kvm version later than 0.12 is required for this
    feature to work.
    
    _OpenTap opens a new tap device suitable for use with qemu-kvm's "-net
    tap,fd=n" option. It also enables vnet_hdr support if requested and safe to do
    so.
    
    [1] struct virtio_net_hdr in include/linux/virtio_net.h
    Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
    Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
    199b2053
hv_kvm.py 41.9 KB