[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2 7/7] lib/ukconsdev: Enable interrupts on console device
Signed-off-by: Birlea Costin <costin.birlea@xxxxxxxxx> --- lib/ukconsdev/consdev.c | 2 ++ lib/ukconsdev/exportsyms.uk | 2 ++ lib/ukconsdev/include/uk/consdev.h | 44 +++++++++++++++++++++++++++++++++ lib/ukconsdev/include/uk/consdev_core.h | 8 ++++++ 4 files changed, 56 insertions(+) diff --git a/lib/ukconsdev/consdev.c b/lib/ukconsdev/consdev.c index 774199dc..5a479b52 100644 --- a/lib/ukconsdev/consdev.c +++ b/lib/ukconsdev/consdev.c @@ -451,6 +451,8 @@ int uk_consdev_drv_register(struct uk_consdev *dev, struct uk_alloc *a, UK_ASSERT(dev->ops->unconfigure); UK_ASSERT(dev->ops->start); UK_ASSERT(dev->ops->stop); + UK_ASSERT((dev->ops->rxq_intr_enable && dev->ops->rxq_intr_disable) + || (!dev->ops->rxq_intr_enable && !dev->ops->rxq_intr_disable)); UK_ASSERT(dev->ops->transmit); UK_ASSERT(dev->ops->receive); diff --git a/lib/ukconsdev/exportsyms.uk b/lib/ukconsdev/exportsyms.uk index dec7a21d..3a2ea660 100644 --- a/lib/ukconsdev/exportsyms.uk +++ b/lib/ukconsdev/exportsyms.uk @@ -7,6 +7,8 @@ uk_consdev_txq_configure uk_consdev_unconfigure uk_consdev_start uk_consdev_stop +uk_consdev_rxq_intr_enable +uk_consdev_rxq_intr_disable uk_consdev_transmit uk_consdev_receive uk_consdev_count diff --git a/lib/ukconsdev/include/uk/consdev.h b/lib/ukconsdev/include/uk/consdev.h index 3fcfb9ae..940f3f37 100644 --- a/lib/ukconsdev/include/uk/consdev.h +++ b/lib/ukconsdev/include/uk/consdev.h @@ -219,6 +219,50 @@ int uk_consdev_start(struct uk_consdev *dev); int uk_consdev_stop(struct uk_consdev *dev); /** + * Enable interrupts for rx. + * + * @param dev + * The Unikraft Console Device in running state. + * @return + * - (0): Success, interrupts enabled. + * - (-ENOTSUP): Driver does not support interrupts. + */ +static inline int uk_consdev_rxq_intr_enable(struct uk_consdev *dev) +{ + UK_ASSERT(dev); + UK_ASSERT(dev->ops); + UK_ASSERT(dev->_data); + UK_ASSERT(dev->_data->state == UK_CONSDEV_RUNNING); + + if (unlikely(!dev->ops->rxq_intr_enable)) + return -ENOTSUP; + + return dev->ops->rxq_intr_enable(dev); +} + +/** + * Disable interrupts for rx. + * + * @param dev + * The Unikraft Console Device in running state. + * @return + * - (0): Success, interrupts disabled. + * - (-ENOTSUP): Driver does not support interrupts. + */ +static inline int uk_consdev_rxq_intr_disable(struct uk_consdev *dev) +{ + UK_ASSERT(dev); + UK_ASSERT(dev->_data); + UK_ASSERT(dev->ops); + UK_ASSERT(dev->_data->state == UK_CONSDEV_RUNNING); + + if (unlikely(!dev->ops->rxq_intr_disable)) + return -ENOTSUP; + + return dev->ops->rxq_intr_disable(dev); +} + +/** * Transmit to a Console Device - Asynchronous * * @param dev diff --git a/lib/ukconsdev/include/uk/consdev_core.h b/lib/ukconsdev/include/uk/consdev_core.h index 35660653..2be78833 100644 --- a/lib/ukconsdev/include/uk/consdev_core.h +++ b/lib/ukconsdev/include/uk/consdev_core.h @@ -170,6 +170,12 @@ typedef int (*uk_consdev_txq_configure_t)(struct uk_consdev *dev, /** Driver callback type to unconfigure a configured Unikraft console device */ typedef int (*uk_consdev_unconfigure_t)(struct uk_consdev *dev); +/** Driver callback type to enable interrupts of an Unikraft console device. */ +typedef int (*uk_consdev_rxq_intr_enable_t)(struct uk_consdev *dev); + +/** Driver callback type to disable interrupts of an Unikraft console device. */ +typedef int (*uk_consdev_rxq_intr_disable_t)(struct uk_consdev *dev); + /** Driver callback type to start a configured Unikraft console device. */ typedef int (*uk_consdev_start_t)(struct uk_consdev *dev); @@ -194,6 +200,8 @@ struct uk_consdev_ops { uk_consdev_unconfigure_t unconfigure; uk_consdev_start_t start; uk_consdev_stop_t stop; + uk_consdev_rxq_intr_enable_t rxq_intr_enable; + uk_consdev_rxq_intr_disable_t rxq_intr_disable; uk_consdev_transmit_t transmit; uk_consdev_receive_t receive; }; -- 2.11.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |