[PATCH v2 5/5] Documentation: Add reconnect process for VDUSE

From: Cindy Lu
Date: Tue Nov 21 2023 - 02:31:50 EST


Add the document to explained how the reconnect process
include how the Userspace App need to do and how it works
with kernel

Signed-off-by: Cindy Lu <lulu@xxxxxxxxxx>
---
Documentation/userspace-api/vduse.rst | 29 +++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/Documentation/userspace-api/vduse.rst b/Documentation/userspace-api/vduse.rst
index bdb880e01132..6e01c21d94df 100644
--- a/Documentation/userspace-api/vduse.rst
+++ b/Documentation/userspace-api/vduse.rst
@@ -231,3 +231,32 @@ able to start the dataplane processing as follows:
after the used ring is filled.

For more details on the uAPI, please see include/uapi/linux/vduse.h.
+
+HOW VDUSE devices reconnectoin works
+----------------
+0. Userspace APP checks if the device /dev/vduse/vduse_name exists, if not create
+ the device. If yes means this is reconnect, goto 3
+
+1. Create a new VDUSE instance with ioctl(VDUSE_CREATE_DEV) on
+ /dev/vduse/control.
+
+2. In ioctl(VDUSE_CREATE_DEV), the kernel alloc the memory to sync the reconnect
+ information.
+
+3. Userspace App will mmap the pages to userspace
+
+ If this first time to connect, userspace App need save the reconnect
+ information (struct vhost_reconnect_data) in mapped pages
+
+ If this is reconnect, userspace App need to check if the saved information
+ OK to reconnect, Also userspace App MUST set the bit reconnected in
+ struct vhost_reconnect_data to 1. (kernel will use this bit to identify if the
+ userAPP is reconnected )
+
+4. Successfully start the userspace App.
+ userspace APP need to call ioctl VDUSE_VQ_GET_INFO to sync the vq information. also
+ APP need to save the reconnect information (struct vhost_reconnect_vring)
+ while running
+
+5. When the Userspace App exit, Userspace App need to unmap all the reconnect
+ pages
--
2.34.3