Xen network device mechanism-I/oring, xen network device-I
Note: This article describes the vif mechanism of the xen semi-virtualization Nic and its functions.
The Xen block device driver uses the xen io ring mechanism.
The role of xen hyprevisor is to provide a protective layer between the virtual machine and the IO Device. Therefore, the data transmission mechanism requires that data be moved between systems with a relatively small overhead. Two major data transmission mechanisms affect I/O data transmission. One is Resource Management and the other is data transmission. Xen uses two mechanisms to minimize overhead: IO descriptor ring and event channel, and authorization table mechanism.
For network devices, Xen provides virtual bridges to virtual machines. Each Domain has one or more virtual interfaces. VIFs logically connects to the virtual bridges, a vif looks like a physical network interface card NIC, but it has two buffer descriptor rings, one for receiving and the other for sending. Both directions have their own rule format. If yes, the corresponding action will be implemented (equivalent to the filtering function that the physical Nic may perform ).
Sending Process
In the virtual machine operating system, a buffer Descriptor (corresponding to the (vif driver) TX buffer? Buffer descriptor) is placed in the sending ring (the descriptor request is producer ). XEN copies this descriptor and ensures security. Then, it copies the header of the data packet and performs some filtering rules (requesting consumer ). (The payload of data packets is not complex because we use the shared memory mechanism)
This is equivalent to xen taking over the physical Nic, but at the same time, the memory buffer of this virtual machine and the physical Nic buffer are shared memory, thus reducing the overhead.
Receiving Process
When the package arrives from the virtual bridge, guest OS will use a useless page to exchange the incoming package, which avoids the overhead of copying the package between XEN and guest OS, although this requires receiving buffers of the guest OS to queue at the network interface. After receiving the packet, the XEN will quickly query the rules to determine the corresponding vif, and exchange the packet with the packet buffer of the page frame on the receiving ring.
"If no frame is available, the packet is dropped. "Therefore, packet loss is likely to occur during the receiving process. That is to say, if the receiving ring is full, packet loss occurs.
Note: This is similar to netmap and vale, but vale works on the bridge layer, while I/O rings work on the NIC AND NIC Driver layers (XEN ).
References:
Xen and the art of virtualization alization
P.s. Please try again later