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

From: Cindy Lu
Date: Wed Feb 07 2024 - 00:48:30 EST


Add a document explaining the reconnect process, including what the
Userspace App needs to do and how it works with the kernel.

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

diff --git a/Documentation/userspace-api/vduse.rst b/Documentation/userspace-api/vduse.rst
index bdb880e01132..a2be85e0e516 100644
--- a/Documentation/userspace-api/vduse.rst
+++ b/Documentation/userspace-api/vduse.rst
@@ -231,3 +231,35 @@ 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 it does not exist, need to create the instance.goto step 1
+ If it does exist, it means this is a reconnect and goto step 3.
+
+1. Create a new VDUSE instance with ioctl(VDUSE_CREATE_DEV) on
+ /dev/vduse/control.
+
+2. When the ioctl(VDUSE_CREATE_DEV) function is called, the kernel allocates memory
+ to save the reconnect information.
+
+3. Userspace App need to mmap the pages to userspace
+ Userspace App need to map Pages 0 to vq_number for vq status,
+ Users can define the structure for saving the reconnect information themselves
+ in the userspace.
+
+4. Check if the infomatin sutiable for reconnect
+ If this is reconnect:
+ Before attempting to reconnect, The userspace application need to the
+ ioctl VDUSE_DEV_GET_CONFIG,VDUSE_DEV_GET_STATUS,VDUSE_DEV_GET_FEATURES...
+ to get the and confirm if these information are suitable for reconnecting.
+
+5. Start the userspace App.
+ While running, the application should store the relevant information about
+ reconnections in mapped pages.
+ When calling ioctl VDUSE_VQ_GET_INFO from the userspace APP to get vq information, it is necessary
+ to check if this is a reconnection. If a reconnection has occurred, the vq-related information
+ must be get from the mapped pages.
+
+6. When the Userspace App exits, it is necessary to unmap all the reconnect pages.
--
2.43.0