common/mlx5: add Direct Verbs constants for Windows
[dpdk.git] / drivers / bus / vmbus / rte_bus_vmbus.h
index 0100f80..466d42d 100644 (file)
@@ -20,7 +20,6 @@ extern "C" {
 #include <limits.h>
 #include <stdbool.h>
 #include <errno.h>
-#include <sys/queue.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -38,15 +37,15 @@ struct rte_vmbus_bus;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
-TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
-TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
+RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
+RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
 
 /* VMBus iterators */
 #define FOREACH_DEVICE_ON_VMBUS(p)     \
-       TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
+       RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
 
 #define FOREACH_DRIVER_ON_VMBUS(p)     \
-       TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
+       RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
 
 /** Maximum number of VMBUS resources. */
 enum hv_uio_map {
@@ -62,7 +61,7 @@ enum hv_uio_map {
  * A structure describing a VMBUS device.
  */
 struct rte_vmbus_device {
-       TAILQ_ENTRY(rte_vmbus_device) next;    /**< Next probed VMBUS device */
+       RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
        const struct rte_vmbus_driver *driver; /**< Associated driver */
        struct rte_device device;              /**< Inherit core device */
        rte_uuid_t device_id;                  /**< VMBUS device id */
@@ -74,7 +73,7 @@ struct rte_vmbus_device {
        struct vmbus_channel *primary;         /**< VMBUS primary channel */
        struct vmbus_mon_page *monitor_page;   /**< VMBUS monitor page */
 
-       struct rte_intr_handle intr_handle;    /**< Interrupt handle */
+       struct rte_intr_handle *intr_handle;    /**< Interrupt handle */
        struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
 };
 
@@ -93,7 +92,7 @@ typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
  * A structure describing a VMBUS driver.
  */
 struct rte_vmbus_driver {
-       TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
+       RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
        struct rte_driver driver;
        struct rte_vmbus_bus *bus;          /**< VM bus reference. */
        vmbus_probe_t *probe;               /**< Device Probe function. */
@@ -337,12 +336,23 @@ int rte_vmbus_chan_recv(struct vmbus_channel *chan,
  * @param len
  *     Pointer to size of receive buffer (in/out)
  * @return
- *   On success, returns 0
+ *   On success, returns number of bytes read.
  *   On failure, returns negative errno.
  */
 int rte_vmbus_chan_recv_raw(struct vmbus_channel *chan,
                            void *data, uint32_t *len);
 
+/**
+ * Notify host of bytes read (after recv_raw)
+ * Signals host if required.
+ *
+ * @param channel
+ *     Pointer to vmbus_channel structure.
+ * @param bytes_read
+ *     Number of bytes read since last signal
+ */
+void rte_vmbus_chan_signal_read(struct vmbus_channel *chan, uint32_t bytes_read);
+
 /**
  * Determine sub channel index of the given channel
  *
@@ -353,6 +363,21 @@ int rte_vmbus_chan_recv_raw(struct vmbus_channel *chan,
  */
 uint16_t rte_vmbus_sub_channel_index(const struct vmbus_channel *chan);
 
+/**
+ * Set the host monitor latency hint
+ *
+ * @param dev
+ *    VMBUS device
+ * @param chan
+ *     Pointer to vmbus_channel structure.
+ * @param latency
+ *     Approximate wait period between hypervisor examinations of
+ *     the trigger page (in nanoseconds).
+ */
+void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
+                          const struct vmbus_channel *chan,
+                          uint32_t latency);
+
 /**
  * Register a VMBUS driver.
  *
@@ -381,8 +406,7 @@ void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
 
 /** Helper for VMBUS device registration from driver instance */
 #define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)          \
-       RTE_INIT(vmbusinitfn_ ##nm);                    \
-       static void vmbusinitfn_ ##nm(void)             \
+       RTE_INIT(vmbusinitfn_ ##nm)                     \
        {                                               \
                (vmbus_drv).driver.name = RTE_STR(nm);  \
                rte_vmbus_register(&vmbus_drv);         \