Thread (49 messages) 49 messages, 4 authors, 2021-07-21

Re: [dpdk-dev] [PATCH v4 3/3] vhost: add thread unsafe async registeration functions

From: Xia, Chenbo <hidden>
Date: 2021-07-16 06:54:21

Hi Jiayu,
quoted hunk ↗ jump to hunk
-----Original Message-----
From: Hu, Jiayu <redacted>
Sent: Tuesday, July 13, 2021 3:46 PM
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com; Xia, Chenbo <redacted>; Hu, Jiayu
[off-list ref]
Subject: [PATCH v4 3/3] vhost: add thread unsafe async registeration functions

This patch adds thread unsafe version for async register and
unregister functions.

Signed-off-by: Jiayu Hu <redacted>
---
 doc/guides/prog_guide/vhost_lib.rst |  12 +++
 lib/vhost/rte_vhost_async.h         |  39 ++++++++++
 lib/vhost/version.map               |   4 +
 lib/vhost/vhost.c                   | 146 +++++++++++++++++++++++++++--------
-
 4 files changed, 167 insertions(+), 34 deletions(-)
diff --git a/doc/guides/prog_guide/vhost_lib.rst
b/doc/guides/prog_guide/vhost_lib.rst
index affdc57..ffe09a3 100644
--- a/doc/guides/prog_guide/vhost_lib.rst
+++ b/doc/guides/prog_guide/vhost_lib.rst
@@ -256,6 +256,12 @@ The following is an overview of some key Vhost API
functions:
     vhost invokes this function to get the copy data completed by async
     devices.

+* ``rte_vhost_async_channel_register_thread_unsafe(vid, queue_id, config,
ops)``
+  Register a vhost queue with async copy device channel without
'Register an async copy device channel for a vhost queue' sounds better 
+  performing any locking.
+
+  This function is only safe to call from within vhost callback functions.
call in vhost callback functions?
quoted hunk ↗ jump to hunk
+
 * ``rte_vhost_async_channel_unregister(vid, queue_id)``

   Unregister the async copy device channel from a vhost queue.
@@ -268,6 +274,12 @@ The following is an overview of some key Vhost API
functions:
   devices for all vhost queues in destroy_device(), when a
   virtio device is paused or shut down.

+* ``rte_vhost_async_channel_unregister_thread_unsafe(vid, queue_id)``
+  Unregister the async copy device channel from a vhost queue without
for a vhost queue?
+  performing any locking.
+
+  This function is only safe to call from within vhost callback functions.
Call in vhost callback functions?

And let's make it clearer. Add this: (i.e., struct vhost_device_ops)
quoted hunk ↗ jump to hunk
+
 * ``rte_vhost_submit_enqueue_burst(vid, queue_id, pkts, count, comp_pkts,
comp_count)``

   Submit an enqueue request to transmit ``count`` packets from host to guest
diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h
index c93490d..e4d20a3 100644
--- a/lib/vhost/rte_vhost_async.h
+++ b/lib/vhost/rte_vhost_async.h
@@ -142,6 +142,45 @@ __rte_experimental
 int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id);

 /**
+ * register an async channel for vhost without performing any locking
register -> Register

for vhost -> for a vhost queue
+ *
+ * @note This function does not perform any locking, and is only safe to call
+ *       from within vhost callback functions.
From within -> in ?
+ *
+ * @param vid
+ *  vhost device id async channel to be attached to
+ * @param queue_id
+ *  vhost queue id async channel to be attached to
+ * @param config
+ *  DMA channel configuration
DMA -> async?
+ * @param ops
+ *  DMA operation callbacks
Async channel operation callbacks?
+ * @return
+ *  0 on success, -1 on failures
+ */
+__rte_experimental
+int rte_vhost_async_channel_register_thread_unsafe(int vid, uint16_t queue_id,
According to DPDK coding style. Return value should not be in the same line
of the function name. Just make a new line for it. Please check other functions like
unregister.
+	struct rte_vhost_async_config config,
+	struct rte_vhost_async_channel_ops *ops);
+
+/**
+ * unregister a dma channel for vhost without performing any lock
Unregister an async channel for a vhost queue
+ *
+ * @note This function does not perform any locking, and is only safe to call
+ *       from within vhost callback functions.
in vhost callback functions
+ *
+ * @param vid
+ *  vhost device id DMA channel to be detached
Vhost device id Async channel to be detached from
+ * @param queue_id
+ *  vhost queue id DMA channel to be detached
Ditto
+ * @return
+ *  0 on success, -1 on failures
+ */
--
2.7.4
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help