interrupts: make interrupt handle structure opaque
authorHarman Kalra <hkalra@marvell.com>
Fri, 22 Oct 2021 20:49:33 +0000 (02:19 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Mon, 25 Oct 2021 19:20:12 +0000 (21:20 +0200)
Moving interrupt handle structure definition inside a EAL private
header to make its fields totally opaque to the outside world.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Raslan Darawsheh <rasland@nvidia.com>
lib/eal/common/eal_common_interrupts.c
lib/eal/common/eal_interrupts.h [new file with mode: 0644]
lib/eal/include/meson.build
lib/eal/include/rte_eal_interrupts.h [deleted file]
lib/eal/include/rte_eal_trace.h
lib/eal/include/rte_interrupts.h

index 875e819..90d972e 100644 (file)
@@ -10,6 +10,8 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 
+#include "eal_interrupts.h"
+
 /* Macros to check for valid interrupt handle */
 #define CHECK_VALID_INTR_HANDLE(intr_handle) do { \
        if (intr_handle == NULL) { \
diff --git a/lib/eal/common/eal_interrupts.h b/lib/eal/common/eal_interrupts.h
new file mode 100644 (file)
index 0000000..beacc04
--- /dev/null
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#ifndef EAL_INTERRUPTS_H
+#define EAL_INTERRUPTS_H
+
+struct rte_intr_handle {
+       RTE_STD_C11
+       union {
+               struct {
+                       RTE_STD_C11
+                       union {
+                               /** VFIO device file descriptor */
+                               int vfio_dev_fd;
+                               /** UIO cfg file desc for uio_pci_generic */
+                               int uio_cfg_fd;
+                       };
+                       int fd; /**< interrupt event file descriptor */
+               };
+               void *windows_handle; /**< device driver handle */
+       };
+       uint32_t alloc_flags;   /**< flags passed at allocation */
+       enum rte_intr_handle_type type;  /**< handle type */
+       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 */
+       uint16_t nb_intr;
+               /**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */
+       int efds[RTE_MAX_RXTX_INTR_VEC_ID];  /**< intr vectors/efds mapping */
+       struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID];
+                                      /**< intr vector epoll event */
+       uint16_t vec_list_size;
+       int *intr_vec;                 /**< intr vector number array */
+};
+
+#endif /* EAL_INTERRUPTS_H */
index 8e25860..86468d1 100644 (file)
@@ -49,7 +49,6 @@ headers += files(
         'rte_version.h',
         'rte_vfio.h',
 )
-indirect_headers += files('rte_eal_interrupts.h')
 
 # special case install the generic headers, since they go in a subdir
 generic_headers = files(
diff --git a/lib/eal/include/rte_eal_interrupts.h b/lib/eal/include/rte_eal_interrupts.h
deleted file mode 100644 (file)
index 60bb60c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef _RTE_INTERRUPTS_H_
-#error "don't include this file directly, please include generic <rte_interrupts.h>"
-#endif
-
-/**
- * @file rte_eal_interrupts.h
- * @internal
- *
- * Contains function prototypes exposed by the EAL for interrupt handling by
- * drivers and other DPDK internal consumers.
- */
-
-#ifndef _RTE_EAL_INTERRUPTS_H_
-#define _RTE_EAL_INTERRUPTS_H_
-
-#define RTE_MAX_RXTX_INTR_VEC_ID      512
-#define RTE_INTR_VEC_ZERO_OFFSET      0
-#define RTE_INTR_VEC_RXTX_OFFSET      1
-
-/**
- * The interrupt source type, e.g. UIO, VFIO, ALARM etc.
- */
-enum rte_intr_handle_type {
-       RTE_INTR_HANDLE_UNKNOWN = 0,  /**< generic unknown handle */
-       RTE_INTR_HANDLE_UIO,          /**< uio device handle */
-       RTE_INTR_HANDLE_UIO_INTX,     /**< uio generic handle */
-       RTE_INTR_HANDLE_VFIO_LEGACY,  /**< vfio device handle (legacy) */
-       RTE_INTR_HANDLE_VFIO_MSI,     /**< vfio device handle (MSI) */
-       RTE_INTR_HANDLE_VFIO_MSIX,    /**< vfio device handle (MSIX) */
-       RTE_INTR_HANDLE_ALARM,        /**< alarm handle */
-       RTE_INTR_HANDLE_EXT,          /**< external handler */
-       RTE_INTR_HANDLE_VDEV,         /**< virtual device */
-       RTE_INTR_HANDLE_DEV_EVENT,    /**< device event handle */
-       RTE_INTR_HANDLE_VFIO_REQ,     /**< VFIO request handle */
-       RTE_INTR_HANDLE_MAX           /**< count of elements */
-};
-
-/** Handle for interrupts. */
-struct rte_intr_handle {
-       RTE_STD_C11
-       union {
-               struct {
-                       RTE_STD_C11
-                       union {
-                               /** VFIO device file descriptor */
-                               int vfio_dev_fd;
-                               /** UIO cfg file desc for uio_pci_generic */
-                               int uio_cfg_fd;
-                       };
-                       int fd; /**< interrupt event file descriptor */
-               };
-               void *windows_handle; /**< device driver handle */
-       };
-       uint32_t alloc_flags;   /**< flags passed at allocation */
-       enum rte_intr_handle_type type;  /**< handle type */
-       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 */
-       uint16_t nb_intr;
-               /**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */
-       int efds[RTE_MAX_RXTX_INTR_VEC_ID];  /**< intr vectors/efds mapping */
-       struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID];
-                                      /**< intr vector epoll event */
-       uint16_t vec_list_size;
-       int *intr_vec;                 /**< intr vector number array */
-};
-
-#endif /* _RTE_EAL_INTERRUPTS_H_ */
index 495ae1e..af7b2d0 100644 (file)
@@ -19,6 +19,8 @@ extern "C" {
 #include <rte_interrupts.h>
 #include <rte_trace_point.h>
 
+#include "eal_interrupts.h"
+
 /* Alarm */
 RTE_TRACE_POINT(
        rte_eal_trace_alarm_set,
index 3c17492..bcf6aba 100644 (file)
@@ -35,6 +35,28 @@ struct rte_intr_handle;
 /** Interrupt instance will be shared between primary and secondary processes. */
 #define RTE_INTR_INSTANCE_F_SHARED      RTE_BIT32(0)
 
+#define RTE_MAX_RXTX_INTR_VEC_ID      512
+#define RTE_INTR_VEC_ZERO_OFFSET      0
+#define RTE_INTR_VEC_RXTX_OFFSET      1
+
+/**
+ * The interrupt source type, e.g. UIO, VFIO, ALARM etc.
+ */
+enum rte_intr_handle_type {
+       RTE_INTR_HANDLE_UNKNOWN = 0,  /**< generic unknown handle */
+       RTE_INTR_HANDLE_UIO,          /**< uio device handle */
+       RTE_INTR_HANDLE_UIO_INTX,     /**< uio generic handle */
+       RTE_INTR_HANDLE_VFIO_LEGACY,  /**< vfio device handle (legacy) */
+       RTE_INTR_HANDLE_VFIO_MSI,     /**< vfio device handle (MSI) */
+       RTE_INTR_HANDLE_VFIO_MSIX,    /**< vfio device handle (MSIX) */
+       RTE_INTR_HANDLE_ALARM,        /**< alarm handle */
+       RTE_INTR_HANDLE_EXT,          /**< external handler */
+       RTE_INTR_HANDLE_VDEV,         /**< virtual device */
+       RTE_INTR_HANDLE_DEV_EVENT,    /**< device event handle */
+       RTE_INTR_HANDLE_VFIO_REQ,     /**< VFIO request handle */
+       RTE_INTR_HANDLE_MAX           /**< count of elements */
+};
+
 /** Function to be registered for the specific interrupt */
 typedef void (*rte_intr_callback_fn)(void *cb_arg);
 
@@ -45,8 +67,6 @@ typedef void (*rte_intr_callback_fn)(void *cb_arg);
 typedef void (*rte_intr_unregister_callback_fn)(struct rte_intr_handle *intr_handle,
                                                void *cb_arg);
 
-#include "rte_eal_interrupts.h"
-
 /**
  * It registers the callback for the specific interrupt. Multiple
  * callbacks can be registered at the same time.