[PATCH v5 3/5] eal/interrupts: add IRQ count in interrupt handle
Nipun Gupta
nipun.gupta at amd.com
Thu May 25 12:08:19 CEST 2023
Have total number of IRQ count support in interrupt handle.
In case of VFIO this IRQ count is returned when
VFIO_DEVICE_GET_IRQ_INFO ioctl is invoked. This IRQ_count can
used by the devices to store/provide total number of interrupts
available and to enable or disable these interrupts.
Signed-off-by: Nipun Gupta <nipun.gupta at amd.com>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
lib/eal/common/eal_common_interrupts.c | 21 +++++++++++++++++
lib/eal/common/eal_interrupts.h | 1 +
lib/eal/include/rte_interrupts.h | 32 ++++++++++++++++++++++++++
lib/eal/version.map | 2 ++
4 files changed, 56 insertions(+)
diff --git a/lib/eal/common/eal_common_interrupts.c b/lib/eal/common/eal_common_interrupts.c
index 97b64fed58..a0167d9ad4 100644
--- a/lib/eal/common/eal_common_interrupts.c
+++ b/lib/eal/common/eal_common_interrupts.c
@@ -398,6 +398,27 @@ int rte_intr_elist_index_set(struct rte_intr_handle *intr_handle,
return -rte_errno;
}
+int rte_intr_irq_count_set(struct rte_intr_handle *intr_handle,
+ int irq_count)
+{
+ CHECK_VALID_INTR_HANDLE(intr_handle);
+
+ intr_handle->irq_count = irq_count;
+
+ return 0;
+fail:
+ return -rte_errno;
+}
+
+int rte_intr_irq_count_get(const struct rte_intr_handle *intr_handle)
+{
+ CHECK_VALID_INTR_HANDLE(intr_handle);
+
+ return intr_handle->irq_count;
+fail:
+ return -rte_errno;
+}
+
int rte_intr_vec_list_alloc(struct rte_intr_handle *intr_handle,
const char *name, int size)
{
diff --git a/lib/eal/common/eal_interrupts.h b/lib/eal/common/eal_interrupts.h
index 482781b862..eaf8e20187 100644
--- a/lib/eal/common/eal_interrupts.h
+++ b/lib/eal/common/eal_interrupts.h
@@ -16,6 +16,7 @@ struct rte_intr_handle {
};
uint32_t alloc_flags; /**< flags passed at allocation */
enum rte_intr_handle_type type; /**< handle type */
+ uint32_t irq_count; /**< Total IRQ count */
uint32_t max_intr; /**< max interrupt requested */
uint32_t nb_efd; /**< number of available efd(event fd) */
uint8_t efd_counter_size; /**< size of efd counter, used for vdev */
diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h
index 487e3c8875..415d1fcac0 100644
--- a/lib/eal/include/rte_interrupts.h
+++ b/lib/eal/include/rte_interrupts.h
@@ -506,6 +506,38 @@ __rte_internal
int
rte_intr_max_intr_get(const struct rte_intr_handle *intr_handle);
+/**
+ * @internal
+ * Set the IRQ count field of interrupt handle with user
+ * provided IRQ count value.
+ *
+ * @param intr_handle
+ * pointer to the interrupt handle.
+ * @param irq_count
+ * IRQ count
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value and rte_errno is set.
+ */
+__rte_internal
+int
+rte_intr_irq_count_set(struct rte_intr_handle *intr_handle, int irq_count);
+
+/**
+ * @internal
+ * Returns the IRQ count field of the given interrupt handle instance.
+ *
+ * @param intr_handle
+ * pointer to the interrupt handle.
+ *
+ * @return
+ * - On success, ir count.
+ * - On failure, a negative value and rte_errno is set.
+ */
+__rte_internal
+int rte_intr_irq_count_get(const struct rte_intr_handle *intr_handle);
+
/**
* @internal
* Set the number of event fd field of interrupt handle
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 51a820d829..d31c942e04 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -458,6 +458,8 @@ INTERNAL {
rte_intr_instance_dup;
rte_intr_instance_windows_handle_get;
rte_intr_instance_windows_handle_set;
+ rte_intr_irq_count_get;
+ rte_intr_irq_count_set;
rte_intr_max_intr_get;
rte_intr_max_intr_set;
rte_intr_nb_efd_get;
--
2.17.1
More information about the dev
mailing list