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

Message ID 20240207054701.616094-6-lulu@redhat.com
State New
Headers
Series vduse: Add support for reconnection |

Commit Message

Cindy Lu Feb. 7, 2024, 5:43 a.m. UTC
  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@redhat.com>
---
 Documentation/userspace-api/vduse.rst | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
  

Comments

Jason Wang March 4, 2024, 5:11 a.m. UTC | #1
On Wed, Feb 7, 2024 at 1:47 PM Cindy Lu <lulu@redhat.com> wrote:
>
> 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@redhat.com>
> ---
>  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

Typos, let's use a spell checker.

> +----------------
> +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

Need to describe what kind of pages need to be mapped. And what's more:

Does this require cooperation from the disconnected application? If
yes, how to distinguish from the one that is not cooperative (doesn't
support reconnection)?

> +   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

Typos again.

> +   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...

"..." is not good, let's describe the steps in detail.

> +   to get the and confirm if these information are suitable for reconnecting.
> +
> +5. Start the userspace App.

I had a hard time understanding this, does it mean the application
needs to restart itself?

> +   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

Abbrev is not good here. Let's use "application" for consistency.

> to get vq information, it is necessary
> +   to check if this is a reconnection.

How to check whether or not it is reconnected?

> 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
>

Thanks
  

Patch

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.