interrupts: make interrupt handle structure opaque
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>
This commit is contained in:
parent
d61138d4f0
commit
73d844fd08
@ -10,6 +10,8 @@
|
|||||||
#include <rte_log.h>
|
#include <rte_log.h>
|
||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
|
|
||||||
|
#include "eal_interrupts.h"
|
||||||
|
|
||||||
/* Macros to check for valid interrupt handle */
|
/* Macros to check for valid interrupt handle */
|
||||||
#define CHECK_VALID_INTR_HANDLE(intr_handle) do { \
|
#define CHECK_VALID_INTR_HANDLE(intr_handle) do { \
|
||||||
if (intr_handle == NULL) { \
|
if (intr_handle == NULL) { \
|
||||||
|
37
lib/eal/common/eal_interrupts.h
Normal file
37
lib/eal/common/eal_interrupts.h
Normal file
@ -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 */
|
@ -49,7 +49,6 @@ headers += files(
|
|||||||
'rte_version.h',
|
'rte_version.h',
|
||||||
'rte_vfio.h',
|
'rte_vfio.h',
|
||||||
)
|
)
|
||||||
indirect_headers += files('rte_eal_interrupts.h')
|
|
||||||
|
|
||||||
# special case install the generic headers, since they go in a subdir
|
# special case install the generic headers, since they go in a subdir
|
||||||
generic_headers = files(
|
generic_headers = files(
|
||||||
|
@ -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_ */
|
|
@ -19,6 +19,8 @@ extern "C" {
|
|||||||
#include <rte_interrupts.h>
|
#include <rte_interrupts.h>
|
||||||
#include <rte_trace_point.h>
|
#include <rte_trace_point.h>
|
||||||
|
|
||||||
|
#include "eal_interrupts.h"
|
||||||
|
|
||||||
/* Alarm */
|
/* Alarm */
|
||||||
RTE_TRACE_POINT(
|
RTE_TRACE_POINT(
|
||||||
rte_eal_trace_alarm_set,
|
rte_eal_trace_alarm_set,
|
||||||
|
@ -35,6 +35,28 @@ struct rte_intr_handle;
|
|||||||
/** Interrupt instance will be shared between primary and secondary processes. */
|
/** Interrupt instance will be shared between primary and secondary processes. */
|
||||||
#define RTE_INTR_INSTANCE_F_SHARED RTE_BIT32(0)
|
#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 */
|
/** Function to be registered for the specific interrupt */
|
||||||
typedef void (*rte_intr_callback_fn)(void *cb_arg);
|
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,
|
typedef void (*rte_intr_unregister_callback_fn)(struct rte_intr_handle *intr_handle,
|
||||||
void *cb_arg);
|
void *cb_arg);
|
||||||
|
|
||||||
#include "rte_eal_interrupts.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It registers the callback for the specific interrupt. Multiple
|
* It registers the callback for the specific interrupt. Multiple
|
||||||
* callbacks can be registered at the same time.
|
* callbacks can be registered at the same time.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user