vhost: relax full barriers for desc flags
[dpdk.git] / lib / librte_vhost / rte_vhost_async.h
index d5a5927..c73bd7c 100644 (file)
@@ -59,9 +59,9 @@ struct rte_vhost_async_channel_ops {
         * @param count
         *  number of elements in the "descs" array
         * @return
-        *  -1 on failure, number of descs processed on success
+        *  number of descs processed
         */
-       int (*transfer_data)(int vid, uint16_t queue_id,
+       uint32_t (*transfer_data)(int vid, uint16_t queue_id,
                struct rte_vhost_async_desc *descs,
                struct rte_vhost_async_status *opaque_data,
                uint16_t count);
@@ -70,19 +70,32 @@ struct rte_vhost_async_channel_ops {
         * @param vid
         *  id of vhost device to check copy completion
         * @param queue_id
-        *  queue id to check copyp completion
+        *  queue id to check copy completion
         * @param opaque_data
         *  buffer to receive the opaque data pair from DMA engine
         * @param max_packets
         *  max number of packets could be completed
         * @return
-        *  -1 on failure, number of iov segments completed on success
+        *  number of async descs completed
         */
-       int (*check_completed_copies)(int vid, uint16_t queue_id,
+       uint32_t (*check_completed_copies)(int vid, uint16_t queue_id,
                struct rte_vhost_async_status *opaque_data,
                uint16_t max_packets);
 };
 
+/**
+ * inflight async packet information
+ */
+struct async_inflight_info {
+       union {
+               uint32_t info;
+               struct {
+                       uint16_t descs; /* num of descs inflight */
+                       uint16_t segs; /* iov segs inflight */
+               };
+       };
+};
+
 /**
  *  dma channel feature bit definition
  */
@@ -133,4 +146,44 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,
 __rte_experimental
 int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id);
 
+/**
+ * This function submit enqueue data to async engine. This function has
+ * no guranttee to the transfer completion upon return. Applications
+ * should poll transfer status by rte_vhost_poll_enqueue_completed()
+ *
+ * @param vid
+ *  id of vhost device to enqueue data
+ * @param queue_id
+ *  queue id to enqueue data
+ * @param pkts
+ *  array of packets to be enqueued
+ * @param count
+ *  packets num to be enqueued
+ * @return
+ *  num of packets enqueued
+ */
+__rte_experimental
+uint16_t rte_vhost_submit_enqueue_burst(int vid, uint16_t queue_id,
+               struct rte_mbuf **pkts, uint16_t count);
+
+/**
+ * This function check async completion status for a specific vhost
+ * device queue. Packets which finish copying (enqueue) operation
+ * will be returned in an array.
+ *
+ * @param vid
+ *  id of vhost device to enqueue data
+ * @param queue_id
+ *  queue id to enqueue data
+ * @param pkts
+ *  blank array to get return packet pointer
+ * @param count
+ *  size of the packet array
+ * @return
+ *  num of packets returned
+ */
+__rte_experimental
+uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
+               struct rte_mbuf **pkts, uint16_t count);
+
 #endif /* _RTE_VHOST_ASYNC_H_ */