Ethtool Support for Microsoft Hyper-V

Ethtool Support for Microsoft Hyper-V is a programming project to implement support of the Linux command-line application "ethtool" on virtual machine guests of the Microsoft Hyper-V hypervisor. Ethtool is used to query and control network driver and hardware settings. Enabling support requires patching the virtual network driver in the Linux kernel.

Problem Statement
As an integral Linux utility, ethtool, written by David Miller, is maintained in parallel with the kernel. Ethtool is primarily used by system administrators to query (and set, when relevant) network driver variables such as link status, number of send and receive queues of vRSS, size of send and receive buffers, available features, and gathered statistics.

The network driver used by Linux virtual machines running on Microsoft Hyper-V minimally supports ethtool; it can return the name of the driver, "hv_netvsc," and the permanent address of the network device. Ethtool provides an interface in the Linux kernel for each network driver to support. It is our aim to implement support for all common uses of ethtool.

Background
A common scenario for system administrators is to host multiple virtual machines on the same piece of hardware, so one physical computer and its host operating system can support many guest computers, each with its own operating system. This process of "virtualization" is dependent on an abstraction layer called a "hypervisor." Microsoft's solution is a native hypervisor, Microsoft Hyper-V, included in most versions of Microsoft Windows. A native hypervisor runs directly on the host's hardware, in contrast to a hosted hypervisor which runs on the host's operating system, so the former has fewer layers of translation for guest operating system instructions.

Specifications
Since the guest operating systems are separate from the host operating system, a host machine running Windows with Hyper-V supports guests running Linux (as well as Windows). Linux supports being run as a guest operating system on a hypervisor through virtual drivers for the guest's virtual hardware, including video, storage, keyboard, mouse and networking. These drivers are a part of the Linux kernel, and are maintained by our client, the Microsoft Linux Integration Services team. We are concerned with the virtual network driver, netvsc.

Design
This project's design is relatively straightforward. Ethtool is a mature application, and its programming interface in the kernel is well-established. In general, adding support for each ethtool operation requires patching netvsc with the appropriate new callback for the operation and any additional necessary changes.

Goals
Our goal is to implement support for the following ethtool operations:


 * 1) Implement show-channels - Queries the network device for the numbers of channels it has. A channel is an IRQ and the set of queues that can trigger that IRQ.
 * 2) Implement set-channels - Changes the numbers of channels of the specified network device.
 * 3) Implement show-features - Queries the specified network device for the state of protocol offload and other features.
 * 4) Implement show-ring - Queries the specified network device for rx/tx ring parameter information.
 * 5) Implement set-ring - Changes the rx/tx ring parameters of the specified network device.
 * 6) Implement rx on|off - Specifies whether RX checksumming should be enabled.
 * 7) Implement tx on|off - Specifies whether TX checksumming should be enabled.
 * 8) Implement negotiate - Restarts auto-negotiation on the specified Ethernet device, if auto-negotiation is enabled.
 * 9) Implement statistics - Queries the specified network device for network interface card and driver specific statistics.

Implementation
So far we have implemented the "show-channels" operation. Our patch was signed-off by Haiyang Zhang, and applied to the net-next kernel tree by Dave Miller. The patch, commit 59995370dbc is now officially in the development version of the Linux kernel.

Our immediate next goal is to implement the "set-channels" operation.

Testing
Testing patches to a virtual network driver on a Linux machine is a tedious process. It requires direct access to a host machine running Windows with Hyper-V, and a Linux virtual machine for development and testing. When testing the network driver your machine is dependent on, if your patch causes the driver to break, direct access through the console is needed to debug, as network access will be disabled.

Additionally, developing Linux kernel patches requires configuring and installing the correct development version of the Linux kernel to the test machine. For networking drivers, we work off Dave Miller's "net-next" tree. Our team primarily develops on CentOS 7 virtual machines since installing a locally compiled kernel is made relatively easy with the kernel build system's creation of a native package.

Our usual workflow is to develop on a local clone of the kernel tree, and then push the patch to our test machine, where we can compile and install the patched netvsc module. When our patch breaks, we use the Remote Desktop Protocol to connect to the host Windows machine, to then use the Hyper-V manager's to connect to the Linux virtual machine without requiring the guest's networking to be operational. Further debugging is done through liberal use of "printk," the kernel's version of "printf" for printing out debug information.

Andrew Schwartzmeyer
Computer Science and Mathematics Student

Hometown: Seattle, WA

Bio: Andrew is a senior undergraduate student in Computer Science and Mathematics at the University of Idaho. He is the current chair of the University of Idaho Association of Computing Machinery, and an avid open source developer. He blogs at schwartzmeyer.com, and is interested in Linux systems programming, evolutionary computation, security and cryptography, server administration automation (with Puppet), and functional programming.

Email: [mailto:schw2620@vandals.uidaho.edu schw2620@vandals.uidaho.edu]



Justin Hall
Computer Science Student

Hometown: Lewiston, ID

Bio: Justin is a senior in Computer Science at the University of Idaho, currently pursuing his Bachelors of Science. He spends summers as a freelance front-end Javascript developer, particularly the AngularJS framework. His interests focus on front-end and full-stack web development.

Email: [mailto:hall5714@vandals.uidaho.edu hall5714@vandals.uidaho.edu]

Keith Drew
Computer Science Student

Hometown: Olympia, Washington

Bio: Keith is a senior undergraduate student in Computer Science at the University of Idaho. He is also a NSF Scholarship for Service (SFS) CyberCorps Student. He is interested cyber security, specifically secure programming.

Email: [mailto:keithd@vandals.uidaho.edu keithd@vandals.uidaho.edu]

Eric Doman
Computer Science Student

Hometown: St. Maries, Idaho

Bio: Eric is a senior undergraduate student in Computer Science at the University of Idaho. He is a member of the University of Idaho Association of Computing Machinery. He is interested in computer graphics and visualization. In his free time, Eric enjoys running and playing soccer.

Email: [mailto:doma8101@vandals.uidaho.edu doma8101@vandals.uidaho.edu]



Chris Waltrip (Fall 2014)
Computer Science Student

Hometown: Coeur d'Alene, ID

Bio: Chris is a senior undergraduate in Computer Science at the University of Idaho. He is also a NSF Scholarship for Service (SFS) CyberCorps Student and system administrator for the Center for Secure and Dependable Systems (CSDS). His interests lie in information assurance and network security.

Email: [mailto:walt2178@vandals.uidaho.edu walt2178@vandals.uidaho.edu]