aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/vhost_user.h
AgeCommit message (Collapse)AuthorFilesLines
2022-12-02vhost: convert vhost device driver to a pluginSteven Luong1-388/+0
convert vhost device driver to a plugin as described in https://jira.fd.io/browse/VPP-2065 Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ibfe2f351bcaed36a04b136d082ae414145dd37b5
2022-03-01virtio: refactor codeMohsin Kazmi1-8/+8
Type: refactor Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I3788cc857023fafcc8eb6d6ff4524425026a75d8
2021-08-26vhost: migrate to new TX infraSteven Luong1-6/+2
Take advantage of the new TX infra and support manual thread placement Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id8023846a2eb59125fcf2f80f4f11eb681cf14dc
2021-08-18vhost: interrupt mode support with mqSteven Luong1-0/+10
vhost interrupt mode support with mq does not work when coalesce frame is not configured to 0. When packed-ring is configured, we were also setting the wrong flag for want-interrupt. No need to trigger an interrupt to RX infra if there is at least one queue in the same thread that is doing polling. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I8e64250f2aa6bf611a777a53e4d2c1076d83305f
2021-01-27vhost: vhost interface hardware address not setSteven Luong1-0/+1
The check args->hwaddr is always true and it always copies the mac address from args->hwaddr even though none was set. Check args->use_custom_mac instead. Type: fix Fixes: gerrit 29970 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0c51bf1ea79b02c4fbdc3c52e694f186bdd96600
2021-01-21interface: rx queue infra rework, part oneDamjan Marion1-1/+1
Type: improvement Change-Id: I4008cadfd5141f921afbdc09a3ebcd1dcf88eb29 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-01-08vhost: Add event index for interrupt notification to driverSteven Luong1-8/+23
VPP only supports a poor man's approach for interrupt notification to the driver. It uses a simple binary flag for "interrupt needed" or "interrupt not needed". Most drivers support more sophisticated event index already. This feature is to add the long due missing feature and make it configurable, off by default. Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I68dab7dd07045cafb49af97b7f70db9b8131ae03
2020-12-25virtio: Extend vhost multi-queues support beyond 8 queue pairsSteven Luong1-3/+19
Current vhost multi-queues support has a hard limit of 8 queue pairs due to static vring array. This limit was raised in qemu. VPP should support more than 8 queue pairs also. Change static vring allocation to dynamic. When the interface is created, we allocate 8 queue pairs to begin with. We also keep track of how many queue pairs that the interface actually uses. We reply VHOST_USER_GET_QUEUE_NUM with 128 as our maximum number of support queue pair. When qemu starts initializing queue pair greater than 8, we expand the vrings as needed on demand. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I4a02d987d52d1bbe601b00e71f650fe6ebfcc0d7
2020-09-04virtio: remove kernel virtio header dependenciesMohsin Kazmi1-133/+12
Type: refactor tap, virtio and vhost use virtio/vhost header files from linux kernel. Different features are supported on different kernel versions, making it difficult to use those in VPP. This patch removes virtio/vhost based header dependencies to local header files. Change-Id: I064a8adb5cd9753c986b6f224bb075200b3856af Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-04-27virtio: support virtio 1.1 packed ring in vhostSteven Luong1-8/+55
virtio 1.1 defines a number of new features. Packed ring is among the most notable and important one. It combines used, available, and descripptor rings into one. This patch provides experimental support for packed ring. To avoid regression, when packed ring is configured for the interface, it is branched to a separate RX and TX driver. Non packed ring should continue to perform as it was before. Packed ring is tested using qemu4.2 and ubuntu focal fossa (kernel 5.4.0-12) on the guess VM which supports packed ring. To configure VPP with packed ring, just add the optional keyword "packed" when creating the vhost interface. To bring up the guest VM with packed ring, add "packed=on" in the qemu launch command. To facilitate troubleshooting, also added "verbose" option in show vhost desc CLI to include displaying the indirect descriptors. Known qemu reconnect issue - If VPP is restarted, guest VMs also need to be restarted. The problem is kernel virtio-net-pci keeps track of the previous available and used indices. For virtio 1.0, these indices are in shared memory and qemu can easily copy them to pass to the backend for reconnect. For virio 1.1, these indices are no longer in shared memory. Qemu needs a new mechanism to retrieve them and it is not currently implemented. So when the protocol reconnects, qemu does not have the correct available and used indices to pass to the backend. As a result, after the reconnect, virtio-net-pci is reading the TX ring from the wrong position in the ring, not the same position which the backend is writing. Similar problem exists also in the RX. Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I5afc50b0bafab5a1de7a6dd10f399db3fafd144c
2019-10-30docs: devices-- add FEATURES.yamlPaul Vinciguerra1-1/+1
Type: docs Change-Id: I039ba9ad5385452b202366fba0b367506a21ea4f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-07devices: vhost not reading packets from vringSteven Luong1-0/+3
In a rare event, after the vhost protocol message exchange has finished and the interface had been brought up successfully, the driver MAY still change its mind about the memory regions by sending new memory maps via SET_MEM_TABLE. Upon processing SET_MEM_TABLE, VPP invalidates the old memory regions and the descriptor tables. But it does not re-compute the new descriptor tables based on the new memory maps. Since VPP does not have the descriptor tables, it does not read the packets from the vring. In the normal working case, after SET_MEM_TABLE, the driver follows up with SET_VRING_ADDRESS which VPP computes the descriptor tables. The fix is to stash away the descriptor table addresses from SET_VRING_ADDRESS. Re-compute the new descriptor tables when processing SET_MEM_TABLE if descriptor table addresses are known. Type: fix Ticket: VPP-1784 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I3361f14c3a0372b8d07943eb6aa4b3a3f10708f9 (cherry picked from commit 61b8ba69f7a9540ed00576504528ce439f0286f5)
2019-07-31devices interface tests: vhosst GSO supportSteven Luong1-2/+33
Add gso option in create vhost interface to support gso and checksum offload. Tested with the following startup options in qemu: csum=on,gso=on,guest_csum=on,guest_tso4=on,guest_tso6=on,guest_ufo=on, host_tso4=on,host_tso6=on,host_ufo=on Type: feature Change-Id: I9ba1ee33677a694c4a0dfe66e745b098995902b8 Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-21vhost: VPP stalls with vhost performing control plane actionsSteven Luong1-3/+8
Symptom ------- With NDR traffic blasting at VPP, bringing up a new VM with vhost connection to VPP causes packet drops. I am able to recreate this problem easily using a simple setup like this. TREX-------------- switch ---- VPP |---------------| |-------| Cause ----- The reason for the packet drops is due to vhost holding onto the worker barrier lock for too long in vhost_user_socket_read(). There are quite a few of system calls inside the routine. At the end of the routine, it unconditionally calls vhost_user_update_iface_state() for all message types. vhost_user_update_iface_state() also unconditionally calls vhost_user_rx_thread_placement() and vhost_user_tx_thread_placement(). vhost_user_rx_thread_placement scraps out all existing cpu/queue mappings for the interface and creates brand new cpu/queue mappings for the interface. This process is very disruptive and very expensive. In my opinion, this area of code needs a makeover. Fixes ----- * vhost_user_socket_read() is rewritten that it should not hold onto the worker barrier lock for system calls, or at least minimize the need for doing it. * Remove the call to vhost_user_update_iface_state as a default route at the end of vhost_user_socket_read(). There is only a couple of message types which really need to call vhost_user_update_iface_state(). We put the call to those message types which need it. * Remove vhost_user_rx_thread_placement() and vhost_user_tx_thread_placement from vhost_user_update_iface_state(). There is no need to repetatively change the cpu/queue mappings. * vhost_user_rx_thread_placement() is actually quite expensive. It should be called only once per queue for the interface. There is no need to scrap the existing cpu/queue mappings and create new cpu/queue mappings when the additional queues becomes active/enable. * Change to create the cpu/queue mappings for the first RX when the interface is created. Dont remove the cpu/queue mapping when the interface is disconnected. Remove the cpu/queue mapping only when the interface is deleted. The create vhost user interface CLI also has some very expensive system calls if the command is entered with the optional keyword "server" As a bonus, This patch makes the create vhost user interface binary-api and CLI thread safe. Do the protection for the small amount of code which is thread unsafe. Change-Id: I4a19cbf7e9cc37ea01286169882e5603e6d7eb77 Signed-off-by: Steven Luong <sluong@cisco.com>
2018-10-02vhost-user: add support for vlib_log APIJerome Tollet1-16/+21
Change-Id: I0af68f6b41d0024aa64b93a8b18e2d179bf939b0 Signed-off-by: Jerome Tollet <jtollet@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-02vhost-user: Interface state updatesJuraj Sloboda1-1/+1
Fix inconsistencies between admin and link interface states Admin down should imply link down: link_up = admin_up && link_ready Change-Id: I4d668d82d035b5d2ae508727f34f1722a0c3e677 Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-07-08vhost: Add multi-versioning supportMohsin Kazmi1-0/+380
It also refactors the vhost code which was in one big file vhost-user.c. Receive side code is in vhost_user_input.c and Transmit side code is in vhost_user_output.c Change-Id: I1b539b5008685889723e228265786a2a3e9f3a78 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>