On 2019/8/24 上午5:31, Haotian Wang wrote: > This endpoint function enables the PCI endpoint to establish a virtual > ethernet link with the PCI host. The main features are: > > - Zero modification of PCI host kernel. The only requirement for the > PCI host is to enable virtio, virtio_pci, virtio_pci_legacy and > virito_net. > > - The virtual ethernet link is stable enough to support ordinary > capabilities of the Linux network stack. User space programs such as > ping, ssh, iperf and scp can run on the link without additional > hassle. > > - This function fits in the PCI endpoint framework > (drivers/pci/endpoint/) and makes API calls provided by virtio_net > (drivers/net/virtio_net.c). It does not depend on > architecture-specific or hardware-specific features. > > This function driver is tested on the following pair of systems. The PCI > endpoint is a Xilinx VCU118 board programmed with a SiFive Linux-capable > core running Linux 5.2. The PCI host is an x86_64 Intel(R) Core(TM) > i3-6100 running unmodified Linux 5.2. The virtual link achieved a > stable throughput of ~180KB/s during scp sessions of a 50M file. The > PCI host could setup ip-forwarding and NAT to enable the PCI endpoint to > have Internet access. Documentation for using this function driver is at > Documentation/PCI/endpoint/pci-epf-virtio-howto.rst. > > Reference Docs, > - Documentation/PCI/endpoint/pci-endpoint.rst. Initialization and > removal of endpoint function device and driver. > - Documentation/PCI/endpoint/pci-endpoint-cfs.rst. Use configfs to > control bind, linkup and unbind behavior. > - https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1- > csprd01.html, drivers/virtio/ and drivers/net/virtio_net.c. Algorithms > and data structures used by the virtio framework. Interesting work, several questions: - Is there a doc for this endpoint device? - You refer virtio specification in the above, does it mean your device is fully compatible with virtio (or only datapath is compatible?) - What's the reason for introducing kthreads for some kinds of translation or copying of descriptor? - Is it possible to reuse e.g vringh (by introducing new accesor) and virtio core codes? Btw, I'm going to post mdev transport for virtio (with a sample of vringh loopback device). Technically, this can go through mdev bus as well. Thanks